Skip to content

Commit

Permalink
sync api requests and schema
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Oct 12, 2023
1 parent 17efe27 commit 01d6668
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features
- Initial release of the owe-python-sdk. Used in both the workflow engine and Tapis Workflows API
- Added 'params' to Pipeline model - tasks can consume params as inputs
- Added 'args' to Pipeline model - tasks can consume args as inputs
- **Function Tasks**
- Added ability to specify git repositories to clone into the function runtime
- Introduced custom entrypoints
Expand Down
22 changes: 11 additions & 11 deletions src/api/src/backend/views/http/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class EnumTaskIOTypes(str, Enum, metaclass=_EnumMeta):
TapisFileInput = "tapis_file_input"
TapisFileInputArray = "tapis_file_input_array"

LiteralTaskInputValueFromKeys = Literal["env", "params", "task_output"]
LiteralTaskInputValueFromKeys = Literal["env", "args", "task_output"]
TaskInputValueFromKeys = list(get_args(LiteralTaskInputValueFromKeys))
class EnumTaskInputValueFromKey(str, Enum, metaclass=_EnumMeta):
Env = "env"
Params = "params"
Args = "args"
TaskOutput = "task_output"

LiteralTaskFlavors = Literal["c1tiny", "c1xxsml", "c1xsml", "c1sml", "c1med", "c1lrg", "c1xlrg", "c1xxlrg", "g1nvdsml", "g1nvdmed", "g1nvdlrg"]
Expand Down Expand Up @@ -196,13 +196,13 @@ class ValueFromSecretRef(BaseModel):
field_selector: str = None

ValueFromEnv = Dict[Literal["env"], str]
ValueFromParams = Dict[Literal["params"], str]
ValueFromArgs = Dict[Literal["args"], str]
ValueFromTaskOutput = Dict[Literal["task_output"], TaskOutputRef]
ValueFromHost = Dict[Literal["host"], ValueFromHostRef]
ValueFromSecret = Dict[Literal["secret"], ValueFromSecretRef]
ValueFromAll = Union[
ValueFromEnv,
ValueFromParams,
ValueFromArgs,
ValueFromTaskOutput,
ValueFromHost,
ValueFromSecret
Expand All @@ -214,8 +214,8 @@ class ValueFromSecretRef(BaseModel):
]

# NOTE Same as EnvSpecValueFrom for now, but may diverge. Delete this NOTE once it does
# Also, no good name for the combination of the 2. EnvParamSpecValueFrom?? No thanks.
ParamSpecValueFrom = Union[
# Also, no good name for the combination of the 2. EnvArgSpecValueFrom?? No thanks.
ArgSpecValueFrom = Union[
ValueFromSecret,
ValueFromHost
]
Expand Down Expand Up @@ -263,14 +263,14 @@ def value_from_type_validation(cls, value):
(
type(k) == str
and (
(k in ["env", "params"] and type(value[k]) == str)
(k in ["env", "args"] and type(value[k]) == str)
or (k in ["task_output", "secret", "host"] and type(value[k]) == dict)
)
)
)]) < 1
if (not is_dict or (is_dict and is_valid)):
raise TypeError(
"Task Input Value Error: 'value_from' property must be a single key-value pair where the key is oneOf ['env', 'params', 'task_input', 'host', 'secret'] and the value is a non-empty string if key is oneOf ['env', 'params'] or an object if key is oneOf ['task_input', 'host', 'secret']"
"Task Input Value Error: 'value_from' property must be a single key-value pair where the key is oneOf ['env', 'args', 'task_input', 'host', 'secret'] and the value is a non-empty string if key is oneOf ['env', 'args'] or an object if key is oneOf ['task_input', 'host', 'secret']"
)
return value

Expand All @@ -287,7 +287,7 @@ class EnvSpec(SpecWithValue):

class ArgSpec(SpecWithValue):
value: Value = None
value_from: ParamSpecValueFrom = None
value_from: ArgSpecValueFrom = None

Args = Dict[str, ArgSpec]

Expand Down Expand Up @@ -682,7 +682,7 @@ class Pipeline(BaseModel):
# Previous pipelines did not have environments or parmas
@root_validator(pre=True)
def backwards_compatibility_transforms(cls, values):
props_to_transfom = ["env", "params"]
props_to_transfom = ["env", "args"]
for prop in props_to_transfom:
if values.get(prop, None) == None:
values[prop] = {}
Expand Down Expand Up @@ -770,7 +770,7 @@ class Config:
# Previous workflow submissions did not have environments or parmas
@root_validator(pre=True)
def backwards_compatibility_transforms(cls, values):
props_to_transfom = ["env", "params"]
props_to_transfom = ["env", "args"]
for prop in props_to_transfom:
if values.get(prop, None) == None:
values[prop] = {}
Expand Down
3 changes: 0 additions & 3 deletions src/engine/src/core/Server.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,4 @@ def _resolve_idempotency_key(self, request):
logger.info(f"{lbuf('[SERVER]')} ERROR: Failed to resolve idempotency key from provided constraints. {str(e)}. Defaulted to pipeline id '{default_idempotency_key}'")
return default_idempotency_key





22 changes: 11 additions & 11 deletions src/engine/src/owe_python_sdk/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class EnumTaskIOTypes(str, Enum, metaclass=_EnumMeta):
TapisFileInput = "tapis_file_input"
TapisFileInputArray = "tapis_file_input_array"

LiteralTaskInputValueFromKeys = Literal["env", "params", "task_output"]
LiteralTaskInputValueFromKeys = Literal["env", "args", "task_output"]
TaskInputValueFromKeys = list(get_args(LiteralTaskInputValueFromKeys))
class EnumTaskInputValueFromKey(str, Enum, metaclass=_EnumMeta):
Env = "env"
Params = "params"
Args = "args"
TaskOutput = "task_output"

LiteralTaskFlavors = Literal["c1tiny", "c1xxsml", "c1xsml", "c1sml", "c1med", "c1lrg", "c1xlrg", "c1xxlrg", "g1nvdsml", "g1nvdmed", "g1nvdlrg"]
Expand Down Expand Up @@ -196,13 +196,13 @@ class ValueFromSecretRef(BaseModel):
field_selector: str = None

ValueFromEnv = Dict[Literal["env"], str]
ValueFromParams = Dict[Literal["params"], str]
ValueFromArgs = Dict[Literal["args"], str]
ValueFromTaskOutput = Dict[Literal["task_output"], TaskOutputRef]
ValueFromHost = Dict[Literal["host"], ValueFromHostRef]
ValueFromSecret = Dict[Literal["secret"], ValueFromSecretRef]
ValueFromAll = Union[
ValueFromEnv,
ValueFromParams,
ValueFromArgs,
ValueFromTaskOutput,
ValueFromHost,
ValueFromSecret
Expand All @@ -214,8 +214,8 @@ class ValueFromSecretRef(BaseModel):
]

# NOTE Same as EnvSpecValueFrom for now, but may diverge. Delete this NOTE once it does
# Also, no good name for the combination of the 2. EnvParamSpecValueFrom?? No thanks.
ParamSpecValueFrom = Union[
# Also, no good name for the combination of the 2. EnvArgSpecValueFrom?? No thanks.
ArgSpecValueFrom = Union[
ValueFromSecret,
ValueFromHost
]
Expand Down Expand Up @@ -263,14 +263,14 @@ def value_from_type_validation(cls, value):
(
type(k) == str
and (
(k in ["env", "params"] and type(value[k]) == str)
(k in ["env", "args"] and type(value[k]) == str)
or (k in ["task_output", "secret", "host"] and type(value[k]) == dict)
)
)
)]) < 1
if (not is_dict or (is_dict and is_valid)):
raise TypeError(
"Task Input Value Error: 'value_from' property must be a single key-value pair where the key is oneOf ['env', 'params', 'task_input', 'host', 'secret'] and the value is a non-empty string if key is oneOf ['env', 'params'] or an object if key is oneOf ['task_input', 'host', 'secret']"
"Task Input Value Error: 'value_from' property must be a single key-value pair where the key is oneOf ['env', 'args', 'task_input', 'host', 'secret'] and the value is a non-empty string if key is oneOf ['env', 'args'] or an object if key is oneOf ['task_input', 'host', 'secret']"
)
return value

Expand All @@ -287,7 +287,7 @@ class EnvSpec(SpecWithValue):

class ArgSpec(SpecWithValue):
value: Value = None
value_from: ParamSpecValueFrom = None
value_from: ArgSpecValueFrom = None

Args = Dict[str, ArgSpec]

Expand Down Expand Up @@ -682,7 +682,7 @@ class Pipeline(BaseModel):
# Previous pipelines did not have environments or parmas
@root_validator(pre=True)
def backwards_compatibility_transforms(cls, values):
props_to_transfom = ["env", "params"]
props_to_transfom = ["env", "args"]
for prop in props_to_transfom:
if values.get(prop, None) == None:
values[prop] = {}
Expand Down Expand Up @@ -770,7 +770,7 @@ class Config:
# Previous workflow submissions did not have environments or parmas
@root_validator(pre=True)
def backwards_compatibility_transforms(cls, values):
props_to_transfom = ["env", "params"]
props_to_transfom = ["env", "args"]
for prop in props_to_transfom:
if values.get(prop, None) == None:
values[prop] = {}
Expand Down

0 comments on commit 01d6668

Please sign in to comment.