Skip to content

Commit

Permalink
Merge pull request #4 from lcdesilva/prefect2-test
Browse files Browse the repository at this point in the history
Adding prefect2 changes
  • Loading branch information
lcdesilva authored Apr 21, 2023
2 parents 8ab4e5d + 1d3677b commit 820f4e2
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions end_of_run_workflow.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import prefect
from prefect import Flow, Parameter, task
from prefect.tasks.prefect import create_flow_run

from prefect import flow, task, get_run_logger
from data_validation import general_data_validation

@task
def log_completion():
logger = prefect.context.get("logger")
logger = get_run_logger()
logger.info("Complete")


with Flow("end-of-run-workflow") as flow:
stop_doc = Parameter("stop_doc")
@flow
def end_of_run_workflow(stop_doc):
uid = stop_doc["run_start"]
validation_flow = create_flow_run(
flow_name="general-data-validation",
project_name="LIX",
parameters={"beamline_acronym": "lix", "uid": uid},
)
log_completion(upstream_tasks=[validation_flow])

general_data_validation(beamline_acronym="lix", uid=uid)
log_completion()

0 comments on commit 820f4e2

Please sign in to comment.