Hi team, we want to set an `end_date` in a schedul...
# ask-community
b
Hi team, we want to set an
end_date
in a scheduled job, instead of pausing it from UI. How can we do that? I couldn’t find anything mentioned in the docs.
z
When you define your schedule for the job you can pass tags to each of the ops in the job itself. The ops can then access this tag and use the value as needed i.e
Copy code
@schedule(job=job, cron_schedule='0 0 * * *', execution_timezone=DEFAULT_TIMEZONE)
    def daily_schedule(context: ScheduleEvaluationContext) -> ScheduleDefinition:
        scheduled_date = context.scheduled_execution_time.strftime('%Y-%m-%d')
        return RunRequest(run_key=None, tags={'date': scheduled_date},)
You can set the scheduled_date tag to whatever suits your needs. Would that work?
b
Hi @Zachary Bluhm, how would passing a tag(scheduled_date) stop scheduling?
z
Ah sorry, i interpreted your question as "how do I pass an
end_date
in a schedule job" I didn't realize you were dynamically trying to configure whether a schedule should be turned off
t
How dynamically would you like to update it? Is it "turn it off once and never use it again"? This seems like an interesting use case and I'd like to help while also trying to hear more about what you need.
s
here's an issue that might be relevant: https://github.com/dagster-io/dagster/issues/11428
👍 1
b
Hi guys, thank you so much for showing interests in this case. So basically what we want is to have the same/similar functionality as in Airflow. And in most cases, we do “turn it off once and never use it again” as @Tim Castillo mentioned. But we also had some rare scenarios which we need to turn it on again.
@sandy, the issue you shared is similar with our use case. Is this a feature you would consider to implement in short future?
s
we're interested in implementing it eventually, but it's not on our near-term roadmap
b
That’s good to know. But is there any other work arounds you would suggest?
Hi guys, if you are still interested, I made a PR here https://github.com/dagster-io/dagster/pull/14155 It’s not fully tested yet. But it works for our use case. I’ll test it a bit more and update it.