https://dagster.io/ logo
#dagster-feedback
Title
# dagster-feedback
l

Leo Kell

11/19/2021, 6:46 PM
Hello! I think it could be useful to add message outputs to the schedule
should_execute
function. For example, I check for various conditions such as if certain environment variables are set before launching a pipeline, and if a run was skipped it sometimes takes some time for me to find out exactly why. Adding a mechanism for outputting messages here would help debug why runs were skipped.
👍 1
p

prha

11/19/2021, 7:32 PM
Hey Leo. How are you constructing your schedule (e.g. with a decorator, or by defining a
ScheduleDefinition
? The
ScheduleDefinition
class takes in an
execution_fn
argument that has the same signature as a sensor evaluation function. You can directly yield
RunRequest
and
SkipReason
objects from that function. https://docs.dagster.io/_apidocs/schedules-sensors#dagster.ScheduleDefinition
l

Leo Kell

11/19/2021, 7:49 PM
I am currently using the
schedule
decorator. Is there something similar I can use for that? If not, I think I should be able to use the
ScheduleDefinition
instead.
p

prha

11/19/2021, 7:54 PM
No, unfortunately not… I’ve been meaning to deprecate the run_config_fn based
@schedule
in favor of the execution_fn based decorator and keeping the decorator name to
schedule
but that’s a breaking change and hadn’t figured out a reasonable transition plan.
This has come up in recent weeks though, so might actually to push for the switch with the next major release (
0.14.0
?) and move the current
@schedule
functionality to
@legacy_schedule
or something like that
l

Leo Kell

11/19/2021, 7:56 PM
Sounds good! I will move away from the current
@schedule
in that case.
p

prha

12/02/2021, 11:29 PM
@Leo Kell Just wanted to follow up… we just released
0.13.10
which now supports using the
@schedule
decorator with the
RunRequest
based evaluation function. You can switch back to using that instead of manually constructing the
ScheduleDefinition
. Something like this:
Copy code
@schedule(cron_schedule="* * * * *", job=my_job)
def my_schedule(context):
    if os.getenv("SHOULD_SKIP"):
        yield SkipReason("skipping")
        return 
    else:
        yield RunRequest(run_config=..., tags=...)
        return
l

Leo Kell

12/02/2021, 11:42 PM
That's great! Thank you for the update.
5 Views