Merging 2 python workflows with $PWD

I was trying to merge 2 python workflows following this tutorial https://scriptcwl.readthedocs.io/en/latest/. It is run successfully only when I specify the whole path to the add.py and multiply.py. I intend to run in grid systems, so I can use only present working directory appended to the path. Is there any way to append ‘present working directory’ to the path in CWL?

Hello @Priyaa, and welcome!

You are correct, it isn’t very portable to put the entire path to your script in the baseCommand or arguments. For running on HPC I recommend appending the directories where your software is installed to the PATH environment variable before running cwltool or toil-cwl-runner.

PATH=${PATH}:/whole/path/to/my/scripts/ toil-cwl-runner my_workflow.cwl my_inputs.yml

Remember to make sure your scripts add.py and multiply.py are marked executable and begin with a suitable #!/usr/bin/env python or #!/usr/bin/env python3 as appropriate.

1 Like

Hi @mrc,
Thanks for the reply. I solved the problem in different way, by inputting the files (add.py, multiply.py) as inputs to cwl in the yaml file. It worked without specifying the whole path.

Here is my sample yaml file:

   y: 4  # type "int"
   x: 5  # type "int"
   src:
      class: File
      path: add.py

I will try your solution too. Thanks

1 Like