populse / capsul

Collaborative Analysis Platform : Simple, Unifying, Lean
Other
7 stars 14 forks source link

[v3] CapsulWorkflow generation doesn't work for [Fake]Morphologist #242

Closed denisri closed 1 year ago

denisri commented 2 years ago

While instantiating the workflow for the Morphologist or FakeMorphologist pipeline, I get:

Traceback (most recent call last):
  File "/casa/host/src/capsul/capsul/test/test_fake_morphologist.py", line 1103, in test_path_generation
    status = engine.run(morphologist)
  File "/casa/host/src/capsul/capsul/engine/__init__.py", line 120, in run
    execution_id = self.start(executable, **kwargs)
  File "/casa/host/src/capsul/capsul/engine/local.py", line 25, in start
    workflow = CapsulWorkflow(executable)
  File "/casa/host/src/capsul/capsul/execution_context.py", line 179, in __init__
    job_parameters = self._create_jobs(
  File "/casa/host/src/capsul/capsul/execution_context.py", line 253, in _create_jobs
    job_parameters = self._create_jobs(
  File "/casa/host/src/capsul/capsul/execution_context.py", line 278, in _create_jobs
    process_chronology.setdefault(dest_node.uuid, set()).add(process.uuid)
  File "/casa/host/build/python/soma/controller/controller.py", line 453, in __getattribute__
    result = super().__getattribute__(name)
AttributeError: 'Switch' object has no attribute 'uuid'

to reproduce it:

from capsul.api import executable
from capsul.execution_context import CapsulWorkflow

m2 = executable('capsul.pipeline.test.fake_morphologist.morphologist')
wf = CapsulWorkflow(tm)
denisri commented 2 years ago

In execution_context.py, CapsulWorkflow._create_jobs(), currently lines 275-278, I read:

                if field.is_output():
                    for dest_node_name, dest_plug_name, dest_node, dest_plug, is_weak in process.plugs[field.name].links_to:
                        if dest_node.activated and dest_node not in disabled_nodes and not dest_node.field(dest_plug_name).is_output():
                            process_chronology.setdefault(dest_node.uuid, set()).add(process.uuid)

Here, dest_node is a Switch, and switches are not represented in workflows. It is not tested here. But we should use a more generic function to go through switches (and possibly other kinds of custom nodes?) rather than having to test isinstance(dest_node, Switch) at each use, and then here I guess we have to follow links through the switch and "reconnect" nodes downstream to it ?

denisri commented 2 years ago

I add this in this ticket, because it concerns workflow generation too, but it's probably a different problem:

Workflow creation for an iteration over TinyMorphologist also doesn't work, it produces this error:

Traceback (most recent call last):
  File "/casa/host/src/capsul/capsul/test/test_tiny_morphologist.py", line 763, in test_pipeline_iteration
    status = engine.run(tiny_morphologist_iteration)
  File "/casa/host/src/capsul/capsul/engine/__init__.py", line 120, in run
    execution_id = self.start(executable, **kwargs)
  File "/casa/host/src/capsul/capsul/engine/local.py", line 25, in start
    workflow = CapsulWorkflow(executable)
  File "/casa/host/src/capsul/capsul/execution_context.py", line 179, in __init__
    job_parameters = self._create_jobs(
  File "/casa/host/src/capsul/capsul/execution_context.py", line 312, in _create_jobs
    job_parameters = self._create_jobs(
  File "/casa/host/src/capsul/capsul/execution_context.py", line 266, in _create_jobs
    for dest_node, plug_name in executable.get_linked_items(process,
  File "/casa/host/build/python/soma/controller/controller.py", line 453, in __getattribute__
    result = super().__getattribute__(name)
AttributeError: 'ProcessIteration' object has no attribute 'get_linked_items'

To reproduce it, uncomment the run code at the end of test_tiny_morphologist.py (lines 760-771)