forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for GateNode with signal and sleep condition (flyteorg#436)
* Update flyteidl version Signed-off-by: Flyte-Bot <[email protected]> * Update flyteidl version Signed-off-by: Flyte-Bot <[email protected]> * Fix build break Signed-off-by: Haytham Abuelfutuh <[email protected]> * Update flyteidl version Signed-off-by: Flyte-Bot <[email protected]> * added GateNode to compiler Signed-off-by: Daniel Rammer <[email protected]> * added gate node handler Signed-off-by: Daniel Rammer <[email protected]> * enable reading and setting gate node state Signed-off-by: Daniel Rammer <[email protected]> * gate nodes working Signed-off-by: Daniel Rammer <[email protected]> * changed Conditional to Condition in proto naming Signed-off-by: Daniel Rammer <[email protected]> * passing admin client to gate node handler Signed-off-by: Daniel Rammer <[email protected]> * using signal service client to check for signal in admin and write output Signed-off-by: Daniel Rammer <[email protected]> * updated comments Signed-off-by: Daniel Rammer <[email protected]> * completed implementation Signed-off-by: Daniel Rammer <[email protected]> * added unit tests for gate node Signed-off-by: Daniel Rammer <[email protected]> * fixed unit tests with missing signal mocks Signed-off-by: Daniel Rammer <[email protected]> * added docs on gate node handler Signed-off-by: Daniel Rammer <[email protected]> * fixed lint issues Signed-off-by: Daniel Rammer <[email protected]> * updating flyteidl dependency Signed-off-by: Daniel Rammer <[email protected]> * fixed lint issue Signed-off-by: Daniel Rammer <[email protected]> * added output variable name to signal condition Signed-off-by: Daniel Rammer <[email protected]> * using last attempt started at timestamp on node context rather than tracking in gate node status Signed-off-by: Daniel Rammer <[email protected]> * updated GateNodeStatus mocks Signed-off-by: Daniel Rammer <[email protected]> * fixed lint issue Signed-off-by: Daniel Rammer <[email protected]> * fixed unit tests Signed-off-by: Daniel Rammer <[email protected]> * updated flyteidl deps Signed-off-by: Daniel Rammer <[email protected]> * update flyteidl deps Signed-off-by: Daniel Rammer <[email protected]> * added interface validation for approve condition Signed-off-by: Daniel Rammer <[email protected]> * added approve condition unit tests Signed-off-by: Daniel Rammer <[email protected]> * fixed missed merge conflict updating to slice of dial options Signed-off-by: Daniel Rammer <[email protected]> * update generated mocks Signed-off-by: Dan Rammer <[email protected]> Signed-off-by: Flyte-Bot <[email protected]> Signed-off-by: Haytham Abuelfutuh <[email protected]> Signed-off-by: Daniel Rammer <[email protected]> Signed-off-by: Dan Rammer <[email protected]> Co-authored-by: flyte-bot <[email protected]> Co-authored-by: Haytham Abuelfutuh <[email protected]>
- Loading branch information
1 parent
ca7c744
commit bf00d9f
Showing
42 changed files
with
1,876 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
flytepropeller/cmd/kubectl-flyte/cmd/testdata/gate-node-approve.yaml.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
workflow: | ||
id: | ||
name: workflow-id-123 | ||
domain: development | ||
project: flytesnacks | ||
interface: | ||
inputs: | ||
variables: | ||
x: | ||
type: | ||
simple: INTEGER | ||
"y": | ||
type: | ||
collectionType: | ||
simple: STRING | ||
nodes: | ||
- id: node-1 | ||
gateNode: | ||
approve: | ||
signalId: foo |
16 changes: 16 additions & 0 deletions
16
flytepropeller/cmd/kubectl-flyte/cmd/testdata/gate-node-signal.yaml.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
workflow: | ||
id: | ||
name: workflow-id-123 | ||
domain: development | ||
project: flytesnacks | ||
interface: | ||
inputs: | ||
variables: {} | ||
nodes: | ||
- id: node-1 | ||
gateNode: | ||
signal: | ||
signalId: foo | ||
type: | ||
simple: BOOLEAN | ||
outputVariableName: o0 |
13 changes: 13 additions & 0 deletions
13
flytepropeller/cmd/kubectl-flyte/cmd/testdata/gate-node-sleep.yaml.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
workflow: | ||
id: | ||
name: workflow-id-123 | ||
domain: development | ||
project: flytesnacks | ||
interface: | ||
inputs: | ||
variables: {} | ||
nodes: | ||
- id: node-1 | ||
gateNode: | ||
sleep: | ||
duration: 10s |
10 changes: 10 additions & 0 deletions
10
flytepropeller/cmd/kubectl-flyte/cmd/testdata/launchplan.yaml.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
workflow: | ||
id: | ||
name: missing-launchplan | ||
nodes: | ||
- id: node-1 | ||
workflowNode: | ||
launchplanRef: | ||
project: foo | ||
domain: bar | ||
name: baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"bytes" | ||
|
||
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" | ||
"github.com/golang/protobuf/jsonpb" | ||
) | ||
|
||
type ConditionKind string | ||
|
||
func (n ConditionKind) String() string { | ||
return string(n) | ||
} | ||
|
||
const ( | ||
ConditionKindApprove ConditionKind = "approve" | ||
ConditionKindSignal ConditionKind = "signal" | ||
ConditionKindSleep ConditionKind = "sleep" | ||
) | ||
|
||
type ApproveCondition struct { | ||
*core.ApproveCondition | ||
} | ||
|
||
func (in ApproveCondition) MarshalJSON() ([]byte, error) { | ||
if in.ApproveCondition == nil { | ||
return nilJSON, nil | ||
} | ||
|
||
var buf bytes.Buffer | ||
if err := marshaler.Marshal(&buf, in.ApproveCondition); err != nil { | ||
return nil, err | ||
} | ||
return buf.Bytes(), nil | ||
} | ||
|
||
func (in *ApproveCondition) UnmarshalJSON(b []byte) error { | ||
in.ApproveCondition = &core.ApproveCondition{} | ||
return jsonpb.Unmarshal(bytes.NewReader(b), in.ApproveCondition) | ||
} | ||
|
||
type SignalCondition struct { | ||
*core.SignalCondition | ||
} | ||
|
||
func (in SignalCondition) MarshalJSON() ([]byte, error) { | ||
if in.SignalCondition == nil { | ||
return nilJSON, nil | ||
} | ||
|
||
var buf bytes.Buffer | ||
if err := marshaler.Marshal(&buf, in.SignalCondition); err != nil { | ||
return nil, err | ||
} | ||
return buf.Bytes(), nil | ||
} | ||
|
||
func (in *SignalCondition) UnmarshalJSON(b []byte) error { | ||
in.SignalCondition = &core.SignalCondition{} | ||
return jsonpb.Unmarshal(bytes.NewReader(b), in.SignalCondition) | ||
} | ||
|
||
type SleepCondition struct { | ||
*core.SleepCondition | ||
} | ||
|
||
func (in SleepCondition) MarshalJSON() ([]byte, error) { | ||
if in.SleepCondition == nil { | ||
return nilJSON, nil | ||
} | ||
|
||
var buf bytes.Buffer | ||
if err := marshaler.Marshal(&buf, in.SleepCondition); err != nil { | ||
return nil, err | ||
} | ||
return buf.Bytes(), nil | ||
} | ||
|
||
func (in *SleepCondition) UnmarshalJSON(b []byte) error { | ||
in.SleepCondition = &core.SleepCondition{} | ||
return jsonpb.Unmarshal(bytes.NewReader(b), in.SleepCondition) | ||
} | ||
|
||
type GateNodeSpec struct { | ||
Kind ConditionKind `json:"kind"` | ||
Approve *ApproveCondition `json:"approve,omitempty"` | ||
Signal *SignalCondition `json:"signal,omitempty"` | ||
Sleep *SleepCondition `json:"sleep,omitempty"` | ||
} | ||
|
||
func (g *GateNodeSpec) GetKind() ConditionKind { | ||
return g.Kind | ||
} | ||
|
||
func (g *GateNodeSpec) GetApprove() *core.ApproveCondition { | ||
return g.Approve.ApproveCondition | ||
} | ||
|
||
func (g *GateNodeSpec) GetSignal() *core.SignalCondition { | ||
return g.Signal.SignalCondition | ||
} | ||
|
||
func (g *GateNodeSpec) GetSleep() *core.SleepCondition { | ||
return g.Sleep.SleepCondition | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.