-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improve logging to make it easier to re-run with the same configuration #168
Conversation
9e1d5d9
to
7920122
Compare
@@ -112,8 +113,7 @@ def get_parser(): | |||
return parser | |||
|
|||
|
|||
def main(): | |||
|
|||
def get_args(): | |||
logger = logging.getLogger("agasc.supplement") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that a this chunk of "main" is now in get_args, maybe logger
should just be global?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not used anywhere else. I think it is better to not make things global until you have to.
# update 'bad' and 'obs' tables in supplement | ||
agasc_ids += update_supplement.update(args) | ||
# update 'bad' and 'obs' tables in supplement | ||
agasc_ids += update_supplement.update(args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this new indent on purpose? I would think you'd still want to do the update_supplement.update(args) even if you've been given list of agasc_ids in file_args, but maybe I'm missing a logical change here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! good eye. Yes, I changed this on purpose, but I think you might have a point. I twas thinking of the agasc_ids. Also, if one is running with the same arguments, presumably this update to the supplement was already made, although one could be running with a copy of the supplement from the snapshot.
Note that there is another change. This change in indentation goes with the if "agasc_ids" in file_args:
statement, which was not there to begin with, so everything after agasc_ids = []
is getting extra indentation.
This adds a feature that I did not document in the PR description. You can make a call_args.yml
file by hand which includes the agasc_ids
key, with a list of AGASC IDs. Note that there is no --agasc-ids
command line argument, this is a feature of the call_args.yml
file.
The truth is that we have never used the update_supplement part together with the update magnitudes part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change the indentation back. I don't think I have strong opinion on that, and maybe it is best to leave it as it was to make sure the same process is run.
Description
This PR introduces changes that make it easier to run the weekly agasc supplement update script with the same input arguments. This was motivated by #166
The current master version has all of the required features, except that the report date is not captured in the log file. With this PR, the report date is also included in the log.
As a convenience the list of AGASC IDs given to the script is also added to the log (also not kept in the log in the masters version).
Also added a few logging messages.
Interface impacts
Testing
Unit tests
Independent check of unit tests by Jean
Functional tests
Follow these steps to run with the same arguments as last weeks processing: