util

package
v1.7.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ControllerAgentName string = "scheduled-workflow-controller" // ControllerAgentName is the name of the controller.
	TimeZone            string = "CRON_SCHEDULE_TIMEZONE"        // TimeZone is the name of the cron schedule timezone env parameter
)

Variables

This section is empty.

Functions

func GetLocation

func GetLocation() (*time.Location, error)

func GetRequirementForCompletedWorkflowOrFatal

func GetRequirementForCompletedWorkflowOrFatal(completed bool) *labels.Requirement

GetRequirementForCompletedWorkflowOrFatal returns a label requirement indicating whether a workflow is completed.

func GetRequirementForMinIndexOrFatal

func GetRequirementForMinIndexOrFatal(minIndex int64) *labels.Requirement

GetRequirementForScheduleNameOrFatal returns a label requirement for a minimum index of creation of a workflow (to avoid querying the whole list).

func GetRequirementForScheduleNameOrFatal

func GetRequirementForScheduleNameOrFatal(swf string) *labels.Requirement

GetRequirementForScheduleNameOrFatal returns a label requirement for a specific ScheduledWorkflow name.

Types

type CronSchedule

type CronSchedule struct {
	*swfapi.CronSchedule
}

CronSchedule is a type to help manipulate CronSchedule objects.

func NewCronSchedule

func NewCronSchedule(cronSchedule *swfapi.CronSchedule) *CronSchedule

NewCronSchedule creates a CronSchedule.

func (*CronSchedule) GetNextScheduledTime

func (s *CronSchedule) GetNextScheduledTime(lastJobTime *v1.Time,
	defaultStartTime time.Time, location *time.Location) time.Time

GetNextScheduledTime returns the next epoch at which a workflow must be scheduled.

func (*CronSchedule) GetNextScheduledTimeNoCatchup

func (s *CronSchedule) GetNextScheduledTimeNoCatchup(lastJobTime *v1.Time,
	defaultStartTime time.Time, nowTime time.Time, location *time.Location) time.Time

type PeriodicSchedule

type PeriodicSchedule struct {
	*swfapi.PeriodicSchedule
}

PeriodicSchedule is a type to help manipulate PeriodicSchedule objects.

func NewPeriodicSchedule

func NewPeriodicSchedule(periodicSchedule *swfapi.PeriodicSchedule) *PeriodicSchedule

NewPeriodicSchedule creates a new PeriodicSchedule.

func (*PeriodicSchedule) GetNextScheduledEpoch

func (s *PeriodicSchedule) GetNextScheduledEpoch(lastJobEpoch *int64,
	defaultStartEpoch int64) int64

GetNextScheduledEpoch returns the next epoch at which a workflow should be scheduled.

func (*PeriodicSchedule) GetNextScheduledEpochNoCatchup

func (s *PeriodicSchedule) GetNextScheduledEpochNoCatchup(
	lastJobEpoch *int64, defaultStartEpoch int64, nowEpoch int64) int64

type ScheduledWorkflow

type ScheduledWorkflow struct {
	*swfapi.ScheduledWorkflow
	// contains filtered or unexported fields
}

ScheduledWorkflow is a type to help manipulate ScheduledWorkflow objects.

func NewScheduledWorkflow

func NewScheduledWorkflow(swf *swfapi.ScheduledWorkflow) *ScheduledWorkflow

NewScheduledWorkflow creates an instance of ScheduledWorkflow.

func (*ScheduledWorkflow) Get

Get converts this object to a swfapi.ScheduledWorkflow.

func (*ScheduledWorkflow) GetNextScheduledEpoch

func (s *ScheduledWorkflow) GetNextScheduledEpoch(activeWorkflowCount int64, nowEpoch int64, location time.Location) (
	nextScheduleEpoch int64, shouldRunNow bool)

GetNextScheduledEpoch returns the next epoch at which a workflow should be scheduled, and whether it should be run now.

func (*ScheduledWorkflow) MinIndex

func (s *ScheduledWorkflow) MinIndex() int64

MinIndex returns the minimum index of the workflow to retrieve as part of the workflow history.

func (*ScheduledWorkflow) NewWorkflow

func (s *ScheduledWorkflow) NewWorkflow(
	nextScheduledEpoch int64, nowEpoch int64) (*commonutil.Workflow, error)

NewWorkflow creates a workflow for this schedule. It also sets the appropriate OwnerReferences on the resource so handleObject can discover the Schedule resource that 'owns' it.

func (*ScheduledWorkflow) NextResourceName

func (s *ScheduledWorkflow) NextResourceName() string

NextResourceName creates a deterministic resource name for the next resource.

func (*ScheduledWorkflow) UpdateStatus

func (s *ScheduledWorkflow) UpdateStatus(updatedEpoch int64, workflow *commonutil.Workflow,
	scheduledEpoch int64, active []swfapi.WorkflowStatus,
	completed []swfapi.WorkflowStatus, location *time.Location)

UpdateStatus updates the status of a workflow in the Kubernetes API server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL