Skip to content

Commit

Permalink
wrap call to generate_summaries in asyncio.run()
Browse files Browse the repository at this point in the history
Because the footprint metrics generation is asynchronous, this call needs to be wrapped in asyncio.run()
  • Loading branch information
JGreenlee committed Sep 20, 2024
1 parent 53f1072 commit 0833f46
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion emission/net/api/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from builtins import zip
from builtins import *
import logging
import asyncio

import emission.analysis.result.metrics.time_grouping as earmt
import emission.analysis.result.metrics.simple_metrics as earms
Expand All @@ -28,7 +29,7 @@ def summarize_by_local_date(user_id, start_ld, end_ld, freq_name, metric_list, i
def summarize_by_yyyy_mm_dd(user_id, start_ymd, end_ymd, freq, metric_list, include_agg, app_config):
time_query = estf.FmtTimeQuery("data.start_fmt_time", start_ymd, end_ymd)
trips = esda.get_entries(esda.COMPOSITE_TRIP_KEY, None, time_query)
return emcms.generate_summaries(metric_list, trips, app_config)
return asyncio.run(emcms.generate_summaries(metric_list, trips, app_config))

def _call_group_fn(group_fn, user_id, start_time, end_time, freq, metric_list, include_aggregate):
summary_fn_list = [earms.get_summary_fn(metric_name)
Expand Down

0 comments on commit 0833f46

Please sign in to comment.