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 |
---|---|
stack
|
Stack object
TYPE:
|
env
|
Selected environment
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
49 50 51 52 53 54 55 |
|
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
179 180 181 182 183 184 185 186 187 188 |
|
init_resources()
¤
Set resource for each of the resources defined in the stack
Source code in laktory/dispatcher/dispatcher.py
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 92 93 |
|
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
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
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
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|