Skip to content

Commit

Permalink
Merge pull request #61 from hubmapconsortium/sunset666/logging_thread…
Browse files Browse the repository at this point in the history
…count

Adding logging to plugins for thread counting
  • Loading branch information
gesinaphillips authored Jul 29, 2024
2 parents 2691964 + ef5f096 commit 3973b97
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ingest_validation_tests/fastq_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class FASTQValidator(Validator):

def collect_errors(self, **kwargs) -> List[Optional[str]]:
threads = kwargs.get("coreuse", None) or cpu_count() // 4 or 1
_log(f"Threading at {threads}")
_log(f"Threading at FastQValidator with {threads}")
validator = FASTQValidatorLogic(verbose=True)
validator.validate_fastq_files_in_path(self.paths, threads)
if validator.errors:
Expand Down
2 changes: 1 addition & 1 deletion src/ingest_validation_tests/gz_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GZValidator(Validator):
def collect_errors(self, **kwargs) -> List[Optional[str]]:
data_output2 = []
threads = kwargs.get("coreuse", None) or cpu_count() // 4 or 1
_log(f"Threading at {threads}")
_log(f"Threading at GZValidator with {threads}")
file_list = []
for path in self.paths:
for glob_expr in ["**/*.gz"]:
Expand Down
5 changes: 5 additions & 0 deletions src/ingest_validation_tests/ome_tiff_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
from ingest_validation_tools.plugin_validator import Validator


def _log(message: str):
print(message)


def _check_ome_tiff_file(file: str) -> Optional[str]:
try:
with tifffile.TiffFile(file) as tf:
Expand All @@ -25,6 +29,7 @@ class OmeTiffValidator(Validator):
def collect_errors(self, **kwargs) -> List[Optional[str]]:
threads = kwargs.get("coreuse", None) or cpu_count() // 4 or 1
pool = Pool(threads)
_log(f"Threading at OmeTiffValidator with {threads}")
filenames_to_test = []
for glob_expr in [
"**/*.ome.tif",
Expand Down
1 change: 1 addition & 0 deletions src/ingest_validation_tests/tiff_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TiffValidator(Validator):

def collect_errors(self, **kwargs) -> List[Optional[str]]:
threads = kwargs.get("coreuse", None) or cpu_count() // 4 or 1
_log(f"Threading at TiffValidator with {threads}")
pool = Pool(threads)
filenames_to_test = []
for glob_expr in ["**/*.tif", "**/*.tiff", "**/*.TIFF", "**/*.TIF"]:
Expand Down

0 comments on commit 3973b97

Please sign in to comment.