-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Populate WorkflowTask.args
based on defaults in WorkflowTask.task.args_schema
#639
Comments
This requires us to understand the structure of the pydantic-generated schemas (see examples in fractal-analytics-platform/fractal-web#82), so that we can reliably extract defaults, including those for nested objects. When a Task is imported into a Workflow, as a WorkflowTask, its Other than that, the Note: this issue overrides #592 |
Here is a snippet that does part of what is needed (e.g. it does not recognize a from pydantic import BaseModel
from pydantic import Field
from devtools import debug
from typing import Optional
class TaskArguments(BaseModel):
arg1: int = 1
arg2: int = Field(default=1)
arg3: int
arg4: Optional[int] = None
arg5: Optional[int] = Field(default=None)
schema = TaskArguments.schema()
debug(schema)
args = {}
for arg_name, arg_dict in schema["properties"].items():
debug(arg_name, arg_dict)
try:
args[arg_name] = arg_dict["default"]
except KeyError:
pass
debug(args) |
(based on #638)
Ref:
WorkflowTask
arguments fractal-web#127The text was updated successfully, but these errors were encountered: