-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I am facing issues when trying to return a tuple or an object, to return multiple value for a step, which is quite a common practice
- When trying to return a tuple:
@is_fairstep(label='Load data', is_script_task=True)
def load_data():
data, y = load_iris(return_X_y=True, as_frame=True)
return data, y
@is_fairworkflow(label='My model training workflow')
def training_workflow(n_jobs: int):
data, y = load_data()
I am getting this error:
Traceback (most recent call last):
File "python3.9/site-packages/fairworkflows/fairworkflow.py", line 502, in _validate_decorated_function
result = func(*empty_args)
File "my-model/src/my_model/train.py", line 83, in training_workflow
data, y = load_data()
File "python3.9/site-packages/noodles/interface/decorator.py", line 276, in __iter__
raise TypeError(
TypeError: You have tried to iterate (or unpack) a PromisedObject. There is currently no possible way to learn the length of a PromisedObject so, sadly, this is not implemented. You may use the `noodles.unpack` function to unpack a promised tuple.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "my-model/src/my_model/train.py", line 75, in <module>
def training_workflow(n_jobs: int):
File "python3.9/site-packages/fairworkflows/fairworkflow.py", line 482, in _modify_function
_validate_decorated_function(func, empty_args)
File "python3.9/site-packages/fairworkflows/fairworkflow.py", line 504, in _validate_decorated_function
raise TypeError("Marking the function as workflow with `is_fairworkflow` decorator "
TypeError: Marking the function as workflow with `is_fairworkflow` decorator failed. Did you use the is_fairstep decorator on all the steps? Detailed error message: You have tried to iterate (or unpack) a PromisedObject. There is currently no possible way to learn the length of a PromisedObject so, sadly, this is not implemented. You may use the `noodles.unpack` function to unpack a promised tuple.
- If I try to use
noodle.unpack
:
from noodles import unpack
@is_fairstep(label='Load data', is_script_task=True)
def load_data():
data, y = load_iris(return_X_y=True, as_frame=True)
return data, y
@is_fairworkflow(label='My model training workflow')
def training_workflow(n_jobs: int):
data, y = unpack(load_data(), 2)
I am getting this error:
Traceback (most recent call last):
File "my-model/src/my_model/train.py", line 76, in <module>
def training_workflow(n_jobs: int):
File "python3.9/site-packages/fairworkflows/fairworkflow.py", line 487, in _modify_function
workflow_level_promise._fairworkflow = FairWorkflow.from_noodles_promise(
File "python3.9/site-packages/fairworkflows/fairworkflow.py", line 107, in from_noodles_promise
steps_dict = {i: n.foo._fairstep for i, n in workflow.nodes.items()}
File "python3.9/site-packages/fairworkflows/fairworkflow.py", line 107, in <dictcomp>
steps_dict = {i: n.foo._fairstep for i, n in workflow.nodes.items()}
AttributeError: 'function' object has no attribute '_fairstep'
- When trying to return an object:
@is_fairstep(label='Load data', is_script_task=True)
def load_data():
data, y = load_iris(return_X_y=True, as_frame=True)
return {
"data": data,
"y": y
}
I am getting the following error:
Traceback (most recent call last):
File "my-model/src/my_model/train.py", line 75, in <module>
def training_workflow(n_jobs: int):
File "python3.9/site-packages/fairworkflows/fairworkflow.py", line 487, in _modify_function
workflow_level_promise._fairworkflow = FairWorkflow.from_noodles_promise(
File "python3.9/site-packages/fairworkflows/fairworkflow.py", line 107, in from_noodles_promise
steps_dict = {i: n.foo._fairstep for i, n in workflow.nodes.items()}
File "python3.9/site-packages/fairworkflows/fairworkflow.py", line 107, in <dictcomp>
steps_dict = {i: n.foo._fairstep for i, n in workflow.nodes.items()}
AttributeError: 'function' object has no attribute '_fairstep'
@raar1 what would be the recommended to pass multiple objects in a fairstep return statement?
Metadata
Metadata
Assignees
Labels
No labels