Dispatcher
laktory.dispatcher.Dispatcher(stack=None, env=None)
¤
The dispatcher is a manager that can be used to run and monitor remote jobs
and DLT pipelines defined in a stack. It is generally used through Laktory
CLI run command, but may be used directly in scripts and python
programs.
| PARAMETER | DESCRIPTION |
|---|---|
env
|
Selected environment
TYPE:
|
stack
|
Stack object
TYPE:
|
Examples:
```py tag:skip-run from laktory import Dispatcher from laktory import models
with open("./stack.yaml") as fp: stack = models.Stack.model_validate_yaml(fp)
dispatcher = Dispatcher(stack=stack) dispatcher.get_resource_ids() pl = dispatcher.resources["pl-stock-prices"] job = dispatcher.resources["job-stock-prices"]
Run pipeline¤
pl.run(current_run_action="WAIT", full_refresh=False)
Run job¤
job.run(current_run_action="CANCEL") ```
| METHOD | DESCRIPTION |
|---|---|
get_resource_ids |
Get resource ids for each of the resources defined in the stack in the |
init_resources |
Set resource for each of the resources defined in the stack |
run_databricks_dlt |
Run Databricks pipeline with name |
run_databricks_job |
Run job with name |
| ATTRIBUTE | DESCRIPTION |
|---|---|
env |
Selected environment
TYPE:
|
wc |
Databricks Workspace Client
TYPE:
|
Source code in laktory/dispatcher/dispatcher.py
47 48 49 50 51 52 53 | |
env
property
writable
¤
Selected environment
wc
property
¤
Databricks Workspace Client
get_resource_ids(env=None)
¤
Get resource ids for each of the resources defined in the stack in the
provided environment env.
Source code in laktory/dispatcher/dispatcher.py
139 140 141 142 143 144 145 146 147 148 | |
init_resources()
¤
Set resource for each of the resources defined in the stack
Source code in laktory/dispatcher/dispatcher.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
run_databricks_dlt(dlt_name, *args, **kwargs)
¤
Run Databricks pipeline with name dlt_name
| PARAMETER | DESCRIPTION |
|---|---|
dlt_name
|
Name of the DLT pipeline
TYPE:
|
*args
|
Arguments passed to
DEFAULT:
|
**kwargs
|
Keyword arguments passed to
DEFAULT:
|
Source code in laktory/dispatcher/dispatcher.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
run_databricks_job(job_name, *args, **kwargs)
¤
Run job with name job_name
| PARAMETER | DESCRIPTION |
|---|---|
job_name
|
Name of the job
TYPE:
|
*args
|
Arguments passed to
DEFAULT:
|
**kwargs
|
Keyword arguments passed to
DEFAULT:
|
Source code in laktory/dispatcher/dispatcher.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |