https://dagster.io/ logo
#ask-ai
Title
# ask-ai
c

Christopher Tee

03/13/2024, 4:00 PM
@Scout within a `@run_status_sensor`’s context, how can I infer whether a particular op within a run executed or not?
s

Scout

03/13/2024, 4:00 PM
Within a
@run_status_sensor
context, you cannot directly infer whether a particular op within a run executed or not. The
RunStatusSensorContext
provided to a
@run_status_sensor
function includes information about the run's overall status (e.g., success, failure), but it does not contain detailed execution information about individual ops within the run. The
RunStatusSensorContext
includes attributes such as
dagster_run
(which represents the run that triggered the sensor) and
dagster_event
(which represents the event that caused the sensor to trigger). However, these do not provide op-level execution details. If you need to determine whether a specific op executed within a run, you would typically need to inspect the run's logs or events after the run has completed. This could involve querying the Dagster instance for the run's event logs and checking for events related to the execution of the specific op you are interested in. For more granular control and monitoring at the op level, you might consider using hooks or custom logic within your ops to record their execution status to an external system or to emit custom events that can be monitored separately. Remember that the primary purpose of a
@run_status_sensor
is to react to changes in the status of runs, such as when a run starts, succeeds, or fails, rather than to monitor the execution of individual ops within those runs. Bind run_status_sensor for a specific jo... button run_status_sensor behind runs - consider... button Include logger as part of SensorContext button It's not clear how I should unittest a r... button Thank you for your feedback!