Hi, I have the following run_status_sensor to catc...
# ask-community
Hi, I have the following run_status_sensor to catch all job that have been cancelled
Copy code
def job_canceled_sensor(context: RunStatusSensorContext):
    prometheus = PrometheusClient()
    status = 'canceled'
    logger = get_dagster_logger(name='JOB_STATUS_SENSOR')
    <http://logger.info|logger.info>(f"job_canceled_sensor - {context.dagster_run.job_name} - {status}")
    prometheus.change_job_state(context.dagster_run.job_name, status)
But then when I terminate the job via the UI, the job state is CANCELED but the sensor is not triggered. Am I doing something wrong?
It doesn’t look like you’re doing anything wrong in the code snippet…. What are you seeing? Is the sensor is turned on and you’re just seeing ticks being skipped?
Thanks for responding. I played a bit more with trying to narrow down the problem. The sensor is turned on I have a job with a retry logic that has an op that sleep and I'm interrupting it while sleeping. Then I get the following exception and nothing else beside the fact that the job is in a
state without the sensor being called