Skip to content

Commit b054efa

Browse files
Merge pull request #245 from jeromekelleher/fix-dexplode-part-bug
Fix syncronous commands bug
2 parents 6e87b27 + d7dba1f commit b054efa

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@ jobs:
4848
- name: Run basic vcf2zarr example
4949
run: |
5050
python -m bio2zarr vcf2zarr convert tests/data/vcf/sample.vcf.gz sample.vcz -f
51+
- name: Run two-pass vcf2zarr example
52+
run: |
53+
python -m bio2zarr vcf2zarr explode tests/data/vcf/sample.vcf.gz sample.icf -f
54+
python -m bio2zarr vcf2zarr encode sample.icf sample.vcz -f
55+
- name: Run distributed explode example
56+
run: |
57+
python -m bio2zarr vcf2zarr dexplode-init tests/data/vcf/sample.vcf.gz sample.icf 3 -f
58+
python -m bio2zarr vcf2zarr dexplode-partition sample.icf 0
59+
python -m bio2zarr vcf2zarr dexplode-partition sample.icf 1
60+
python -m bio2zarr vcf2zarr dexplode-partition sample.icf 2
61+
python -m bio2zarr vcf2zarr dexplode-finalise sample.icf
62+
- name: Run distributed encode example
63+
run: |
64+
python -m bio2zarr vcf2zarr dencode-init sample.icf sample.vcz 3 -f --variants-chunk-size=3
65+
python -m bio2zarr vcf2zarr dencode-partition sample.vcz 0
66+
python -m bio2zarr vcf2zarr dencode-partition sample.vcz 1
67+
python -m bio2zarr vcf2zarr dencode-partition sample.vcz 2
68+
python -m bio2zarr vcf2zarr dencode-finalise sample.vcz
5169
- name: Run tests
5270
run: |
5371
pytest --cov=bio2zarr

bio2zarr/core.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@
2222

2323
numcodecs.blosc.use_threads = False
2424

25-
# By default Tqdm creates a multiprocessing Lock to synchronise across processes,
26-
# which seems to cause some problems with leaked semaphores on certain combinations
27-
# of Mac and Python versions. We only access tqdm from the main process though,
28-
# so we don't need it and can override with a simpler threading Lock.
29-
# NOTE: this gets set multiple times to different locks as subprocesses are
30-
# spawned, but it doesn't matter because the only tqdm instance that is
31-
# used is the one in the main process.
32-
tqdm.tqdm.set_lock(threading.RLock())
33-
3425

3526
def display_number(x):
3627
ret = "n/a"
@@ -207,8 +198,11 @@ class ProgressConfig:
207198

208199

209200
def update_progress(inc):
210-
with _progress_counter.get_lock():
211-
_progress_counter.value += inc
201+
# If the _progress_counter has not been set we are working in a
202+
# synchronous non-progress tracking context
203+
if _progress_counter is not None:
204+
with _progress_counter.get_lock():
205+
_progress_counter.value += inc
212206

213207

214208
def get_progress():

0 commit comments

Comments
 (0)