Skip to content

Commit 03358e4

Browse files
Merge branch 'main' into integrate-notification-system
2 parents a1f38e5 + 9fcec8e commit 03358e4

File tree

27 files changed

+328
-197
lines changed

27 files changed

+328
-197
lines changed

.github/workflows/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
deploy:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
7+
- uses: actions/checkout@v4
88
- uses: actions/setup-python@v5
99
with:
1010
python-version: '3.12'

.github/workflows/lint.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
matrix:
1111
python-version: ['3.8', '3.12']
1212
steps:
13-
- uses: actions/checkout@v4
14-
- uses: actions/setup-python@v5
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
- name: Install tox
18-
run: python -m pip install 'tox>=1.8.0'
19-
- name: Lint
20-
run: tox -e lint
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Install tox
18+
run: python -m pip install 'tox>=1.8.0'
19+
- name: Lint
20+
run: tox -e lint

.github/workflows/test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
tox_env: [py38]
3434
galaxy_version:
3535
- dev
36+
- release_24.1
3637
- release_24.0
3738
- release_23.2
3839
- release_23.1
@@ -59,7 +60,7 @@ jobs:
5960
steps:
6061
- uses: actions/checkout@v4
6162
- name: Cache pip dir
62-
uses: actions/cache@v3
63+
uses: actions/cache@v4
6364
with:
6465
path: ~/.cache/pip
6566
key: pip-cache-${{ matrix.tox_env }}-${{ matrix.galaxy_version }}

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
### BioBlend v
22

3+
* Added support for Galaxy release 24.1.
4+
5+
### BioBlend v1.3.0 - 2024-05-12
6+
37
* Dropped support for Python 3.7. Added support for Python 3.12. Added support
48
for Galaxy releases 23.2 and 24.0.
59

10+
* Added ``copy_elements`` parameter to
11+
``HistoryClient.create_dataset_collection()`` and BioBlend.objects
12+
``History.create_dataset_collection()`` methods.
13+
14+
* Added ``wait`` parameter to ``HistoryClient.delete_dataset()`` and
15+
BioBlend.objects ``HistoryDatasetAssociation.delete()`` methods.
16+
17+
* Added ``create_time_min``, ``create_time_max``, ``update_time_min``,
18+
``update_time_max``, ``view``, ``keys``, ``limit`` and ``offset`` parameters
19+
to ``HistoryClient.get_histories()`` (thanks to
20+
[cat-bro](https://github.com/cat-bro)).
21+
22+
* Added ``create_time_min``, ``create_time_max``, ``update_time_min`` and
23+
``update_time_max`` parameters to ``HistoryClient.get_published_histories()``
24+
(thanks to [cat-bro](https://github.com/cat-bro)).
25+
26+
* Added ``keys`` parameter to ``HistoryClient.show_history()`` (thanks to
27+
[cat-bro](https://github.com/cat-bro)).
28+
629
* Dropped broken ``deleted`` parameter of ``DatasetClient.show_dataset()``.
730

831
* Parameters after ``password`` in the ``__init__()`` method of the
@@ -12,8 +35,17 @@
1235
* Classes defined in ``bioblend.galaxy.objects.wrappers`` are no more
1336
re-exported by ``bioblend.galaxy.objects``.
1437

38+
* ``DatasetTimeoutException`` and ``DatasetCollectionTimeoutException`` are now
39+
aliases for ``TimeoutException`` instead of subclasses.
40+
1541
* Added support for the new "cancelling" invocation state.
1642

43+
* Fixed ``InvocationClient.get_invocation_biocompute_object()`` method on
44+
upcoming Galaxy 24.1 .
45+
46+
* Improvements to linting and tests (thanks to
47+
[Matthias Bernt](https://github.com/bernt-matthias)).
48+
1749
### BioBlend v1.2.0 - 2023-06-30
1850

1951
* Dropped support for Galaxy releases 17.09-19.01. Added support for Galaxy

bioblend/__init__.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
import logging
33
import logging.config
44
import os
5+
import time
56
from typing import (
7+
Callable,
68
Optional,
9+
TypeVar,
710
Union,
811
)
912

@@ -13,7 +16,7 @@
1316
)
1417

1518
# Current version of the library
16-
__version__ = "1.2.0"
19+
__version__ = "1.3.0"
1720

1821
# default chunk size (in bytes) for reading remote data
1922
try:
@@ -116,3 +119,38 @@ def __str__(self) -> str:
116119

117120
class TimeoutException(Exception):
118121
pass
122+
123+
124+
class NotReady(Exception):
125+
pass
126+
127+
128+
T = TypeVar("T")
129+
130+
131+
def wait_on(func: Callable[[], T], maxwait: float = 60, interval: float = 3) -> T:
132+
"""
133+
Wait until a function returns without raising a NotReady exception
134+
135+
:param func: function to wait on. It should accept no parameters.
136+
137+
:param maxwait: Total time (in seconds) to wait for the function to return
138+
without raising a NotReady exception. After this time, a
139+
``TimeoutException`` will be raised.
140+
141+
:param interval: Time (in seconds) to wait between 2 consecutive checks.
142+
"""
143+
assert maxwait >= 0
144+
assert interval > 0
145+
146+
time_left = maxwait
147+
while True:
148+
try:
149+
return func()
150+
except NotReady as e:
151+
if time_left > 0:
152+
log.info("%s. Will wait %s more s", e, time_left)
153+
time.sleep(min(time_left, interval))
154+
time_left -= interval
155+
else:
156+
raise TimeoutException(f"{e} after {maxwait} s")

bioblend/_tests/TestGalaxyDatasets.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def setUp(self):
2424
def tearDown(self):
2525
self.gi.histories.delete_history(self.history_id, purge=True)
2626

27-
@test_util.skip_unless_galaxy("release_19.05")
2827
def test_show_nonexistent_dataset(self):
2928
with pytest.raises(ConnectionError):
3029
self.gi.datasets.show_dataset("nonexistent_id")
@@ -65,25 +64,21 @@ def test_download_dataset(self):
6564
f.flush()
6665
assert f.read() == expected_contents
6766

68-
@test_util.skip_unless_galaxy("release_19.05")
6967
def test_get_datasets(self):
7068
datasets = self.gi.datasets.get_datasets()
7169
dataset_ids = [dataset["id"] for dataset in datasets]
7270
assert self.dataset_id in dataset_ids
7371

74-
@test_util.skip_unless_galaxy("release_19.05")
7572
def test_get_datasets_history(self):
7673
datasets = self.gi.datasets.get_datasets(history_id=self.history_id)
7774
assert len(datasets) == 1
7875

79-
@test_util.skip_unless_galaxy("release_19.05")
8076
def test_get_datasets_limit_offset(self):
8177
datasets = self.gi.datasets.get_datasets(limit=1)
8278
assert len(datasets) == 1
8379
datasets = self.gi.datasets.get_datasets(history_id=self.history_id, offset=1)
8480
assert datasets == []
8581

86-
@test_util.skip_unless_galaxy("release_19.05")
8782
def test_get_datasets_name(self):
8883
datasets = self.gi.datasets.get_datasets(history_id=self.history_id, name="Pasted Entry")
8984
assert len(datasets) == 1
@@ -143,7 +138,6 @@ def test_get_datasets_visible(self):
143138
datasets = self.gi.datasets.get_datasets(history_id=self.history_id, visible=False)
144139
assert len(datasets) == 0
145140

146-
@test_util.skip_unless_galaxy("release_19.05")
147141
def test_get_datasets_ordering(self):
148142
self.dataset_id2 = self._test_dataset(self.history_id, contents=self.dataset_contents)
149143
self.gi.datasets.wait_for_dataset(self.dataset_id2)
@@ -156,7 +150,6 @@ def test_get_datasets_ordering(self):
156150
datasets = self.gi.datasets.get_datasets(history_id=self.history_id, order="hid-asc")
157151
assert datasets[0]["id"] == self.dataset_id
158152

159-
@test_util.skip_unless_galaxy("release_19.05")
160153
def test_get_datasets_deleted(self):
161154
deleted_datasets = self.gi.datasets.get_datasets(history_id=self.history_id, deleted=True)
162155
assert deleted_datasets == []
@@ -165,11 +158,10 @@ def test_get_datasets_deleted(self):
165158
assert len(deleted_datasets) == 1
166159
purged_datasets = self.gi.datasets.get_datasets(history_id=self.history_id, purged=True)
167160
assert purged_datasets == []
168-
self.gi.histories.delete_dataset(self.history_id, self.dataset_id, purge=True)
161+
self.gi.histories.delete_dataset(self.history_id, self.dataset_id, purge=True, wait=True)
169162
purged_datasets = self.gi.datasets.get_datasets(history_id=self.history_id, purged=True)
170163
assert len(purged_datasets) == 1
171164

172-
@test_util.skip_unless_galaxy("release_19.05")
173165
def test_get_datasets_tool_id_and_tag(self):
174166
cat1_datasets = self.gi.datasets.get_datasets(history_id=self.history_id, tool_id="cat1")
175167
assert cat1_datasets == []
@@ -189,7 +181,6 @@ def test_wait_for_dataset(self):
189181

190182
self.gi.histories.delete_history(history_id, purge=True)
191183

192-
@test_util.skip_unless_galaxy("release_19.05")
193184
def test_dataset_permissions(self):
194185
admin_user_id = self.gi.users.get_current_user()["id"]
195186
username = test_util.random_string()

bioblend/_tests/TestGalaxyHistories.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ def test_get_histories(self):
7070
all_histories = self.gi.histories.get_histories()
7171
assert len(all_histories) > 0
7272

73+
# Test limit and offset
74+
first = self.gi.histories.get_histories(limit=1)
75+
others = self.gi.histories.get_histories(offset=1)
76+
assert len(first) == 1
77+
assert [h["id"] for h in all_histories] == [h["id"] for h in first] + [h["id"] for h in others]
78+
79+
out_of_limit = self.gi.histories.get_histories(offset=1000000)
80+
assert out_of_limit == []
81+
7382
# Check whether id is present, when searched by name
7483
histories = self.gi.histories.get_histories(name=self.default_history_name)
7584
assert len([h for h in histories if h["id"] == self.history["id"]]) == 1
@@ -91,7 +100,7 @@ def test_get_histories(self):
91100

92101
# Test keys: check that fields requested are returned
93102
histories_with_keys = self.gi.histories.get_histories(keys=["id", "user_id", "size"])
94-
assert {key for key in histories_with_keys[0]} >= {"id", "user_id", "size"}
103+
assert set(histories_with_keys[0]) >= {"id", "user_id", "size"}
95104

96105
# TODO: check whether deleted history is returned correctly
97106
# At the moment, get_histories() returns only not-deleted histories
@@ -194,7 +203,7 @@ def test_delete_dataset(self):
194203
def test_purge_dataset(self):
195204
history_id = self.history["id"]
196205
dataset1_id = self._test_dataset(history_id)
197-
self.gi.histories.delete_dataset(history_id, dataset1_id, purge=True)
206+
self.gi.histories.delete_dataset(history_id, dataset1_id, purge=True, wait=True)
198207
dataset = self.gi.histories.show_dataset(history_id, dataset1_id)
199208
assert dataset["deleted"]
200209
assert dataset["purged"]

bioblend/_tests/TestGalaxyJobs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def test_rerun_and_remap(self):
144144
assert last_dataset["id"] == history_contents[2]["id"]
145145
self._wait_and_verify_dataset(last_dataset["id"], b"line 1\tline 1\n")
146146

147-
@test_util.skip_unless_galaxy("release_19.05")
148147
@test_util.skip_unless_tool("random_lines1")
149148
def test_get_common_problems(self):
150149
job_id = self._run_tool()["jobs"][0]["id"]

bioblend/_tests/TestGalaxyObjects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ def test_dataset_delete(self):
966966
assert not self.ds.purged
967967

968968
def test_dataset_purge(self):
969-
self.ds.delete(purge=True)
969+
self.ds.delete(purge=True, wait=True)
970970
assert self.ds.deleted
971971
assert self.ds.purged
972972

bioblend/_tests/TestGalaxyTools.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def test_run_cat1(self):
125125
# TODO: Wait for results and verify it has 3 lines - 1 2 3, 4 5 6,
126126
# and 7 8 9.
127127

128-
@test_util.skip_unless_galaxy("release_19.05")
129128
@test_util.skip_unless_tool("CONVERTER_fasta_to_bowtie_color_index")
130129
def test_tool_dependency_install(self):
131130
installed_dependencies = self.gi.tools.install_dependencies("CONVERTER_fasta_to_bowtie_color_index")

0 commit comments

Comments
 (0)