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

implement update_overall_statistics() and refactor create_system #483

Merged
merged 1 commit into from
Nov 4, 2022

Conversation

lyuyangh
Copy link
Member

@lyuyangh lyuyangh commented Nov 2, 2022

part of #433
The goal of this PR is to refactor the DB operations used by create_systems(). The operations are split into three methods:

def db_operations(session: ClientSession) -> None:
      system.save_to_db(session)
      system.save_system_output(system_output_data, session)
      system.update_overall_statistics(metadata, system_output_data, session)

Each method can be run multiple times without causing an issue. They can also be called in any order after the system has been created. This is necessary if we want to treat overall_statistics as cache (previously we were calling it system_info and metric_stats). Following this PR, I will implement a system which calls update_overall_statistics() to update the cache whenever necessary. Note that, update_overall_statistics() doesn't clean up stale resources properly if it is called multiple times. It works for now because it is only called once for each system. This PR is already pretty big so I plan to handle it in the next PR.

@lyuyangh lyuyangh requested a review from neubig as a code owner November 2, 2022 12:14
Copy link
Contributor

@neubig neubig left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

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.

2 participants