-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support Enum
task arguments
#745
Comments
Here is the case that I'd want to use it for: 3 of the inputs should be Enums:
But those currently fail to build a correct manifest and the error is:
|
With #749, I am making the tools for generating JSON Schemas a bit more flexible, so that they they are easier to play with. class ColorA(Enum):
RED = "this-is-red"
GREEN = "this-is-green"
ColorB = Enum(
"ColorB",
{"RED": "this-is-red", "GREEN": "this-is-green"},
type=str,
)
@validate_arguments
def task_function(
arg_A: ColorA,
arg_B: ColorB,
):
"""
Short task description
Args:
arg_A: Description of arg_A.
arg_B: Description of arg_B.
"""
pass
def test_enum_argument():
"""
This test only asserts that `create_schema_for_single_task` runs
successfully. Its goal is also to offer a quick way to experiment
with new task arguments and play with the generated JSON Schema,
without re-building the whole fractal-tasks-core manifest.
"""
schema = create_schema_for_single_task(
task_function=task_function,
executable=__file__,
package=None,
verbose=True,
)
debug(schema)
print(json.dumps(schema, indent=2)) After a fix for supporting |
This is in principle fixed with #749, but I want to make sure it doesn't break manifest-creation flow for other packages. |
This is super neat, looking forward to it! :) |
That's awesome! Let's bundle some other PRs into the next release for 1.1.0 :) Also in view of making sure Fractal web is ready for it & deployed before those task schemas come in |
I've started to test this in https://github.com/fractal-analytics-platform/fractal-tasks-core/blob/test-enum-argument/tests/dev/test_enum_arguments.py. Note that -depending on the final args-schema- this may also require additional work in fractal-web.
Ref:
enum
support withindefinitions
fractal-web#503The text was updated successfully, but these errors were encountered: