https://dagster.io/ logo
#dagster-support
Title
# dagster-support
t

Thanakorn Kitsawat

10/18/2022, 3:26 PM
Hi, I trying to make a sensor with lazy loaded but I don't know how to make a sensor. Could you recommend me?
I am following from document but It does not show an example of making a sensor.
i

Issac Loo

10/18/2022, 3:37 PM
You would need to 1. define a job 2. add the @sensor wrapper on code you’d like to run, and fill in arguments 3. if it meets some conditional, add RunRequest and specify the run_configs 4. (optional) specify the minimum_interval_seconds argument here’s some pseudo code for a simple sensor
Copy code
from dagster import sensor, SkipReason, RunRequest

@sensor(job=SOME_JOB, minimum_interval_seconds=5)
def some_sensor(context)
  if not date.today().day != 1:
    return SkipReason("Date is not the first of the month")
  else:
    return RunRequest(run_key=..., run_config=...)
🌈 1
c

chris

10/18/2022, 8:52 PM
^ great suggestions above. We also have an entire page on sensors in our documentation right in the sidebar with various code examples
t

Thanakorn Kitsawat

10/19/2022, 4:51 AM
Thanks so much 🎉
3 Views