workflow

package
v0.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchiveWorkflowStepExecutionLogs

func ArchiveWorkflowStepExecutionLogs(ctx context.Context, opts StepExecutionLogOptions) error

ArchiveWorkflowStepExecutionLogs archives workflow step execution logs.

func GetWorkflowStepExecutionLogs

func GetWorkflowStepExecutionLogs(ctx context.Context, opts StepExecutionLogOptions) ([]byte, error)

GetWorkflowStepExecutionLogs gets workflow step execution logs.

func Rerun

func Rerun(
	ctx context.Context,
	mc model.ClientSet,
	restCfg *rest.Config,
	wfe *model.WorkflowExecution,
) error

Rerun reruns the workflow execution to the argo workflow server.

func ResetWorkflowExecutionStatus

func ResetWorkflowExecutionStatus(
	ctx context.Context,
	mc model.ClientSet,
	workflowExecution *model.WorkflowExecution,
) error

ResetWorkflowExecutionStatus resets the workflow execution status to pending.

func Run

Run runs the workflow execution to the argo workflow server.

func StreamWorkflowLogs

func StreamWorkflowLogs(
	ctx context.Context,
	opts LogOptions,
) error

StreamWorkflowLogs streams workflow logs. With selector step-execution-id=stepExecutionID it can filter logs by step name.

func StreamWorkflowStepExecutionLogs

func StreamWorkflowStepExecutionLogs(ctx context.Context, opts StreamWorkflowStepExecutionLogsOptions) error

StreamWorkflowStepExecutionLogs streams workflow step execution logs.

Types

type ArgoAPIClient

type ArgoAPIClient struct {
	apiclient.Client

	Ctx context.Context
}

ArgoAPIClient is a wrapper of argo workflow client. It interacts with argo workflow server.

func NewArgoAPIClient

func NewArgoAPIClient(restCfg *rest.Config) (*ArgoAPIClient, error)

type ArgoWorkflowClient

type ArgoWorkflowClient struct {
	Logger log.Logger
	// contains filtered or unexported fields
}

func (*ArgoWorkflowClient) Delete

func (s *ArgoWorkflowClient) Delete(ctx context.Context, opts DeleteOptions) error

func (*ArgoWorkflowClient) Resubmit

func (s *ArgoWorkflowClient) Resubmit(ctx context.Context, opts ResubmitOptions) error

func (*ArgoWorkflowClient) Resume

func (s *ArgoWorkflowClient) Resume(ctx context.Context, opts ResumeOptions) error

func (*ArgoWorkflowClient) Submit

func (s *ArgoWorkflowClient) Submit(ctx context.Context, opts SubmitOptions) error

type Client

type Client interface {
	// Submit submits a workflow to the workflow engine.
	Submit(context.Context, SubmitOptions) error
	// Resume resumes a workflow step execution of a workflow execution..
	Resume(context.Context, ResumeOptions) error
	// Resubmit resubmits a workflow to the workflow engine.
	Resubmit(context.Context, ResubmitOptions) error
	// Delete deletes a workflow from the workflow engine.
	Delete(context.Context, DeleteOptions) error
}

Client is the interface that defines the operations of workflow engine.

func NewArgoWorkflowClient

func NewArgoWorkflowClient(mc model.ClientSet, restCfg *rest.Config) (Client, error)

type DeleteOptions

type DeleteOptions struct {
	Workflow *model.WorkflowExecution
}

type GetOptions

type GetOptions struct {
	Workflow *model.WorkflowExecution
}

type LogOptions

type LogOptions struct {
	Workflow   string
	PodName    string
	Grep       string
	Selector   string
	ApiClient  apiclient.Client
	LogOptions *corev1.PodLogOptions
	Out        io.Writer
}

LogOptions contains options for workflow logs.

type ResubmitOptions

type ResubmitOptions struct {
	WorkflowExecution *model.WorkflowExecution
}

type ResumeOptions

type ResumeOptions struct {
	// Approve or deny of the workflow approval step execution.
	Approve bool

	// WorkflowExecution is the workflow execution to be resumed.
	WorkflowExecution *model.WorkflowExecution
	// WorkflowStepExecution is the workflow step execution to be resumed.
	WorkflowStepExecution *model.WorkflowStepExecution
}

SubmitOptions is the options for submitting a workflow. WorkflowExecution's Edge WorkflowStageExecutions and their Edge WorkflowStepExecutions must be set.

type StepExecutionLogOptions

type StepExecutionLogOptions struct {
	ModelClient   model.ClientSet
	RestCfg       *rest.Config
	StepExecution *model.WorkflowStepExecution
}

type StreamWorkflowStepExecutionLogsOptions

type StreamWorkflowStepExecutionLogsOptions struct {
	StepExecutionLogOptions

	Out io.Writer
}

type SubmitOptions

type SubmitOptions struct {
	WorkflowExecution *model.WorkflowExecution
	SubjectID         object.ID
}

type SubmitParamsOpts

type SubmitParamsOpts struct {
	WorkflowExecution *model.WorkflowExecution
	Params            map[string]string
}

SubmitParamsOpts is the options for submitting a workflow with parameters.

type TemplateManager

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

TemplateManager is the manager of workflow templates. Manager generate argo workflow definition with model.WorkflowExecution. It generates templates for workflow with workflow, stage and step executions.

func NewTemplateManager

func NewTemplateManager(mc model.ClientSet) *TemplateManager

func (*TemplateManager) GetStageExecutionEnterTemplate

func (t *TemplateManager) GetStageExecutionEnterTemplate(
	stageExecution *model.WorkflowStageExecution,
) *v1alpha1.Template

GetStageExecutionEnterTemplate returns the enter template of a stage execution. The template handler sync the status of the stage execution to "Running".

func (*TemplateManager) GetStageExecutionExitTemplate

func (t *TemplateManager) GetStageExecutionExitTemplate(
	stageExecution *model.WorkflowStageExecution,
) *v1alpha1.Template

GetStageExecutionExitTemplate returns the exit template of a stage execution. The template handler sync the status of the stage execution to "Succeeded" or "Failed".

func (*TemplateManager) GetStageExecutionExtendTemplates

func (t *TemplateManager) GetStageExecutionExtendTemplates(
	ctx context.Context,
	stageExecution *model.WorkflowStageExecution,
) (extendTemplate *v1alpha1.Template, stageTemplates []*v1alpha1.Template, err error)

GetStageExecutionExtendTemplates extends one stage execution to three stage executions, enter template, main template, and exit template and its step templates. The extend templates are used to manager lifecycle of the stage execution.

func (*TemplateManager) GetStageExecutionStatusTemplate

func (t *TemplateManager) GetStageExecutionStatusTemplate(
	name string,
	stageExecution *model.WorkflowStageExecution,
) *v1alpha1.Template

GetStageExecutionStatusTemplate returns the status template of a stage execution. The status template handler sync the status of the stage execution to "Running", "Succeeded" or "Failed".

func (*TemplateManager) GetStageExecutionTemplates

func (t *TemplateManager) GetStageExecutionTemplates(
	ctx context.Context,
	stageExecution *model.WorkflowStageExecution,
) ([]*v1alpha1.Template, error)

GetStageExecutionTemplates extends one stage execution to three stage executions, enter template, main template, and exit template and its step templates.

func (*TemplateManager) GetStepExecutionExtendTemplates

func (t *TemplateManager) GetStepExecutionExtendTemplates(
	ctx context.Context,
	stepExecution *model.WorkflowStepExecution,
) (extendTemplate *v1alpha1.Template, stepTemplates []*v1alpha1.Template, err error)

GetStepExecutionExtendTemplates extends one step execution to three step executions, enter template, main template, exit step template, which are used to update the status of the step execution. The extend templates are used to manager lifecycle of the step execution.

func (*TemplateManager) GetStepExecutionStatusTemplate

func (t *TemplateManager) GetStepExecutionStatusTemplate(
	name string,
	stepExecution *model.WorkflowStepExecution,
) *v1alpha1.Template

GetStepExecutionStatusTemplate returns the status template of a step execution. The status template handler sync the status of the step execution to "Running", "Succeeded" or "Failed".

func (*TemplateManager) GetStepExecutionTemplates

func (t *TemplateManager) GetStepExecutionTemplates(
	ctx context.Context,
	stepExecution *model.WorkflowStepExecution,
) ([]*v1alpha1.Template, error)

GetStepExecutionTemplates extends one step execution to three step executions, enter template, main template, exit step template, which are used to update the status of the step execution.

func (*TemplateManager) GetWorkflowExecutionEnterTemplate

func (t *TemplateManager) GetWorkflowExecutionEnterTemplate(wf *model.WorkflowExecution) *v1alpha1.Template

GetWorkflowExecutionEnterTemplate returns the enter template of a workflow execution.

func (*TemplateManager) GetWorkflowExecutionExitTemplate

func (t *TemplateManager) GetWorkflowExecutionExitTemplate(wf *model.WorkflowExecution) *v1alpha1.Template

getExitTemplate returns template for workflow exit handler.

func (*TemplateManager) GetWorkflowExecutionStatusTemplate

func (t *TemplateManager) GetWorkflowExecutionStatusTemplate(
	name string,
	wf *model.WorkflowExecution,
) *v1alpha1.Template

GetWorkflowExecutionStatusTemplate returns the status template of a workflow execution. The status template handler sync the status of the workflow execution to "Running", "Succeeded" or "Failed". It will be called with the lifecycle hook of the stage execution.

func (*TemplateManager) GetWorkflowExecutionTemplates

func (t *TemplateManager) GetWorkflowExecutionTemplates(
	ctx context.Context,
	stageExecutions model.WorkflowStageExecutions,
) ([]*v1alpha1.Template, error)

GetWorkflowExecutionTemplates get workflow execution templates.

func (*TemplateManager) ToArgoWorkflow

func (t *TemplateManager) ToArgoWorkflow(
	ctx context.Context,
	workflowExecution *model.WorkflowExecution,
	token string,
) (*v1alpha1.Workflow, error)

ToArgoWorkflow returns an argo workflow for a workflow execution. The workflow execution MUST contains edges of stage and step executions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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