carpentries-incubator / cwl-novice-tutorial

Introduction to Workflows with Common Workflow Language
https://carpentries-incubator.github.io/cwl-novice-tutorial/
Other
11 stars 20 forks source link

Objectives and Exercise mismatch for "Adding your own script to a step" #31

Open swzCuroverse opened 3 years ago

swzCuroverse commented 3 years ago

Unless, I misunderstand. This episode exercises seem to focused on creating a script at run time and running instead of the object which I believe is running an existing script as a step in your workflow, using the right requirements to do so, and obtaining the outputs.

The objectives are stated as: Questions How to include and run a script in a step at runtime?

Which requirements need to be specified?

How to capture output of a script?

Objectives Include and run a script in a step at runtime Capture output of a script

There is nothing about generating a new script at runtime and running it.

https://common-workflow-lab.github.io/cwl-novice-tutorial/script/index.html

swzCuroverse commented 3 years ago

I would suggest that you assume that you have a script that already exists that we want to run and show how to run that. Because I wouldn't want people to think the way to run an existing script was to cut and paste into the listing. I understand this would be a hack if you wanted to generate one on the fly but I think the use case of having a script you want to run if far more common and creating one during run time is more of an advanced maneuver or for very short, on the fly scripts or scripts required to take information from the workflow itself. https://github.com/common-workflow-language/user_guide/issues/158 is more what I was expected. We have an example like that which is currently in this example in the user guide but that is explicitly for creating files at run time not for running a bash script -- https://www.commonwl.org/user_guide/14-runtime/index.html.

I also see from the list of "options" for running a local script that are in the learning objects - the one I find easiest and use most often (for all sorts of code that I am working on is NOT included) (note code stolen from Michael's answer in the link above)

class: CommandLineTool

inputs:
  my_script:
     type: File
     inputBinding:
        position: 0

  # other inputs go here

baseCommand: sh

outputs: []

I think this technique also goes beyond just running bash/sh commands and relates to a common question of I want to run a script in general (R, Python, etc) and how to do that. And for those, I definitely wouldn't suggest putting the code in the listing.

skanwal commented 3 years ago

Hi @swzCuroverse

Thanks for the suggestion and it definitely makes sense to also focus on adding an existing script.

Wondering if we can have one exercise also on "creating a script" at runtime to cater for running a simple command during process execution as this is also one of a common practice?

Happy to revamp the exercises.

swzCuroverse commented 3 years ago

Thank you! Yes @skanwal we should reuse the work you did on the creating a script exercises. My only question is if it is a better fit in this tutorial or the intermediate tutorial.