Hi, some processing workflows may not include an output node because they focus on intermediate results rather than a final output or save the output to the disk.
For example:
workflow.json
{
"version": "0.1.0",
"nodes": [
{"id": 0, "type": "function", "value": "workflow.save_image"},
{"id": 1, "type": "input", "value": "image.png", "name": "x"},
],
"edges": [
{"target": 0, "targetPort": "x", "source": 1, "sourcePort": null},
]
}
workflow.py
def save_image(x):
imsave(x)
when I use following code to run a workflow
from python_workflow_definition.pyiron_base import load_workflow_json
delayed_object_lst = load_workflow_json(file_name='workflow.json')
delayed_object_lst[-1].pull()
In load_workflow_json function, the remove_result was called
|
def load_workflow_json(file_name: str, project: Optional[Project] = None): |
|
if project is None: |
|
project = Project(".") |
|
|
|
content = remove_result( |
|
workflow_dict=PythonWorkflowDefinitionWorkflow.load_json_file( |
|
file_name=file_name |
|
) |
|
) |
If there are zero output nodes, the list comprehension returns [], and [][0] raises IndexError at Line111.
|
def remove_result(workflow_dict): |
|
node_output_id = [ |
|
n["id"] for n in workflow_dict[NODES_LABEL] if n["type"] == "output" |
|
][0] |
Hi, some processing workflows may not include an output node because they focus on intermediate results rather than a final output or save the output to the disk.
For example:
workflow.json
{ "version": "0.1.0", "nodes": [ {"id": 0, "type": "function", "value": "workflow.save_image"}, {"id": 1, "type": "input", "value": "image.png", "name": "x"}, ], "edges": [ {"target": 0, "targetPort": "x", "source": 1, "sourcePort": null}, ] }workflow.py
when I use following code to run a workflow
In
load_workflow_jsonfunction, theremove_resultwas calledpython-workflow-definition/src/python_workflow_definition/pyiron_base.py
Lines 231 to 239 in 31a4a56
If there are zero output nodes, the list comprehension returns [], and [][0] raises IndexError at Line111.
python-workflow-definition/src/python_workflow_definition/shared.py
Lines 108 to 111 in 31a4a56