-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow on failure policy support (#237)
* Add workflow on failure policy support Signed-off-by: Andres Gomez Ferrer <[email protected]> * Fix unit test Signed-off-by: Andres Gomez Ferrer <[email protected]> * Add SdkWorkflowMetadata Signed-off-by: Andres Gomez Ferrer <[email protected]> * Configure FAIL_IMMEDIATELY default in the builder Signed-off-by: Andres Gomez Ferrer <[email protected]> --------- Signed-off-by: Andres Gomez Ferrer <[email protected]>
- Loading branch information
1 parent
0c9ba51
commit 62ef63a
Showing
7 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
flytekit-api/src/main/java/org/flyte/api/v1/OnFailurePolicy.java
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,41 @@ | ||
/* | ||
* Copyright 2021 Flyte Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.flyte.api.v1; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
/** Failure Handling Strategy. */ | ||
@AutoValue | ||
public abstract class OnFailurePolicy { | ||
public enum Kind { | ||
FAIL_IMMEDIATELY, | ||
FAIL_AFTER_EXECUTABLE_NODES_COMPLETE | ||
} | ||
|
||
public abstract Kind getKind(); | ||
|
||
public static OnFailurePolicy.Builder builder() { | ||
return new AutoValue_OnFailurePolicy.Builder(); | ||
} | ||
|
||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
public abstract Builder kind(Kind kind); | ||
|
||
public abstract OnFailurePolicy build(); | ||
} | ||
} |
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
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
40 changes: 40 additions & 0 deletions
40
flytekit-java/src/main/java/org/flyte/flytekit/SdkWorkflowMetadata.java
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,40 @@ | ||
/* | ||
* Copyright 2021 Flyte Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.flyte.flytekit; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import org.flyte.api.v1.OnFailurePolicy; | ||
|
||
/** Metadata for the entire workflow. */ | ||
@AutoValue | ||
public abstract class SdkWorkflowMetadata { | ||
|
||
public abstract OnFailurePolicy onFailure(); | ||
|
||
public static Builder builder() { | ||
return new AutoValue_SdkWorkflowMetadata.Builder() | ||
.onFailure(OnFailurePolicy.builder().kind(OnFailurePolicy.Kind.FAIL_IMMEDIATELY).build()); | ||
} | ||
|
||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
|
||
public abstract Builder onFailure(OnFailurePolicy onFailure); | ||
|
||
public abstract SdkWorkflowMetadata build(); | ||
} | ||
} |
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
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
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