brief-oil-51532
06/23/2022, 9:21 AMlaunch plan daily failed to update due to rpc error: code = Internal desc = failed adding schedule for unknown schedule expression type &{0 0 * * ? *}
I found this code in flyteadmin github repo while debugging (https://github.com/flyteorg/flyteadmin/blob/master/scheduler/dbapi/event_scheduler_impl.go)
func (s *eventScheduler) AddSchedule(ctx context.Context, input interfaces.AddScheduleInput) error {
...
switch v := input.ScheduleExpression.GetScheduleExpression().(type) {
case *admin.Schedule_Rate:
fixedRateValue = v.Rate.Value
fixedRateUnit = v.Rate.Unit
case *admin.Schedule_CronSchedule:
cronString = v.CronSchedule.Schedule
default:
return fmt.Errorf("failed adding schedule for unknown schedule expression type %v", v)
}
...
}
and this code in flyteidl repo (https://github.com/flyteorg/flyteidl/blob/master/gen/pb-go/flyteidl/admin/schedule.pb.go)
type Schedule struct {
// Types that are valid to be assigned to ScheduleExpression:
// *Schedule_CronExpression
// *Schedule_Rate
// *Schedule_CronSchedule
ScheduleExpression isSchedule_ScheduleExpression `protobuf_oneof:"ScheduleExpression"`
// Name of the input variable that the kickoff time will be supplied to when the workflow is kicked off.
KickoffTimeInputArg string `protobuf:"bytes,3,opt,name=kickoff_time_input_arg,json=kickoffTimeInputArg,proto3" json:"kickoff_time_input_arg,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
It seems that the error is caused by AddSchedule
function not processing ths Schedule_CronExpression
type.
Can someone help me?icy-agent-73298
06/23/2022, 11:02 AMschedule=CronSchedule(
....
),
https://docs.flyte.org/projects/cookbook/en/latest/auto/core/scheduled_workflows/lp_schedules.html#launchplan-schedules
And also cron expression format that you are using seems to be older aws format . Can you check this https://docs.flyte.org/en/latest/concepts/schedules.html#cron-expression-tablebroad-monitor-993
06/23/2022, 1:40 PMAnd also cron expression format that you are using seems to be older aws format . Can you check this https://docs.flyte.org/en/latest/concepts/schedules.html#cron-expression-table@echoing-queen-96254
brief-oil-51532
06/24/2022, 12:26 AMfrom flytekit import CronSchedule, LaunchPlan
# creates a launch plan that runs every minute.
cron_lp = LaunchPlan.get_or_create(
name="my_cron_scheduled_lp",
workflow=date_formatter_wf,
schedule=CronSchedule(
# Note that kickoff_time_input_arg matches the workflow input we defined above: kickoff_time
# But in case you are using the AWS scheme of schedules and not using the native scheduler then switch over the schedule parameter with cron_expression
schedule="*/1 * * * *", # Following schedule runs every min
kickoff_time_input_arg="kickoff_time",
),
)
Copy code# But in case you are using the AWS scheme of schedules and not using the native scheduler then switch over the schedule parameter with cron_expression
icy-agent-73298
06/24/2022, 1:06 PMbroad-monitor-993
06/24/2022, 2:26 PM