diff --git a/README.md b/README.md index fe373ed..dcd69af 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -# {endstation or TLA}-workflows +# {TLA}-workflows -> Replace all instances of {endstation or TLA} with the name of the endstation -> or the **lower-case** three-letter acronym of the beamline, if an endstation -> name does not apply. Finally, delete all instructions -- lines that start with -> `>` +> Replace all instances of {TLA} with the name of the endstation or the +> **lower-case** three-letter acronym of the beamline, if an endstation name +> does not apply. Finally, delete all instructions -- lines that start with `>` + +> It would be quick and easy to perform a text replace call for "TLA" to "tla" +> where "tla" is the acronym for the instrument name. > Choose one of the following descriptions; delete the other. diff --git a/end_of_run_workflow.py b/end_of_run_workflow.py index d3f9f24..24e09ec 100644 --- a/end_of_run_workflow.py +++ b/end_of_run_workflow.py @@ -7,13 +7,13 @@ from data_validation import get_run_migration from dotenv import load_dotenv -CATALOG_NAME = "tla" +CATALOG_NAME = "TLA" def slack(func): """ Send a message to mon-prefect and mon-prefect-program slack channels if the flow-run failed. - Send a message to mon-prefect-tla slack channel with the flow-run status. + Send a message to mon-prefect-TLA slack channel with the flow-run status. Send a message to mon-bluesky slack channel if the bluesky-run failed. NOTE: the name of this inner function is the same as the real end_of_workflow() function because @@ -27,7 +27,7 @@ def end_of_run_workflow(stop_doc, api_key=None, dry_run=False): # Load slack credentials that are saved in Prefect. mon_prefect = SlackWebhook.load("mon-prefect") mon_bluesky = SlackWebhook.load("mon-bluesky") - mon_prefect_tla = SlackWebhook.load("mon-prefect-tla") + mon_prefect_instrument = SlackWebhook.load("mon-prefect-TLA") mon_prefect_program = SlackWebhook.load("mon-prefect-program") # Get the uid. @@ -47,17 +47,17 @@ def end_of_run_workflow(stop_doc, api_key=None, dry_run=False): try: result = func(stop_doc, api_key=api_key, dry_run=dry_run) - # Send a message to mon-prefect-tla if flow-run is successful. + # Send a message to mon-prefect-TLA if flow-run is successful. message = f":white_check_mark: {CATALOG_NAME} flow-run successful. (*{flow_run_name}*)\n ```run_start: {uid}\nscan_id: {scan_id}```" - mon_prefect_tla.notify(message) + mon_prefect_instrument.notify(message) return result except Exception as e: tb = traceback.format_exception_only(e) - # Send a message to mon-prefect-tla, mon-prefect if flow-run failed. + # Send a message to mon-prefect-TLA, mon-prefect if flow-run failed. message = f":bangbang: {CATALOG_NAME} flow-run failed. (*{flow_run_name}*)\n ```run_start: {uid}\nscan_id: {scan_id}``` ```{tb[-1]}```" mon_prefect.notify(message) - mon_prefect_tla.notify(message) + mon_prefect_instrument.notify(message) flow_run = FlowRunContext.get().flow_run # Add link to flow-run for the message to mon-prefect-program. program_message = ( diff --git a/prefect.yaml b/prefect.yaml index 7f8e2c9..4425d2c 100644 --- a/prefect.yaml +++ b/prefect.yaml @@ -1,4 +1,4 @@ -name: prefect-docker-pixi-tiled-tla +name: prefect-docker-pixi-tiled-TLA prefect-version: 3.6.10 build: null @@ -9,14 +9,14 @@ pull: - prefect.deployments.steps.set_working_directory: directory: /repo - prefect.deployments.steps.git_clone: - repository: https://github.com/nsls2/nsls2-workflows-template.git + repository: https://github.com/nsls2/TLA-workflows.git branch: main deployments: - - name: tla-end-of-run-workflow-docker + - name: TLA-end-of-run-workflow-docker version: 0.1.2 tags: - - tla + - TLA - main description: Deploy the updated Docker image entrypoint: end_of_run_workflow.py:end_of_run_workflow @@ -24,13 +24,13 @@ deployments: schedule: {} work_pool: job_variables: - image: ghcr.io/nsls2/nsls2-workflows-template:main + image: ghcr.io/nsls2/TLA-workflows:main image_pull_policy: Always network: slirp4netns volumes: - - /nsls2/data/tla/proposals:/nsls2/data/tla/proposals - - /srv/prefect3-docker-worker-tla/app:/srv # replace tla here + - /nsls2/data/TLA/proposals:/nsls2/data/TLA/proposals + - /srv/prefect3-docker-worker-TLA/app:/srv # replace TLA here container_create_kwargs: - userns_mode: "keep-id:uid=402xxx,gid=402xxx" # workflow-tla:workflow-tla + userns_mode: "keep-id:uid=402xxx,gid=402xxx" # workflow-TLA:workflow-TLA auto_remove: true - name: tla-work-pool-docker + name: TLA-work-pool-docker