Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better logging in the indicator runner #1892

Merged
merged 10 commits into from
Aug 29, 2023
Merged

Conversation

rzats
Copy link
Contributor

@rzats rzats commented Aug 16, 2023

Description

Adds more detail to the logging of the indicator runner, as specified in #1890.

Changelog

  • Adds timing logging around various steps of the indicator runner.
  • For validation errors & warnings caused by specific thresholds not being met, specify the thresholds' values.

Fixes

@@ -67,6 +67,7 @@ def run_indicator_pipeline(indicator_fn: Callable[[Params], None],
validator = validator_fn(params)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The archiver already logs run timing, and each indicator has its own bit of logging which includes that; this adds logging for the flash & validation steps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the individual indicators' run time logging looks mostly sufficient, except in quidel_covidtest where it happens at program exit, which will include anything that runs after the core indicator function and thus lead to inaccuracy.

you can refactor this so the runner does the timing and logging, with indicator_fn (aka each indicator's run_module()) returning a dict of metrics it wants logged (like csv_export_count and max_lag_in_days)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I can actually think of one disadvantage of that - it means that the summary line will be gone from the logs if the indicator is ran individually (e.g. env/bin/python -m delphi_quidel_covidtest as the README suggests).
Are we OK with this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a lot of the documentation in this repo is is quite old and should be brought up to date.

is it ever desirable to run an indicator without validation and archiving? perhaps we can answer that in #1895. you should at least fix the timing for the quidel indicator in the meanwhile.

@rzats rzats requested a review from melange396 August 16, 2023 18:13
Copy link
Contributor

@melange396 melange396 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i havent looked at all of the individual validator messages yet, but i will in the next round. can you also get timing for that other method mentioned in #1890 ?

_delphi_utils_python/delphi_utils/validator/report.py Outdated Show resolved Hide resolved
@@ -67,6 +67,7 @@ def run_indicator_pipeline(indicator_fn: Callable[[Params], None],
validator = validator_fn(params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the individual indicators' run time logging looks mostly sufficient, except in quidel_covidtest where it happens at program exit, which will include anything that runs after the core indicator function and thus lead to inaccuracy.

you can refactor this so the runner does the timing and logging, with indicator_fn (aka each indicator's run_module()) returning a dict of metrics it wants logged (like csv_export_count and max_lag_in_days)

_delphi_utils_python/delphi_utils/runner.py Outdated Show resolved Hide resolved
_delphi_utils_python/delphi_utils/runner.py Outdated Show resolved Hide resolved
@rzats rzats requested a review from melange396 August 21, 2023 13:48
@rzats
Copy link
Contributor Author

rzats commented Aug 21, 2023

@melange396 updated, rerequesting review!

Comment on lines +228 to +230
# Log stats now instead of at program exit
atexit.unregister(log_exit)
log_exit(start_time, stats, logger)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

_delphi_utils_python/delphi_utils/runner.py Outdated Show resolved Hide resolved
_delphi_utils_python/delphi_utils/runner.py Outdated Show resolved Hide resolved
quidel_covidtest/delphi_quidel_covidtest/pull.py Outdated Show resolved Hide resolved
@@ -281,29 +281,35 @@ def check_bad_val(self, df_to_test, nameformat, signal_type, report):

if percent_option:
if not df_to_test[(df_to_test['val'] > 100)].empty:
bad_values = df_to_test[(df_to_test['val'] > 100)]['val'].unique()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice touch with the .unique() filter! should we do that for all the messages that print lists of values?

_delphi_utils_python/delphi_utils/validator/static.py Outdated Show resolved Hide resolved
_delphi_utils_python/delphi_utils/validator/static.py Outdated Show resolved Hide resolved
@rzats rzats requested a review from melange396 August 25, 2023 19:35
@rzats rzats requested a review from melange396 August 29, 2023 14:03
Copy link
Contributor

@melange396 melange396 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good stuff!

@melange396 melange396 merged commit a148dcb into main Aug 29, 2023
15 checks passed
@melange396 melange396 deleted the rzatserkovnyi/extra-logging branch August 29, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add better logging in the indicator runner
2 participants