-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathprocessing.py
More file actions
47 lines (38 loc) · 1.19 KB
/
processing.py
File metadata and controls
47 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from prefect import flow, task, get_run_logger
from prefect.blocks.system import Secret
from tiled.client import from_profile
import os
import pytest
api_key = Secret.load("tiled-chx-api-key", _sync=True).get()
tiled_client = from_profile("nsls2", api_key=api_key)["chx"]
tiled_client_chx = tiled_client["raw"]
tiled_cilent_sandbox = tiled_client["sandbox"]
tiled_cilent_processed = tiled_client["processed"]
@task
def process_run(ref):
"""
Do processing on a BlueSky run.
Parameters
----------
ref : int, str
reference to BlueSky. It can be scan_id, uid or index
"""
logger = get_run_logger()
# Grab the BlueSky run
run = tiled_client_chx[ref]
# Grab the full uid for logging purposes
full_uid = run.start["uid"]
logger.info(f"{full_uid = }")
logger.info("Do something with this uid")
logger.info("Now do something else with this uid")
# Do some additional processing or call otehr python processing functions
@flow
def processing_flow(ref):
"""
Prefect flow to do processing on a BlueSky run.
Parameters
----------
ref : int, str
reference to BlueSky. It can be scan_id, uid or index
"""
process_run(ref)