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

Added image add mode run restore command #463

Merged
merged 11 commits into from
Jan 19, 2021
Merged

Conversation

ajstewart
Copy link
Contributor

@ajstewart ajstewart commented Jan 15, 2021

#443 should be merged first.

Adds a new CLI option to restore a pipeline run that has been run through add mode to the previous version as saved in the .bak files from add mode.

I thought this at least gives an admin power to 'undo' a pipeline run that someone might have added the wrong image or if something goes wrong during add mode the job can be saved and restored without much trouble. It waits for user confirmation before proceeding with a restore.

For now I decided this option shouldn't be available through the UI, only admins via CLI, but this could be added in the future.

Fixes #435.

Example:

./manage.py restorepiperun -v 3 new-test-data                                            ✔  7s  vast-pipeline-dev   00:53:14
2021-01-15 13:54:23,263 restorepiperun INFO Will restore the run to the following config:
PIPE_RUN_PATH...................................../Users/adam/GitHub/vast-pipeline/pipeline-runs/new-test-data
IMAGE_FILES.......................................['/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_0127-73A.EPOCH01.I.cutout.fits', '/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_2118+00A.EPOCH01.I.cutout.fits', '/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_2118-06A.EPOCH01.I.cutout.fits', '/Users/adam/askap/pipeline-test-data/EPOCH03x/VAST_2118-06A.EPOCH03x.I.cutout.fits', '/Users/adam/askap/pipeline-test-data/EPOCH03x/VAST_2118+00A.EPOCH03x.I.cutout.fits', '/Users/adam/askap/pipeline-test-data/EPOCH02/VAST_2118-06A.EPOCH02.I.cutout.fits', '/Users/adam/askap/pipeline-test-data/EPOCH02/VAST_2118+00A.EPOCH02.I.cutout.fits']
SELAVY_FILES......................................['/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_0127-73A.EPOCH01.I.cutout.components.txt', '/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_2118+00A.EPOCH01.I.cutout.components.txt', '/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_2118-06A.EPOCH01.I.cutout.components.txt', '/Users/adam/askap/pipeline-test-data/EPOCH03x/VAST_2118-06A.EPOCH03x.I.cutout.components.txt', '/Users/adam/askap/pipeline-test-data/EPOCH03x/VAST_2118+00A.EPOCH03x.I.cutout.components.txt', '/Users/adam/askap/pipeline-test-data/EPOCH02/VAST_2118-06A.EPOCH02.I.cutout.components.txt', '/Users/adam/askap/pipeline-test-data/EPOCH02/VAST_2118+00A.EPOCH02.I.cutout.components.txt']
BACKGROUND_FILES..................................['/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_0127-73A.EPOCH01.I.cutout_bkg.fits', '/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_2118+00A.EPOCH01.I.cutout_bkg.fits', '/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_2118-06A.EPOCH01.I.cutout_bkg.fits', '/Users/adam/askap/pipeline-test-data/EPOCH03x/VAST_2118-06A.EPOCH03x.I.cutout_bkg.fits', '/Users/adam/askap/pipeline-test-data/EPOCH03x/VAST_2118+00A.EPOCH03x.I.cutout_bkg.fits', '/Users/adam/askap/pipeline-test-data/EPOCH02/VAST_2118-06A.EPOCH02.I.cutout_bkg.fits', '/Users/adam/askap/pipeline-test-data/EPOCH02/VAST_2118+00A.EPOCH02.I.cutout_bkg.fits']
NOISE_FILES.......................................['/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_0127-73A.EPOCH01.I.cutout_rms.fits', '/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_2118+00A.EPOCH01.I.cutout_rms.fits', '/Users/adam/askap/pipeline-test-data/EPOCH01/VAST_2118-06A.EPOCH01.I.cutout_rms.fits', '/Users/adam/askap/pipeline-test-data/EPOCH03x/VAST_2118-06A.EPOCH03x.I.cutout_rms.fits', '/Users/adam/askap/pipeline-test-data/EPOCH03x/VAST_2118+00A.EPOCH03x.I.cutout_rms.fits', '/Users/adam/askap/pipeline-test-data/EPOCH02/VAST_2118-06A.EPOCH02.I.cutout_rms.fits', '/Users/adam/askap/pipeline-test-data/EPOCH02/VAST_2118+00A.EPOCH02.I.cutout_rms.fits']
SOURCE_FINDER.....................................selavy
MONITOR...........................................True
MONITOR_MIN_SIGMA.................................3.0
MONITOR_EDGE_BUFFER_SCALE.........................1.2
MONITOR_CLUSTER_THRESHOLD.........................3.0
MONITOR_ALLOW_NAN.................................False
ASTROMETRIC_UNCERTAINTY_RA........................1
ASTROMETRIC_UNCERTAINTY_DEC.......................1
ASSOCIATION_PARALLEL..............................True
ASSOCIATION_EPOCH_DUPLICATE_RADIUS................2.5
ASSOCIATION_METHOD................................basic
ASSOCIATION_RADIUS................................15.0
ASSOCIATION_DE_RUITER_RADIUS......................5.68
ASSOCIATION_BEAMWIDTH_LIMIT.......................1.5
NEW_SOURCE_MIN_SIGMA..............................5.0
DEFAULT_SURVEY....................................None
FLUX_PERC_ERROR...................................0
USE_CONDON_ERRORS.................................True
SELAVY_LOCAL_RMS_ZERO_FILL_VALUE..................0.2
CREATE_MEASUREMENTS_ARROW_FILES...................False
SUPPRESS_ASTROPY_WARNINGS.........................True
SOURCE_AGGREGATE_PAIR_METRICS_MIN_ABS_VS..........4.3
Would you like to restore the run ? (y/n): y
2021-01-15 13:54:26,246 restorepiperun INFO Restoring 'new-test-data' from backup parquet files.
2021-01-15 13:54:26,792 restorepiperun INFO Deleting new sources and associated objects to restore run Total objects deleted: 2475
2021-01-15 13:54:26,793 restorepiperun DEBUG (type, #deleted): {'vast_pipeline.RelatedSource': 15, 'vast_pipeline.Association': 553, 'vast_pipeline.MeasurementPair': 1809, 'vast_pipeline.Source': 98}
2021-01-15 13:54:27,090 restorepiperun INFO Deleting forced measurement and associated objects to restore run. Total objects deleted: 3769
2021-01-15 13:54:27,091 restorepiperun DEBUG (type, #deleted): {'vast_pipeline.Association': 453, 'vast_pipeline.MeasurementPair': 2459, 'vast_pipeline.Measurement': 857}
2021-01-15 13:54:27,275 restorepiperun INFO Deleting associations to restore run. Total objects deleted: 1127
2021-01-15 13:54:27,275 restorepiperun DEBUG (type, #deleted): {'vast_pipeline.Association': 1127}
2021-01-15 13:54:27,537 restorepiperun INFO Deleting measurement pairs to restore run. Total objects deleted: 5233
2021-01-15 13:54:27,537 restorepiperun DEBUG (type, #deleted): {'vast_pipeline.MeasurementPair': 5233}
2021-01-15 13:54:27,553 restorepiperun INFO Restore complete.

@ajstewart ajstewart added the enhancement New feature or request label Jan 15, 2021
@ajstewart ajstewart self-assigned this Jan 15, 2021
@github-actions github-actions bot added this to In progress in Pipeline Backlog Jan 15, 2021
@ajstewart
Copy link
Contributor Author

@srggrs see what you think of this. I wasn't sure if the functions should be placed somewhere else. See the original PR comment for details on how it works.

@ajstewart ajstewart requested a review from srggrs January 17, 2021 23:15
@ajstewart ajstewart marked this pull request as ready for review January 17, 2021 23:31
@ajstewart ajstewart linked an issue Jan 17, 2021 that may be closed by this pull request
Base automatically changed from iss212 to master January 18, 2021 02:46
Copy link
Contributor

@srggrs srggrs left a comment

Choose a reason for hiding this comment

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

Minor changes otherwise LGTM

vast_pipeline/models.py Show resolved Hide resolved
vast_pipeline/management/commands/restorepiperun.py Outdated Show resolved Hide resolved
vast_pipeline/management/commands/restorepiperun.py Outdated Show resolved Hide resolved
Co-authored-by: Serg <34258464+srggrs@users.noreply.github.com>
@ajstewart
Copy link
Contributor Author

Thanks, I've applied those changes. I will document this feature once #433 is in.

@ajstewart ajstewart requested a review from srggrs January 19, 2021 03:36
Copy link
Contributor

@srggrs srggrs left a comment

Choose a reason for hiding this comment

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

all good

Pipeline Backlog automation moved this from In progress to Reviewer approved Jan 19, 2021
@ajstewart ajstewart merged commit 2ab8476 into master Jan 19, 2021
Pipeline Backlog automation moved this from Reviewer approved to Done Jan 19, 2021
@ajstewart ajstewart deleted the issue-435-restore-run branch January 19, 2021 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

Add restore job to previous version option
2 participants