Skip to content

Commit

Permalink
Merge branch 'refs/heads/devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
sunset666 committed Nov 20, 2024
2 parents 7f5d6f7 + 5f18f8d commit f4fb707
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
32 changes: 20 additions & 12 deletions src/ingest_validation_tests/ome_tiff_field_validator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import json
import re
from functools import partial
from multiprocessing import Pool

# from functools import partial
# from multiprocessing import Pool
from os import cpu_count
from pathlib import Path
from typing import List, Optional
Expand Down Expand Up @@ -113,7 +114,7 @@ def collect_errors(self, **kwargs) -> List[Optional[str]]:
all_tests.update(test_set["fields"])

threads = kwargs.get("coreuse", None) or cpu_count() // 4 or 1
pool = Pool(threads)
# pool = Pool(threads)
_log(f"Threading at OmeTiffFieldValidator with {threads}")
filenames_to_test = []
for glob_expr in [
Expand All @@ -126,16 +127,23 @@ def collect_errors(self, **kwargs) -> List[Optional[str]]:
for file in path.glob(glob_expr):
filenames_to_test.append(file)

rslt_list: List[Optional[str]] = list(
rslt
for rslt in pool.imap_unordered(
partial(_check_ome_tiff_file, tests=all_tests), filenames_to_test
# TODO: turn back on when issues with XML parsing are resolved
# still collecting files so we know if this plugin *should* have run

# rslt_list: List[Optional[str]] = list(
# rslt
# for rslt in pool.imap_unordered(
# partial(_check_ome_tiff_file, tests=all_tests), filenames_to_test
# )
# if rslt is not None
# )
# if rslt_list:
# return rslt_list
# elif filenames_to_test:
if filenames_to_test:
_log(
f"Found files to test but skipping ome-tiff field validation. Files: {filenames_to_test}"
)
if rslt is not None
)
if rslt_list:
return rslt_list
elif filenames_to_test:
return [None]
else:
return []
18 changes: 9 additions & 9 deletions tests/test_ome_tiff_field_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
@pytest.mark.parametrize(
("test_data_fname", "msg_re_list", "assay_type"),
(
(
"test_data/codex_tree_ometiff_bad.zip",
[
".*tubhiswt_C0_bad.ome.tif is not a valid OME.TIFF file.*",
".*sample1.ome.tif is not a valid OME.TIFF file.*",
".*sample2.ome.tif is not a valid OME.TIFF file.*",
],
"CODEX",
),
# (
# "test_data/codex_tree_ometiff_bad.zip",
# [
# ".*tubhiswt_C0_bad.ome.tif is not a valid OME.TIFF file.*",
# ".*sample1.ome.tif is not a valid OME.TIFF file.*",
# ".*sample2.ome.tif is not a valid OME.TIFF file.*",
# ],
# "CODEX",
# ),
("test_data/codex_tree_ometiff_good.zip", [], "CODEX"),
("test_data/fake_snrnaseq_tree_good.zip", [], "snRNAseq"),
),
Expand Down

0 comments on commit f4fb707

Please sign in to comment.