-
Notifications
You must be signed in to change notification settings - Fork 1
Support multiple destination butlers #35
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -299,6 +299,19 @@ def register( | |||||||||
| key="arcBackup", | ||||||||||
| value="SLAC_RAW_DISK_BKUP:need", | ||||||||||
| ) | ||||||||||
| self.did_client.set_metadata( | ||||||||||
| scope="raw", | ||||||||||
| name=datasets[-1], | ||||||||||
| key="SafeCopyCheck", | ||||||||||
| value="need", | ||||||||||
| ) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def comma_separated_list(arg): | ||||||||||
| """ | ||||||||||
| Custom type function to split a comma-separated string into a list. | ||||||||||
| """ | ||||||||||
| return arg.split(',') | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def parse_args(): | ||||||||||
|
|
@@ -321,9 +334,9 @@ def parse_args(): | |||||||||
| help="Butler repository from which data is transferred.", | ||||||||||
| ) | ||||||||||
| parser.add_argument( | ||||||||||
| "torepo", | ||||||||||
| type=str, | ||||||||||
| help="Repository to which data is transferred.", | ||||||||||
| "torepos", | ||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep the name but add |
||||||||||
| type=comma_separated_list, | ||||||||||
| help="Comma separated list of repositories to which data is transferred.", | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| parser.add_argument( | ||||||||||
|
|
@@ -461,7 +474,7 @@ def process_exposure(exp: DimensionRecord, instrument: str) -> None: | |||||||||
| instrument: `str` | ||||||||||
| The name of the instrument corresponding to the exposure. | ||||||||||
| """ | ||||||||||
| global logger, config, source_butler, dest_butler, rucio_interface | ||||||||||
| global logger, config, source_butler, dest_butlers, rucio_interface | ||||||||||
|
|
||||||||||
| # Check several times (before each major step) for existence of the | ||||||||||
| # result to avoid work in case of race conditions | ||||||||||
|
|
@@ -653,12 +666,14 @@ def process_exposure(exp: DimensionRecord, instrument: str) -> None: | |||||||||
|
|
||||||||||
| logger.info("Transferring dimension records to destination Butler repo") | ||||||||||
| if not config.dry_run: | ||||||||||
| dest_butler.transfer_dimension_records_from(source_butler, refs) | ||||||||||
| for dest_butler in dest_butlers: | ||||||||||
| dest_butler.transfer_dimension_records_from(source_butler, refs) | ||||||||||
|
|
||||||||||
| logger.info("Ingesting zip: %s", dest_path) | ||||||||||
| if not config.dry_run: | ||||||||||
| with time_this(logger, "Ingesting zip"): | ||||||||||
| dest_butler.ingest_zip(dest_path, transfer="direct") | ||||||||||
| for dest_butler in dest_butlers: | ||||||||||
| dest_butler.ingest_zip(dest_path, transfer="direct") | ||||||||||
|
|
||||||||||
| if config.rucio_rse: | ||||||||||
| logger.info("Registering zip in Rucio") | ||||||||||
|
|
@@ -684,13 +699,13 @@ def process_exposure(exp: DimensionRecord, instrument: str) -> None: | |||||||||
| config: argparse.Namespace | ||||||||||
| logger: logging.Logger | ||||||||||
| source_butler: Butler | ||||||||||
| dest_butler: Butler | ||||||||||
| dest_butlers: list[Butler] | ||||||||||
| rucio_interface: RucioInterface | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def initialize(): | ||||||||||
| """Set up the global variables.""" | ||||||||||
| global config, source_butler, dest_butler, logger, rucio_interface | ||||||||||
| global config, source_butler, dest_butlers, logger, rucio_interface | ||||||||||
|
|
||||||||||
| config = parse_args() | ||||||||||
|
|
||||||||||
|
|
@@ -711,7 +726,9 @@ def initialize(): | |||||||||
| logger.warning("dry_run=True, no writes") | ||||||||||
|
|
||||||||||
| source_butler = Butler(config.fromrepo, skymap="lsst_cells_v1") | ||||||||||
| dest_butler = Butler(config.torepo, writeable=True) | ||||||||||
| for torepo in config.torepos: | ||||||||||
| dest_butler = Butler(torepo, writeable=True) | ||||||||||
| dest_butlers.append(dest_butler) | ||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More compact is:
Suggested change
This should also solve the immediate test failure. |
||||||||||
|
|
||||||||||
| if config.rucio_rse: | ||||||||||
| rucio_interface = RucioInterface(config.rucio_rse, config.scope) | ||||||||||
|
|
||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please make this a separate commit.