dhiaayachi / temporal

Temporal service
https://docs.temporal.io
MIT License
0 stars 0 forks source link

cron_expressions. not being returned in ScheduleSpec #170

Open dhiaayachi opened 2 months ago

dhiaayachi commented 2 months ago

Expected Behavior

        schedule = await self.client.create_schedule(
            "my_schedule_id",
            Schedule(
                action=ScheduleActionStartWorkflow(
                    YourSchedulesWorkflow.run, id="my_id", task_queue="default"
                ),
                spec=ScheduleSpec(cron_expressions=["0 0 * * *"]),
            ),
        )

        schedule = self.client.get_schedule_handle(id=schedule.id)
        scheduleDesc = await schedule.describe()
        print("schedule", scheduleDesc.schedule.spec)

Should return

ScheduleSpec(calendars=[ScheduleCalendarSpec(second=(ScheduleRange(start=0, end=0, step=1),), minute=(ScheduleRange(start=0, end=0, step=1),), hour=(ScheduleRange(start=0, end=0, step=1),), day_of_month=(ScheduleRange(start=1, end=31, step=1),), month=(ScheduleRange(start=1, end=12, step=1),), year=(), day_of_week=(ScheduleRange(start=0, end=6, step=1),), comment=None)], intervals=[], cron_expressions=["0 0 * * *"], skip=[], start_at=None, end_at=None, jitter=None, time_zone_name=None)

Actual Behavior

        schedule = await self.client.create_schedule(
            "my_schedule_id",
            Schedule(
                action=ScheduleActionStartWorkflow(
                    YourSchedulesWorkflow.run, id="my_id", task_queue="default"
                ),
                spec=ScheduleSpec(cron_expressions=["0 0 * * *"]),
            ),
        )

        schedule = self.client.get_schedule_handle(id=schedule.id)
        scheduleDesc = await schedule.describe()
        print("schedule", scheduleDesc.schedule.spec)

returns

ScheduleSpec(calendars=[ScheduleCalendarSpec(second=(ScheduleRange(start=0, end=0, step=1),), minute=(ScheduleRange(start=0, end=0, step=1),), hour=(ScheduleRange(start=0, end=0, step=1),), day_of_month=(ScheduleRange(start=1, end=31, step=1),), month=(ScheduleRange(start=1, end=12, step=1),), year=(), day_of_week=(ScheduleRange(start=0, end=6, step=1),), comment=None)], intervals=[], cron_expressions=[], skip=[], start_at=None, end_at=None, jitter=None, time_zone_name=None)

Steps to Reproduce the Problem

  1. Create schedule with cron_expression
  2. Get handler for schedule by id
  3. Display spec for schedule

Specifications

dhiaayachi commented 2 months ago

Thanks for reporting this issue! It looks like you are experiencing a bug where the cron_expressions field in the ScheduleSpec is not being returned correctly when using the Python SDK.

This issue is being tracked in Temporal's GitHub repository https://github.com/temporalio/temporal/issues.

We are actively working on a fix for this bug. In the meantime, you can work around it by using the intervals field of the ScheduleSpec to specify your desired schedule.

Let us know if you have any other questions or issues!

dhiaayachi commented 2 months ago

Thanks for reporting this issue. It seems that you are experiencing a known issue. The issue is that the spec returned from describe() does not contain the cron_expressions field even though the schedule was created with cron.

For more information and possible workarounds, please refer to the Temporal CLI command options reference documentation.