Thread
#announcements
    Kim Junil

    Kim Junil

    3 months ago
    Hi, It's related to the chat above I'm trying to schedule launchplan with cron_expression but error occurs
    launch 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?
    p

    Prafulla Mahindrakar

    3 months ago
    Hi @Kim Junil, can you check these docs , if you are using the cron schedules correctly
    schedule=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-table
    Niels Bantilan

    Niels Bantilan

    3 months ago
    hi @Kim Junil @SeungTaeKim which docs led you to the cron expression that caused the error? The canonical schedule syntax should be documented where @Prafulla Mahindrakar pointed you to
    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-table
    @Marc Paquette
    And there's comment in this doc.https://docs.flyte.org/projects/cookbook/en/latest/auto/core/scheduled_workflows/lp_schedules.html#cron-schedules
    from 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",
        ),
    )
    # 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
    p

    Prafulla Mahindrakar

    3 months ago
    If you are using native scheduler which is default supported CronSchedule should be used instead of CronExpression . Fixed the docs to clarify this point https://github.com/flyteorg/flytekit/pull/1081/files
    Niels Bantilan

    Niels Bantilan

    3 months ago
    Thanks @Prafulla Mahindrakar! @Marc Paquette we should probably double check and do a pass at all the Cron-related docs to make sure they’re consistent. I think we should clarify the difference between the native scheduler vs other (AWS?-dependent) schedulers