util

package
v0.0.0-...-4f670de Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ControllerAgentName is the name of the controller.
	ControllerAgentName = "scheduled-workflow-controller"
)
View Source
const (
	IndexExpression = "[[Index]]"
)

Variables

This section is empty.

Functions

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) GetNextScheduledEpoch

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

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

func (*CronSchedule) GetNextScheduledEpochNoCatchup

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

type ParameterFormatter

type ParameterFormatter struct {
	// contains filtered or unexported fields
}

ParameterFormatter is an object that substitutes specific strings in workflow parameters by information about the workflow execution (time at which the workflow was started, time at which the workflow was scheduled, etc.)

func NewParameterFormatter

func NewParameterFormatter(scheduledEpoch int64, nowEpoch int64,
	index int64) *ParameterFormatter

NewParameterFormatter returns a new ParameterFormatter.

func (*ParameterFormatter) Format

func (p *ParameterFormatter) Format(s string) string

Format substitutes special strings in the provided string.

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) (
	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)

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