This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
/
launchplan.go
46 lines (36 loc) · 1.61 KB
/
launchplan.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package launchplan
import (
"context"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
)
//go:generate mockery -all -case=underscore
// A simple context that is used to start an execution of a LaunchPlan. It encapsulates enough parent information
// to tie the executions
type LaunchContext struct {
// Nesting level of the current workflow (parent)
NestingLevel uint32
// Principal of the current workflow, so that billing can be tied correctly
Principal string
// If a node launched the execution, this specifies which node execution
ParentNodeExecution *core.NodeExecutionIdentifier
}
// Interface to be implemented by the remote system that can allow workflow launching capabilities
type Executor interface {
// Start an execution of a launchplan
Launch(ctx context.Context, launchCtx LaunchContext, executionID *core.WorkflowExecutionIdentifier, launchPlanRef *core.Identifier, inputs *core.LiteralMap) error
// Retrieve status of a LaunchPlan execution
GetStatus(ctx context.Context, executionID *core.WorkflowExecutionIdentifier) (*admin.ExecutionClosure, error)
// Kill a remote execution
Kill(ctx context.Context, executionID *core.WorkflowExecutionIdentifier, reason string) error
// Initializes Executor.
Initialize(ctx context.Context) error
}
type Reader interface {
// Get the definition of a launch plan. This is primarily used to ensure all the TypedInterfaces match up before actually executing.
GetLaunchPlan(ctx context.Context, launchPlanRef *core.Identifier) (*admin.LaunchPlan, error)
}
type FlyteAdmin interface {
Executor
Reader
}