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

I393 data ingestion commands: add option -F for continue mini file from #426

Closed
wants to merge 25 commits into from

Conversation

damhuonglan
Copy link
Contributor

@damhuonglan damhuonglan commented Aug 7, 2020

What does this PR do?

Issue #393 states that segdtoph5 doesn't continue mini file (miniPH5_xxxxx.ph5) index from option -S first_mini. However, that option is to state the first mini file index of all. In segdtoph5 there is no option to continue mini file index from.

This PR adds option -F from_mini to continue index for mini file from, in which the mini files created will not be greater than 100GB. This option will not be associated with option -M num_mini.

The help in segdtoph5 is modified and added example as following to avoid misleading:


  -M num_mini, --num_mini=num_mini
                        Create a given number of miniPH5 files. Ex: -M 38
  -S first_mini, --first_mini=first_mini
                        The index of the first miniPH5_xxxxx.ph5 file of all.
                        Ex: -S 5
  -F from_mini, --from_mini=from_mini
                        The index to continue miniPH5_xxxxx.ph5 file from. Do
                        not associate with option -M. Ex: -F 25

This option are added to mstoph5, 130toph5, 125toph5, seg2toph5 too.

Checklist

  • This PR is not directly related to an existing issue (which has no PR yet).
  • All tests pass.
  • Any new or changed features have are documented.
  • Changes have been added to CHANGELOG.txt .
  • First time contributors have added your name to CONTRIBUTORS.txt .

Copy link
Contributor

@dsentinel dsentinel left a comment

Choose a reason for hiding this comment

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

This looks reasonable with few small adjustments.

help=("The index to continue miniPH5_xxxxx.ph5 file "
"from. Do not associate with option -M. "
"Ex: -F 25"),
metavar="from_mini", type='int', default=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

metavar isn't necessary for named arguments if setting to the same as the arg name

Comment on lines 246 to 252
# from_mini and num_mini must not coexist
if (NUM_MINI is not None) and (FROM_MINI is not None):
raise Exception('Option -M and option -F must not be '
'used at the same time.')

if ONE_PER_MINI and (FROM_MINI is None):
raise Exception('Option -O must be associated with option -F.')
Copy link
Contributor

Choose a reason for hiding this comment

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

Mutual exclusion can be handled by argparse
https://docs.python.org/3/library/argparse.html#mutual-exclusion

LOGGER.error("FROM_MINI must be greater than %s, "
"the highest mini file in ph5." % highestMini)
EX.ph5close()
return 1
Copy link
Contributor

Choose a reason for hiding this comment

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

what does return 1 mean?

…to handle new errors in get_args, use sys.exit() instead of return in main()
@damhuonglan
Copy link
Contributor Author

damhuonglan commented Aug 25, 2020

List of checks need to be done:

  • Argument helps and examples make sense

  • -M associate with -F gives error

  • -M still works the same as before

  • -F with value less than the highest mini file gives error

  • -F with value greater than the highest mini file will create mini file start from F

You can add any more checks that you feel need too.

Copy link
Collaborator

@hrotman-pic hrotman-pic left a comment

Choose a reason for hiding this comment

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

It looks like the -F option permits adding same DAS to new minis, making it easier to add service runs to an existing archive without having to resubmit the entire archive. Please see Working/Holly_append_test/PR426/test1. I have not validated that test archive since that is out of scope.

Overall the help is more informative and makes more sense. One small suggestion for -M flag, I think it would be good if help said also 'Recommend using when creating a new PH5' since I think that is the intended use of -M.

@damhuonglan damhuonglan changed the title I393 segdtoph5 add option -F for continue mini file from I393 data ingestion commands: add option -F for continue mini file from Sep 28, 2020
@hrotman-pic
Copy link
Collaborator

To clarify, I have only tested segdtoph5 as that was the original scope of this PR and I had a set of comparison test archives. I recommend additional reviewers for the other ingestion commands.

@ascire-pic
Copy link
Collaborator

@hrotman-pic is going to test mstoph5 and 125atoph5
@akram-pic is going to test seg2toph5 and 130toph5

@damhuonglan
Copy link
Contributor Author

To clarify, I have only tested segdtoph5 as that was the original scope of this PR and I had a set of comparison test archives. I recommend additional reviewers for the other ingestion commands.

@hrotman-pic Thanks for your review. I already put your recommended help message to -M. I already added -M to other ingestion commands too.

@hrotman-pic is going to test mstoph5 and 125atoph5
@akram-pic is going to test seg2toph5 and 130toph5

All data ingestion commands can be tested in this PR (checkout branch: i393_segdtoph5_optionS) except for mstoph5 is in PR #429 (checkout branch: i393-mstoph5_optionS)

@damhuonglan damhuonglan removed the request for review from ascire-pic October 1, 2020 20:25
Copy link
Collaborator

@hrotman-pic hrotman-pic left a comment

Choose a reason for hiding this comment

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

Based on the meeting, this review is requesting:
Removal of -F option for all ingestion commands changed under this PR, so that users cannot recreate the problem of data from one DAS in two or more mini files.

The changes to the help for other options, such as 'Ex: -M 38' are still useful in my view.

I am not sure about keeping 'Recommend using when creating a new PH5' for the -M option help (for all ingestion commands in this PR). If we keep it, I think it will help if the help for the -M option also says that adding new data to an existing PH5 may not create new mini files.

Going slightly out of the scope of the discussion: I think it would help standalone users to have an example of an ingestion command listed in the help, such as:
segdtoph5 -n master.ph5 -c 6 -U 18N -M 20
And to state that -S defaults to 1 if not specified in the help for -S option.

@damhuonglan damhuonglan mentioned this pull request Oct 16, 2020
5 tasks
@damhuonglan
Copy link
Contributor Author

replaced with PR#434

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants