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

Louis Auneau

03/29/2023, 3:53 PM
Hello! In the v1.2.2 changelog, I see an experimental feature that allows a
required_resource_keys
to be specified for sensors. From what I understood I should use
with_resources
in my repository. As follows:
Copy code
@sensor(
    job=my_job,
    required_resource_keys={"my_resource"}
)
def my_sensor(context):
    context.my_resource...

@repository
def my_repo():
    return *with_resources(
        definitions=[my_sensor],
        resource_defs={'my_resource': my_resource}
    )
When I do so I get this error :
Copy code
'SensorDefinition' object has no attribute 'with_resources'
Is there anything I do wrong ? Thank you by advance and have a nice day, Louis
🤖 1
s

sean

03/29/2023, 3:59 PM
Hmm I’m guessing that new feature only works with the Definitions API: https://docs.dagster.io/concepts/code-locations#defining-code-locations
Definitions
does not require
with_resources
, the sensors will be able to bind any resources passed to the
Definitions
object.
l

Louis Auneau

03/29/2023, 4:25 PM
Oh thanks a lot !
3 Views