From a1a624db06f7bdcdbbb25c7cb93c730f74be5177 Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Tue, 31 Oct 2023 11:32:38 +0100 Subject: [PATCH] Enhance time counting at data fetching --- web/run.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/web/run.py b/web/run.py index 20e1417..61a5167 100755 --- a/web/run.py +++ b/web/run.py @@ -903,9 +903,9 @@ def generate_csv_contents(target_slug, input_slug, started_at, stopped_at): def generate_csv_contents_spz(target_slug, input_slug, started_at, stopped_at): - now = datetime.datetime.now() + global_now = datetime.datetime.now() hp_logger.debug( - f"Generating csv content with Speasy for {target_slug}/{input_slug} between {stopped_at} {stopped_at}") + f"Generating csv content with Speasy for {target_slug}/{input_slug} between {started_at} {stopped_at}") target_config = get_target_config(target_slug) plasma_params = {} for plasma_struct in target_config['models'][input_slug]: @@ -918,11 +918,15 @@ def generate_csv_contents_spz(target_slug, input_slug, started_at, stopped_at): hp_logger.info(f"Aggregating dataframes speazy parameters for '{input_slug}' to '{target_slug}'") list_df = [] for _name, _id in parameters_dict.items(): - hp_logger.debug(f"Getting parameter id '{_id}' for '{_name}'") + hp_logger.debug(f"Getting parameter id '{_id}' for '{_name}' ...") + param_now = datetime.datetime.now() amda_dataset = amda.get_data(_id, started_at, stopped_at) if amda_dataset is None: + hp_logger.debug(f" ... No data") continue _df = amda_dataset.to_dataframe() + param_then = datetime.datetime.now() + hp_logger.debug(f" ... Got {len(_df)} in {param_then - param_now}") if _name == 'xy_v': _df = _df.rename(columns={_df.columns[0]: 'vrad', _df.columns[1]: 'vtan'}) elif _name == 'xy_hee': @@ -961,8 +965,8 @@ def generate_csv_contents_spz(target_slug, input_slug, started_at, stopped_at): final_df = final_df[cols_ordered] final_df.index.name = 'time' - then = datetime.datetime.now() - hp_logger.debug(f"Took {then - now} to generate") + global_then = datetime.datetime.now() + hp_logger.debug(f"Took {global_then - global_now} to generate") return final_df.to_csv(date_format='%Y-%m-%dT%H:%M:%S+00:00', float_format="%.5f", header=True, -- libgit2 0.21.2