cwl-v1.2 icon indicating copy to clipboard operation
cwl-v1.2 copied to clipboard

#main vs main, inconsistencies

Open mr-c opened this issue 3 years ago • 3 comments

https://www.commonwl.org/v1.2/Workflow.html#Packed_documents reminds us that

If the reference to the packed document does not include a fragment identifier, the runner must choose the top-level process object as the entry point. If there is no top-level process object (as in the case of $graph) then the runner must choose the process object with an id of #main. If there is no #main object, the runner must return an error.

Though https://www.commonwl.org/v1.2/Workflow.html#Generic_execution_process does state that

  1. If there are multiple process objects (due to $graph) and which process object to start with is not specified in the input object (via a cwl:tool entry) or by any other means (like a URL fragment) then choose the process with the id of "#main" or "main".

That is a bit inconsistent, we should probably mention the plain main in https://www.commonwl.org/v1.2/Workflow.html#Packed_documents (and ensure there is a conformance test using that)

mr-c avatar Nov 25 '21 09:11 mr-c

After a bit of experimenting on how load_document_by_uri() from cwl-utils resolves the ids in the objects it returns, I've noticed that:

  • main becomes 'file:///path/to/file.cwl#main'
  • #main also becomes 'file:///path/to/file.cwl#main'
  • ##main becomes 'file:///path/to/file.cwl##main'
  • ###main becomes 'file:///path/to/file.cwl###main' and so on
  • This applies for any id starting with #

So it seems that #main and main are indeed equivalent, so agreed that sticking with main makes more sense. In the code I'm writing to find a process object inside a document, I now strip the (first) # from the start of an object id before comparing, and it seems to work with all conformance tests.

That is a bit inconsistent, we should probably mention the plain main in https://www.commonwl.org/v1.2/Workflow.html#Packed_documents (and ensure there is a conformance test using that)

There are already conformance tests using main, e.g. the wf_scatter_twoparam_flat_crossproduct_valuefrom test uses tool: "tests/scatter-valuefrom-wf3.cwl#main" where the workflow in tests/scatter-valuefrom-wf3.cwl has - id: main .

nsoranzo avatar Nov 26 '21 19:11 nsoranzo

@mr-c I wish to work on this. Please can you assign it to me?

Fienne avatar Oct 09 '22 11:10 Fienne

Hello @Fienne . Go ahead and work on this issue. Just saying that you are working on it is enough, we hardly use the assignment feature.

Please let us know if you have any questions.

We have a weekly voice/video chat on Mondays at 15:00 UTC https://www.commonwl.org/community/#when

mr-c avatar Oct 09 '22 14:10 mr-c