Skip to content

Commit

Permalink
Merge pull request #13 from BrainLesion/12-bug-infer_batch-fails-if-o…
Browse files Browse the repository at this point in the history
…utput-folder-does-not-exist

12 bug infer batch fails if output folder does not exist
  • Loading branch information
MarcelRosier authored Jul 23, 2024
2 parents d8fdee9 + 7a9c141 commit 6f0006f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion brats/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,13 @@ def infer_batch(

data_folder = Path(data_folder)
output_folder = Path(output_folder)
output_folder.mkdir(parents=True, exist_ok=True)

temp_data_folder = Path(tempfile.mkdtemp())
temp_output_folder = Path(tempfile.mkdtemp())
if log_file:
inference_log_file = logger.add(log_file, level="INFO", catch=True)
logger.info(f"Logging to: {log_file.absolute()}")
logger.info(f"Logging to: {Path(log_file).absolute()}")
try:
self._log_algorithm_info()
# find subjects
Expand Down
6 changes: 4 additions & 2 deletions brats/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,21 @@ def run_docker(
additional_files_path=additional_files_path,
output_path=output_path,
)

logger.info(f"{'Starting inference'}")
logger.debug(f"Volume mappings: {volume_mappings}")

command_args, extra_args = _build_args(
algorithm=algorithm, additional_files_path=additional_files_path
)
logger.debug(f"Command args: {command_args}, Extra args: {extra_args}")

# device setup
device_requests = _handle_device_requests(
algorithm=algorithm, cuda_devices=cuda_devices, force_cpu=force_cpu
)
logger.debug(f"Device requests: {device_requests}")

# Run the container
logger.info(f"{'Starting inference'}")
container = client.containers.run(
image=algorithm.run_args.docker_image,
volumes=volume_mappings,
Expand Down

0 comments on commit 6f0006f

Please sign in to comment.