Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions flytekit/models/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ def from_flyte_idl(cls, pb2_object: flyteidl.admin.execution_pb2.SystemMetadata)

class ExecutionMetadata(_common_models.FlyteIdlEntity):
class ExecutionMode(object):
MANUAL = 0
SCHEDULED = 1
SYSTEM = 2
MANUAL = _execution_pb2.ExecutionMetadata.MANUAL
SCHEDULED = _execution_pb2.ExecutionMetadata.SCHEDULED
SYSTEM = _execution_pb2.ExecutionMetadata.SYSTEM
RELAUNCH = _execution_pb2.ExecutionMetadata.RELAUNCH
CHILD_WORKFLOW = _execution_pb2.ExecutionMetadata.CHILD_WORKFLOW
RECOVERED = _execution_pb2.ExecutionMetadata.RECOVERED
TRIGGER = _execution_pb2.ExecutionMetadata.TRIGGER

def __init__(
self,
Expand Down
6 changes: 6 additions & 0 deletions tests/flytekit/unit/models/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from datetime import timezone

import pytest
from flyteidl.admin import execution_pb2 as _execution_pb2

from flytekit.models import common as _common_models
from flytekit.models import execution as _execution
Expand Down Expand Up @@ -149,6 +150,11 @@ def test_execution_metadata():
assert obj2.system_metadata == system_metadata


@pytest.mark.parametrize("name, value", _execution_pb2.ExecutionMetadata.ExecutionMode.items())
def test_execution_mode_matches_idl(name: str, value: int) -> None:
assert getattr(_execution.ExecutionMetadata.ExecutionMode, name) == value


@pytest.mark.parametrize("literal_value_pair", _parameterizers.LIST_OF_SCALAR_LITERALS_AND_PYTHON_VALUE)
def test_execution_spec(literal_value_pair):
literal_value, _ = literal_value_pair
Expand Down
Loading