Open Kat-Alo opened 5 days ago
Using version 1.8.1, I've also struggled with these details. I have run_status_sensors
that are identical in structure to your first example, and they run just fine without providing a duplicate job definition. I also have struggled with a similar run_status_sensor
that launches two distinct jobs with the successful completion of another, and after receiving the same error as your second example (sensor lacking a specified target) with various permutations of job name input locations, eventually I "fixed" it by resetting the sensor and its cursor in the UI.
Not a true "fix," and I never got to the bottom of it, but at least it works. Have you included resetting the sensor and its cursor in your different attempts?
This type of sensor is extremely useful and I believe we would all benefit from better documentation and performance.
What's the issue?
I need a sensor to monitor
job_a
, which runs on a schedule. Whenjob_a
succeeds, I need the sensor to update the dynamic partitions used forjob_b
and then submit run requests for all partitions (i.e. not just new ones). The code that I would expect to accomplish this looks roughly like:This code results in an error:
dagster._core.errors.DagsterCodeLocationLoadError: Failure loading src.project: dagster._core.errors.DagsterInvalidDefinitionError: Duplicate definition found for unresolved job 'job_b'
It appears that importing
job_b
and passing it as therequest_job
value results in Dagster trying to define the job twice.I then tried to instead define the target job in the
RunRequest
itself, rather than in the@run_status_sensor
decorator. This looked like:But that gave me this error:
Error in sensor records_success_callback: Sensor evaluation function returned a RunRequest for a sensor lacking a specified target (job_name, job, or jobs). Targets can be specified by providing job, jobs, or job_name to the @sensor decorator.
So then, I tried defining
job
orjob_name
in the@run_status_sensor
and got anunexpected key
error. After checking the docs, I figured the error message was more specifically for the@sensor
decorator and that I should try returning torequest_job
instead.As a gut check, I pulled the definition of
job_b
into thesensor.py
file like so:and (very much to my surprise) I no longer had the
Duplicate definition
error. However, this time, the sensor started getting activated every 30 seconds โ as in, every 30 seconds, withoutjob_a
running, run requests for all partitions onjob_b
were getting submitted.I went to bed, woke up this morning, and thought, "what the heck, let's try using
request_jobs=[job_b]
in the sensor decorator, instead ofrequest_job=job_b
". And somehow, that seems to be working. ๐I'm still not entirely sure what the heart of this issue is (I'm not even really sure that I'm not just doing something wrong), but I think the problems are:
Duplicate definition
error if used as a sensorrequest_job
orrequest_jobs
valueRunRequest
returned by a sensor without a target as long as the target is defined in theRunRequest
itselfrequest_job
should not run from a status sensor if the job defined as themonitored_job
hasn't succeededIf you've read this far, tysm for your time and consideration ๐
What did you expect to happen?
No response
How to reproduce?
No response
Dagster version
1.9.0
Deployment type
None
Deployment details
No response
Additional information
No response
Message from the maintainers
Impacted by this issue? Give it a ๐! We factor engagement into prioritization. By submitting this issue, you agree to follow Dagster's Code of Conduct.