Project

General

Profile

Feature #17054

Updated by Peter Amstutz over 3 years ago

Add an extension to cwltool that allows the user to provide an expression that will determine the runtime name of a workflow step or scatter step.    When a new cwltool is released, update the dependency arvados-cwl-runner. 

 Suggested approach 

 h2. 1. Add a new process requirement to cwltool/extensions-v1.1.yml 

 <pre> 
 - name: StepNameHint 
   type: record 
   inVocab: false 
   extends: cwl:ProcessRequirement 
   doc: | 
     Provide a hint for naming the runtime workflow step in logs or user interface. 
   fields: 
     - name: class 
       type: string 
       doc: "Always 'StepNameHint'" 
       jsonldPredicate: 
         "_id": "@type" 
         "_type": "@vocab" 
     - name: stepname: 
       type: [string, Expression] 
       doc: | 
         A string or expression returning a string with the preferred name for the step.   
         If it is an expression, it is evaluated after the input object has been completely determined. 
 </pre> 

 h2. 2. update supportedProcessRequirements 

 Add "http://commonwl.org/cwltool#StepNameHint" to process.py @supportedProcessRequirements@ 

 h2. 3. Update setup_schema() in main.py 

 <pre> 
 use_custom_schema("v1.2", "http://commonwl.org/cwltool", ext11) 
 </pre> 
 you should also add this to the "else" branch: 
 <pre> 
 use_standard_schema("v1.2") 
 </pre> 

 h2. 4. Update WorkflowJobStep in workflow_job.py  

 Add code to the job() method that  

 # checks if the current workflow step has "http://commonwl.org/cwltool#StepNameHint" in "hints" or "requirements" 
 # If so, gets the value of "stepname" 
 # Then does @self.name = expression.do_eval(stepname)@ 

 h2. 5. Add tests 

 Write a workflow that uses the new hint to with an expression that uses something from the input to set the name of the workflow step.   

 Write a test case that calls cwltool --enable-ext and checks that the log output uses the custom name. 

Back