Skip to content

Commit 6d64df2

Browse files
authored
Merge pull request #721 from DiamondLightSource/broadcast-output-dir
Broadcast autogenerated timestamp output dir name
2 parents 1b45736 + 72a27d6 commit 6d64df2

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

‎httomo/cli.py‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,20 @@ def run(
255255
max_cpu_slices,
256256
syslog_host,
257257
syslog_port,
258-
output_folder_name,
258+
(
259+
output_folder_name
260+
if output_folder_name is not None
261+
else Path(f"{datetime.now().strftime('%d-%m-%Y_%H_%M_%S')}_output")
262+
),
259263
recon_filename_stem,
260264
continuous_scan_subset,
261265
)
262266

263-
does_contain_sweep = is_sweep_pipeline(pipeline)
264267
global_comm = MPI.COMM_WORLD
268+
if output_folder_name is None:
269+
httomo.globals.run_out_dir = global_comm.bcast(httomo.globals.run_out_dir, 0)
270+
271+
does_contain_sweep = is_sweep_pipeline(pipeline)
265272
method_wrapper_comm = global_comm if not does_contain_sweep else MPI.COMM_SELF
266273

267274
if global_comm.rank == 0:
@@ -352,7 +359,7 @@ def set_global_constants(
352359
max_cpu_slices: int,
353360
syslog_host: str,
354361
syslog_port: int,
355-
output_folder_name: Optional[Path],
362+
output_folder_name: Path,
356363
recon_filename_stem: Optional[str],
357364
continuous_scan_subset: Optional[tuple[int, int]],
358365
) -> None:
@@ -367,13 +374,7 @@ def set_global_constants(
367374
httomo.globals.SYSLOG_PORT = syslog_port
368375
httomo.globals.RECON_FILENAME_STEM = recon_filename_stem
369376
httomo.globals.CONTINUOUS_SCAN_SUBSET = continuous_scan_subset
370-
371-
if output_folder_name is None:
372-
httomo.globals.run_out_dir = out_dir.joinpath(
373-
f"{datetime.now().strftime('%d-%m-%Y_%H_%M_%S')}_output"
374-
)
375-
else:
376-
httomo.globals.run_out_dir = out_dir.joinpath(output_folder_name)
377+
httomo.globals.run_out_dir = out_dir.joinpath(output_folder_name)
377378

378379
if max_cpu_slices < 1:
379380
raise ValueError("max-cpu-slices must be greater or equal to 1")

0 commit comments

Comments
 (0)