https://dagster.io/ logo
#ask-community
Title
# ask-community
m

Michel Rouly

08/18/2022, 4:46 PM
Hi there. Is there a recommended way to have a Sensor track a Graph? We've got a bunch of Graphs (e.g.
ingest_redash
) and a few Sensors (e.g.
redash_sensor
). When we create our Repository, we apply Graphs to Resources at the last minute to return Jobs. We can have Sensors track Jobs if we use the Sensor factory pattern, but this makes our Repository definition pretty awkward -- you can no longer just loop over all the Graphs and apply them to Resources. You need to pull out specific Graphs, convert them to Jobs, and pass them into specific Sensors. We'd like our Sensors to track the Graphs (
@sensor
takes a
GraphDefinition
for its
job=
parameter) but when we do this, we run into the following error:
Copy code
UserWarning: Error loading repository location repo.py:datahub:dagster._core.errors.DagsterInvalidDefinitionError: sensor 'redash_sensor' targets graph 'ingest_redash', but a different job with the same name was provided. Disambiguate between these by providing a separate name to one of them.
🤖 1
s

sandy

08/18/2022, 4:47 PM
hey @Michel Rouly - sensors accept a "job_name" argument - would that work for you? you could create different jobs from the same graph but give them the same name?
m

Michel Rouly

08/18/2022, 4:50 PM
Hmm I see
pipeline_name
, is that the same thing? Or maybe I'm on an old version of Dagster?
I haven't checked out v1 yet, we're still on 0.15. Let me take a look.
https://github.com/dagster-io/dagster/blob/1.0.3/python_modules/dagster/dagster/_core/definitions/decorators/sensor_decorator.py#L25-L34 OK, yeah, that would work I think.
pipeline_name
works great for us, but it's marked as deprecated. If
job_name
works similarly, that sounds like a way forwards.
👍 1
Just stepped through the upgrade. Looks like it works exactly the same. This is great news!
2 Views