Hi - What's the proper way to pass the new Pydanti...
# ask-community
a
Hi - What's the proper way to pass the new Pydantic-based RunConfig to a schedule which calls a job configured via the same RunConfig object? I'm currently getting the error below when setting
run_config = custom_run_config
in the schedule decorator parameters:
Copy code
dagster._check.ParameterCheckError: Param "run_config" is not one of ['Mapping']. Got <dagster._core.definitions.run_config.RunConfig object at 0x0000026900DF3F70> which is type <class 'dagster._core.definitions.run_config.RunConfig'>.
Also, though the error says it's expecting a
Mapping
type, however, the
RunRequest.__new__
method is typed to accept a RunConfig too.
c
Hey Adam, I think this might be an oversight… raising with the team.
So RunRequest looks like it’s updated to correctly receive `RunConfig`… where exactly are you setting this param?
a
Hey Chris - Sorry. I misspoke earlier. I'm actually setting it in the RunRequest in an
@schedule
decorated function. Example below:
Copy code
@schedule(
    job=my_scheduled_job,
    cron_schedule="0 * * * *",
    execution_timezone="America/Los_Angeles",
)
def run_job_every_hour(context: ScheduleEvaluationContext):
    one_hour_ago_from_schedule: datetime = (
            context.scheduled_execution_time - timedelta(hours=1)
    )
    return RunRequest(
        run_key=None,
        run_config=RunConfig(
            ops={
                "run_job_query": OpConfigForJobQuery(
                    start_year=f'{one_hour_ago_from_schedule.year:04d}',
                    start_month=f'{one_hour_ago_from_schedule.month:02d}',
                    start_day=f'{one_hour_ago_from_schedule.day:02d}',
                    start_hour=f'{one_hour_ago_from_schedule.hour:02d}',
                    start_min=f'{one_hour_ago_from_schedule.minute:02d}',
                    timezone="Pacific"
                )
            }
        )
    )
I am running Dagster 1.3.12.
Adding
.to_config_dict
resolved the issue for now, but I'd like to try to figure out why this isn't working without doing that, if possible.
c
Super weird. The run request run config behavior isn’t super well tested, but an example more or less identical to yours is under test? having a hard time reproducing