8000 Fixes in supplement update script (start/stop, input/output, docs) by javierggt · Pull Request #54 · sot/agasc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixes in supplement update script (start/stop, input/output, docs) #54

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

Merged
merged 12 commits into from
Nov 30, 2020

Conversation

javierggt
Copy link
Contributor
@javierggt javierggt commented Nov 17, 2020

Description

This PR introduces a few changes, one of which is a bug fix:

  • bug fix: MagStatsReport was renamed MagEstimateReport when moving the project to agasc. Fix one script that was not changed accordingly.
  • Added --output-dir, --input-dir, and --reports-dir arguments to the mag-stats scripts.This includes some sensible defaults for weekly runs. Replaced uses of os.path by pathlib.
  • Restructured the start/stop arguments so the default matches the weekly run.
  • Slightly improved the documentation of the scripts used to update the magnitude supplement.

Testing

  • Passes unit tests on MacOS, linux, Windows (at least one required)
  • Functional testing. Ran with several start/stop options (including empty intervals) and output directory options to update supplement and produce reports.

Fixes #

@taldcroft
Copy link
Member

by default, the script updates the supplement in $SKA/data/agasc

In new code I always make the default be "safe" for any output files that get written. I.e. if you just run the script without arguments then nothing can go wrong with the flight files. How you do that depends a bit on the app, but the upshot is that the output "flight" values need to go into task_schedule.cfg. You can look at acdc for examples, which mostly have . as a default data root directory.

@javierggt
Copy link
Contributor Author

yes, that makes sense. I will do that instead (default .)

@@ -19,7 +20,9 @@ def parser():
' CxoTime-compatible time stamp.')
parse.add_argument('--stop', help='Time to stop processing new observations.'
' CxoTime-compatible time stamp.')
parse.add_argument('--out-dir', default=f'./mag_stats_report',
parse.add_argument('--input-dir', default='$SKA/data/agasc',
help='Directory containing mag-stats files')
Copy link
Member

Choose a reason for hiding this comment

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

It's generally good to include the default values in the help string. (It seems like argparse should be able to do that automatically, but I don't recall this functionality).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I will do that. For some reason, argparse does not do it. The sphinx-argparse module does, so it shows in web docs, but not in the command-line help.

parse.add_argument('--out-dir', default=f'./mag_stats_report',
parse.add_argument('--input-dir', default='$SKA/data/agasc',
help='Directory containing mag-stats files')
parse.add_argument('--output-dir', default=f'$SKA/www/agasc_supplement_reports/suspect',
Copy link
Member

Choose a reason for hiding this comment

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

This path seems weird. I would expect more like $SKA/www/ASPECT/agasc/agasc_supplement_reports/suspect, or something like that.

Also (though this not set in stone), I would usually define a configurable root directory like $SKA/www/agasc and then have the rest agasc_supplement_reports/suspect hardcoded. I.e. only define root directories, not detail directories down lower.

@taldcroft
Copy link
Member

@javierggt - it looks like you agreed to the point about not writing into flight dirs by default but the code still does that.

About the output directory, we need to be a little careful about the actual disk that files are being written to. The "originals" should stay on /proj/sot, whereas /proj/sot/ska/www/ASPECT is actually /data/mta4/www/ASPECT (not controlled by us). My first instinct is to write the reports as a sub-directory of /proj/sot/ska/data/agasc so they are more easily discoverable (by me at least) and we can deal with disk space issues if they arise.

@jeanconn did the same for the dark cals, and demonstrated that a soft link from the /data/mta4 filesystem back to /proj/sot seems to work for the web server (e.g. https://cxc.cfa.harvard.edu/mta/ASPECT/acdc/).

@jeanconn
Copy link
Contributor

Regarding being "safe" in where outputs go in new code... I've been somewhat casual in my new code if the code is just reporting/trending and doing nothing that is really operational. For this code that will have an operational component, I agree with the plan of having it not write into flight areas by default.

@javierggt
Copy link
Contributor Author

I made the change so reports are not saved in /proj/sot/ska/www/ASPECT

' Default: now')
parse.add_argument('--input-dir', default='$SKA/data/agasc',
help='Directory containing mag-stats files. Default: $SKA/data/agasc')
parse.add_argument('--output-dir', default='$SKA/www/ASPECT/agasc/supplement_reports/suspect',
Copy link
Member

Choose a reason for hiding this comment

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

Still outputting to a flight directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops! It looks like I am actively trying to pass it under the rug...

Fixed it.

@javierggt javierggt changed the title Update script fixes Fixes in supplement update script (start/stop, input/output, docs) Nov 30, 2020
@javierggt javierggt merged commit 8221527 into master Nov 30, 2020
@javierggt javierggt mentioned this pull request Dec 7, 2020
@javierggt javierggt mentioned this pull request Mar 2, 2021
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.

3 participants
0