执行工作流:cwltool /home/zcy/download/cwl/wf.cwl /home/zcy/download/cwl/echo-job.yml
wf.cwl
cwlVersion: v1.2 class: Workflow inputs: message: string outputs: out: type: File outputSource: uppercase/example_out steps: echo: run: /home/zcy/download/cwl/zzz_print.cwl in: message: message out: [out] uppercase: run: /home/zcy/download/cwl/ccc.cwl in: mypath: source: echo/out out: [example_out]
echo-job.yml
message: Hello world!
zzz_print.cwl
cwlVersion: v1.0 class: CommandLineTool stdout: tst_stdout.txt baseCommand: [python, /home/zcy/download/cwl/input/zzz_print.py] inputs: message: type: string inputBinding: position: 1 outputs: out: type: string outputBinding: glob: tst_stdout.txt loadContents: true outputEval: $(self[0].contents)
zzz_print.py
import argparse parser = argparse.ArgumentParser(description='download files by ftp') parser.add_argument('message', type=str, help='PDB') def tst(args): with open('/home/zzz_print.out', 'w') as f: f.write(args) print('/home/zzz_print.out') if __name__ == '__main__': args = parser.parse_args() tst(args.message)
ccc.cwl
cwlVersion: v1.0 class: CommandLineTool baseCommand: [python, /home/zcy/download/cwl/input/ccc.py] inputs: mypath: type: string inputBinding: position: 1 outputs: example_out: type: stdout stdout: output_ccc.txt
ccc.py
import argparse parser = argparse.ArgumentParser(description='download files by ftp') parser.add_argument('mypath', type=str, help='PDB') def tst(args): fpath = args.split(None)[0] with open(fpath, 'r') as f: data = f.read() print('final result:') print(data) if __name__ == '__main__': args = parser.parse_args() tst(args.mypath)
标签:__,args,笔记,学习,cwl,cwltoo,print,download,out From: https://www.cnblogs.com/testzcy/p/17648713.html