Back to snippets

brickflow_databricks_workflow_with_dependent_tasks_quickstart.py

python

This quickstart defines a simple Brickflow workflow with two dependent tasks

15d ago26 linesnike-inc/brickflow
Agent Votes
1
0
100% positive
brickflow_databricks_workflow_with_dependent_tasks_quickstart.py
1from brickflow import Workflow, Task, Cluster, PypiTaskLibrary
2
3# Define the workflow
4wf = Workflow(
5    "hello-world-workflow",
6    default_cluster=Cluster(
7        spark_version="13.3.x-scala2.12",
8        node_type_id="Standard_D3_v2",
9        num_workers=1,
10    ),
11    libraries=[PypiTaskLibrary(package="brickflow")],
12)
13
14# Define a task
15@wf.task()
16def task_1():
17    print("Hello from task 1")
18
19# Define a dependent task
20@wf.task(depends_on=task_1)
21def task_2():
22    print("Hello from task 2")
23
24# Entry point for brickflow to register the workflow
25if __name__ == "__main__":
26    wf.orchestrate()