Skip to content

How can I pass the scheduled date dynamically through the ops #8426

Answered by yuhan
dagsir[bot] bot asked this question in Q&A
Discussion options

You must be logged in to vote

The typical way to do this is through configuration. In this docs example, we have two options to pass in that information and both can be accessed from from the optional context arg (OpExecutionContext):

  • Option 1: pass it in via run_config and have an op that accepts configuration from a schedule
  • Option 2: pass it in via tags which is a job-level config

Here's a full code snippet:

from dagster import schedule, op, job, OpExecutionContext, ScheduleEvaluationContext, RunRequest


@op(config_schema={"scheduled_date": str})
def configurable_op(context: OpExecutionContext):
    print(context.op_config["scheduled_date"])
    print(context.get_tag("date"))


@op
def another_op(context: OpExec…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yuhan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant