Skip to content
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

cwltool --print-dot fails with python 3.8 (or newer) due pydot version 3.0.0 (or newer) #2027

Open
jmfernandez opened this issue Jul 28, 2024 · 0 comments

Comments

@jmfernandez
Copy link
Contributor

I have found a reproducibility issue with cwltool --print-dot command line, which depends on the python version used.

Expected Behavior

If you install cwltool 3.1.20230906142556 with python 3.7, cwltool --print-dot works as expected, as it generates the dot representation of the graph.

Actual Behavior

But, if you install cwltool 3.1.20230906142556 (or newer) with python 3.8 (or newer), then an execution of cwltool --print-dot gives an error similar to next:

INFO /home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test/CWLWorkflowEngine/truñi3d/bin/cwltool 3.1.20230906142556
INFO Resolved '/home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test_WorkDir/dd0988dd-d37d-471b-8ecd-7f109b1ab6ce/consolidated-workflow/dd0988dd-d37d-471b-8ecd-7f109b1ab6ce_workflow.cwl' to 'file:///home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test_WorkDir/dd0988dd-d37d-471b-8ecd-7f109b1ab6ce/consolidated-workflow/dd0988dd-d37d-471b-8ecd-7f109b1ab6ce_workflow.cwl'
ERROR I'm sorry, I couldn't load this CWL file, try again with --debug for more information.
The error was: 'Subgraph' object has no attribute 'create_attribute_methods'

I have been able to get the expected behaviour in all the cwltool versions I have tested just downgrading pydot to 2.0.0.

Workflow Code

{
    "$graph": [
        {
            "class": "CommandLineTool",
            "id": "#hello-tool.cwl",
            "label": "hello",
            "requirements": [
                {
                    "class": "DockerRequirement",
                    "dockerPull": "bash:5.2.15"
                },
                {
                    "class": "InitialWorkDirRequirement",
                    "listing": [
                        {
                            "entryname": "hello-world.bash",
                            "entry": "echo \"Hello world!!!!!!!\"\necho\necho \"Computing the md5 of $(inputs.an_input)\"\nmd5sum $(inputs.an_input.path)\necho\necho \"Showing the inherited environment\"\nenv"
                        }
                    ]
                }
            ],
            "baseCommand": [
                "bash",
                "hello-world.bash"
            ],
            "inputs": [
                {
                    "type": "File",
                    "id": "#hello-tool.cwl/hello/an_input"
                }
            ],
            "stdout": "hello_output.txt",
            "outputs": [
                {
                    "type": "File",
                    "id": "#hello-tool.cwl/hello/hello_output",
                    "outputBinding": {
                        "glob": "hello_output.txt"
                    }
                }
            ]
        },
        {
            "class": "Workflow",
            "id": "#main",
            "label": "cosifer-workflow",
            "inputs": [
                {
                    "type": "File",
                    "doc": "Input file to compute the MD5",
                    "id": "#main/an_input"
                }
            ],
            "outputs": [
                {
                    "type": "File",
                    "outputSource": "#main/hello/hello_output",
                    "id": "#main/hello_output"
                }
            ],
            "steps": [
                {
                    "run": "#hello-tool.cwl",
                    "in": [
                        {
                            "source": "#main/an_input",
                            "id": "#main/hello/an_input"
                        }
                    ],
                    "out": [
                        "#main/hello/hello_output"
                    ],
                    "id": "#main/hello"
                }
            ]
        }
    ],
    "cwlVersion": "v1.0"
}

Full Traceback

INFO /home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test/CWLWorkflowEngine/truñi3d/bin/cwltool 3.1.20230906142556
INFO Resolved '/home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test_WorkDir/dd0988dd-d37d-471b-8ecd-7f109b1ab6ce/consolidated-workflow/dd0988dd-d37d-471b-8ecd-7f109b1ab6ce_workflow.cwl' to 'file:///home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test_WorkDir/dd0988dd-d37d-471b-8ecd-7f109b1ab6ce/consolidated-workflow/dd0988dd-d37d-471b-8ecd-7f109b1ab6ce_workflow.cwl'
ERROR I'm sorry, I couldn't load this CWL file.
The error was: 
Traceback (most recent call last):
  File "/home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test/CWLWorkflowEngine/truñi3d/lib/python3.8/site-packages/cwltool/main.py", line 1149, in main
    printdot(tool, loadingContext.loader.ctx, stdout)
  File "/home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test/CWLWorkflowEngine/truñi3d/lib/python3.8/site-packages/cwltool/cwlrdf.py", line 211, in printdot
    cwl_viewer: CWLViewer = CWLViewer(printrdf(wf, ctx, "n3"))
  File "/home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test/CWLWorkflowEngine/truñi3d/lib/python3.8/site-packages/cwltool/cwlviewer.py", line 25, in __init__
    self._set_input_edges()
  File "/home/jmfernandez/projects/WfExS/WfExS-backend_full_circle/wfexs-backend-test/CWLWorkflowEngine/truñi3d/lib/python3.8/site-packages/cwltool/cwlviewer.py", line 102, in _set_input_edges
    inputs_subgraph.create_attribute_methods(["style"])
AttributeError: 'Subgraph' object has no attribute 'create_attribute_methods'

Your Environment

I have reproduced this issue with several cwltool (3.1.20230906142556, 3.1.20240708091337, 3.1.20240508115724, 3.1.20240404144621, 3.1.20240112164112)
and python (3.8, 3.9, ...., 3.12) releases. Downgrading pydot to 2.0.0 the issue disappears.

jmfernandez added a commit to inab/WfExS-backend that referenced this issue Jul 28, 2024
* Workflow engines and container factories were reading the raw configuration file in order to locate declaration of custom paths for the programs they need for their work. Several method declarations have been changed, in order to minimize what it is passed down to them, so their implementations are not tied to the structure of the general WfExS configuration files.

* CWL workflow engine now is able to install cwltool versions which are older than the requested one, in case that version is incompatible with the python interpreter being used.

* CWL workflow engine has gained the capability to use custom python interpreters (or intepreters in different paths). This is needed to disengage cwltool installation from WfExS one a bit more.

* CWL workflow engine now forces pydot version lower than 3.0.0, due issue common-workflow-language/cwltool#2027
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant