Skip to content

Commit

Permalink
Merge pull request #982 from JGreenlee/async-metrics-generation
Browse files Browse the repository at this point in the history
wrap call to `generate_summaries` in `asyncio.run()`
  • Loading branch information
shankari authored Sep 20, 2024
2 parents 53f1072 + 0833f46 commit 52adee2
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 52adee2

Please sign in to comment.