Skip to content

Commit

Permalink
allow either code or entrypoint on function tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Oct 18, 2023
1 parent 004f850 commit 39f2622
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/api/src/backend/views/http/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,16 @@ class FunctionTask(BaseTask):
runtime: EnumRuntimeEnvironment
packages: List[str] = []
installer: EnumInstaller
code: str
code: str = None
entrypoint: str = None
command: str = None

@root_validator(pre=True)
def code_or_entrypoint(cls, values):
if values.get("code", None) == None and values.get("entrypoint", None) == None:
raise ValueError("Function tasks must define at least one of the following: [code, entrypoint] | Neither were defined")

return values
# Pipelines

Task = Annotated[
Expand Down Expand Up @@ -696,6 +703,7 @@ def backwards_compatibility_transforms(cls, values):
}

return values

class Config:
extra = Extra.allow

Expand Down
10 changes: 9 additions & 1 deletion src/engine/src/owe_python_sdk/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,16 @@ class FunctionTask(BaseTask):
runtime: EnumRuntimeEnvironment
packages: List[str] = []
installer: EnumInstaller
code: str
code: str = None
entrypoint: str = None
command: str = None

@root_validator(pre=True)
def code_or_entrypoint(cls, values):
if values.get("code", None) == None and values.get("entrypoint", None) == None:
raise ValueError("Function tasks must define at least one of the following: [code, entrypoint] | Neither were defined")

return values
# Pipelines

Task = Annotated[
Expand Down Expand Up @@ -696,6 +703,7 @@ def backwards_compatibility_transforms(cls, values):
}

return values

class Config:
extra = Extra.allow

Expand Down

0 comments on commit 39f2622

Please sign in to comment.