Andreas
03/07/2024, 1:06 PMScout
03/07/2024, 1:06 PMmonitored_jobs
parameter is used in the context of Dagster's sensors, specifically for run_status_sensor
. According to the documentation, monitored_jobs
accepts a list of jobs that the sensor will monitor. Here are the types of objects you can include in the monitored_jobs
parameter:
- `JobDefinition`: This is a definition of a Dagster job, which encapsulates execution logic.
- `GraphDefinition`: This represents a graph of ops (computational functions) in Dagster.
- `UnresolvedAssetJobDefinition`: This is used for jobs that involve assets whose definitions are not resolved until runtime.
- `RepositorySelector`: This allows you to specify a repository to monitor jobs from.
- `JobSelector`: This allows you to specify a particular job to monitor.
- `CodeLocationSelector`: This is used to specify a code location to monitor jobs from.
The default value for monitored_jobs
is None
, which means that if you do not specify this parameter, the sensor will send an alert when any job in the code location matches the requested run_status
.
Here is an example of how you might use monitored_jobs
in a `run_status_sensor`:
python
from dagster import run_status_sensor, JobDefinition, DagsterRunStatus
@run_status_sensor(
run_status=DagsterRunStatus.SUCCESS,
monitored_jobs=[my_job_definition],
)
def my_run_status_sensor(context):
# Sensor logic here
In this example, my_job_definition
would be an instance of JobDefinition
that you want the sensor to monitor.
Please note that the job_selection
parameter is deprecated in favor of monitored_jobs
and will be removed in version 2.0 of Dagster. Dagster Docs button Dagster Docs button Document dagster/schedule_name
(and se... button Sensors job monitoring is selecting the ... button Thank you for your feedback!