-
Notifications
You must be signed in to change notification settings - Fork 3
Dotenv dryrun fromuri #4
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
Abby Giles (AbbyGi)
merged 12 commits into
NSLS2:main
from
AbbyGi:dotenv-dryrun-fromuri
Mar 31, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4ca02fd
Use dotenv to get tiled api key, switch to from_uri
AbbyGi 8da9aa5
Start adding dry_run and pass api_key through export flows
AbbyGi 3e9fe4d
fix pre-commit errors
JunAishima 67109fe
add h5py
JunAishima d961092
Remove tiled site profiles and add srv volume
AbbyGi 58f5eff
Log output when export is not performed due to scan abort status
JunAishima 66d4fd8
pre-commit lint - fix spacing
JunAishima 912db28
export and validation code cleanup
AbbyGi 583ee0c
Move retries to task, not flow
AbbyGi 8c3a6b8
Add log message if unknown analyzer_type found in start doc
AbbyGi a5dd97f
Linter fix
AbbyGi d2d131b
Remove unused function
AbbyGi 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
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 |
|---|---|---|
| @@ -1,18 +1,30 @@ | ||
| import os | ||
|
|
||
| from dotenv import load_dotenv | ||
| from prefect import flow, get_run_logger, task | ||
|
|
||
| from data_validation import general_data_validation | ||
| from data_validation import data_validation | ||
| from general_exporter import export_switchboard | ||
|
|
||
|
|
||
| def get_api_key_from_env(): | ||
| with open("/srv/container.secret", "r") as secrets: | ||
| load_dotenv(stream=secrets) | ||
| api_key = os.environ["TILED_API_KEY"] | ||
| return api_key | ||
|
|
||
|
|
||
| @task | ||
| def log_completion(): | ||
| logger = get_run_logger() | ||
| logger.info("Complete") | ||
|
|
||
|
|
||
| @flow | ||
| def end_of_run_workflow(stop_doc): | ||
| def end_of_run_workflow(stop_doc, api_key=None, dry_run=False): | ||
| if api_key is None: | ||
| api_key = get_api_key_from_env() | ||
| uid = stop_doc["run_start"] | ||
| general_data_validation(uid, beamline_acronym="haxpes") | ||
| export_switchboard(uid, beamline_acronym="haxpes") | ||
| data_validation(uid, api_key=api_key) | ||
| export_switchboard(uid, api_key=api_key, dry_run=dry_run) | ||
| log_completion() |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.