Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Comment on lines +3 to +8

> Choose one of the following descriptions; delete the other.

Expand Down
14 changes: 7 additions & 7 deletions end_of_run_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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 = (
Expand Down
18 changes: 9 additions & 9 deletions prefect.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: prefect-docker-pixi-tiled-tla
name: prefect-docker-pixi-tiled-TLA
prefect-version: 3.6.10

build: null
Expand All @@ -9,28 +9,28 @@ 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
parameters: {}
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
Loading