From f9e1d3837cfd710de2329b0df3105093ae35e955 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Tue, 17 Dec 2024 21:23:25 +0000 Subject: [PATCH] Fix bug in samples processed output --- sc2ts/cli.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/sc2ts/cli.py b/sc2ts/cli.py index 36bfdb1..d00dab1 100644 --- a/sc2ts/cli.py +++ b/sc2ts/cli.py @@ -301,12 +301,14 @@ def _run_extend(out_path, verbose, log_file, **params): resource_usage = summarise_usage(ts) logger.info(resource_usage) print("resources:", resource_usage, file=sys.stderr) - df = pd.DataFrame( - ts.metadata["sc2ts"]["daily_stats"][date]["samples_processed"] - ).set_index("scorpio") - del df["total_hmm_cost"] - df = df[list(df.columns)[::-1]].sort_values("total") - print(df, file=sys.stderr) + data = ts.metadata["sc2ts"]["daily_stats"][date]["samples_processed"] + if len(data) > 0: + df = pd.DataFrame( + ts.metadata["sc2ts"]["daily_stats"][date]["samples_processed"] + ).set_index("scorpio") + del df["total_hmm_cost"] + df = df[list(df.columns)[::-1]].sort_values("total") + print(df, file=sys.stderr) @click.command() @@ -401,12 +403,16 @@ def infer(config_file, start, stop, force): params.update(override_set["parameters"]) base_ts = ts_file_pattern.format(date=date) - with cf.ProcessPoolExecutor(1) as executor: - future = executor.submit( - _run_extend, base_ts, log_level, log_file, **params - ) - # Block and wait, raising exception if it occured - future.result() + if True: + _run_extend(base_ts, log_level, log_file, **params) + + else: + with cf.ProcessPoolExecutor(1) as executor: + future = executor.submit( + _run_extend, base_ts, log_level, log_file, **params + ) + # Block and wait, raising exception if it occured + future.result() @click.command()