forked from NSLS-II-CHX/workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_validation.py
26 lines (22 loc) · 888 Bytes
/
data_validation.py
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
from prefect import task, flow, get_run_logger
import time as ttime
from tiled.client import from_profile
@task(retries=2, retry_delay_seconds=10)
def read_all_streams(uid):
tiled_client = from_profile("nsls2", username=None)
logger = get_run_logger()
run = tiled_client['chx']["raw"][uid]
logger.info(f"Validating uid {run.start['uid']}")
start_time = ttime.monotonic()
for stream in run:
logger.info(f"{stream}:")
stream_start_time = ttime.monotonic()
stream_data = run[stream].read()
stream_elapsed_time = ttime.monotonic() - stream_start_time
logger.info(f"{stream} elapsed_time = {stream_elapsed_time}")
logger.info(f"{stream} nbytes = {stream_data.nbytes:_}")
elapsed_time = ttime.monotonic() - start_time
logger.info(f"{elapsed_time = }")
@flow
def data_validation(uid):
read_all_streams(uid)