Project

General

Profile

Pipeline template development » History » Version 9

Bryan Cosca, 04/21/2016 05:57 PM

1 1 Bryan Cosca
h1. Pipeline template development
2
3 9 Bryan Cosca
This wiki will describe how to write a pipeline template. Some documentation for writing a pipeline template using run-command is already available on "doc.arvados.org.":http://doc.arvados.org/user/tutorials/running-external-program.html Here's an example pipeline template. More documentation for writing pipeline templates to run crunch scripts can be found "here.":https://dev.arvados.org/projects/arvados/wiki/Writing_a_Script_Calling_a_Third_Party_Tool
4 2 Bryan Cosca
5
<pre>
6
"components": {
7
 "JobName": {
8 4 Bryan Cosca
  "script": "JobScript.py",
9 2 Bryan Cosca
  "script_version": "master",
10
  "repository": "yourname/yourname",
11
  "script_parameters": {
12
   "CollectionOne": {
13
    "required": true,
14
    "dataclass": "Collection"
15
   },
16
   "ParameterOne":{
17
    "required": true,
18
    "dataclass": "text",
19
    "default": "ParameterOneString"
20
   }
21
  },
22
  "runtime_constraints": {
23
   "docker_image": "bcosc/arv-base-java",
24
   "arvados_sdk_version": "master"
25
  }
26
 }
27
}
28 1 Bryan Cosca
</pre>
29 2 Bryan Cosca
30 5 Bryan Cosca
The script used for the job is specified under the 'script' parameter, using the commit hash or branch name under 'script_version', which is under the arvados git repository specified under 'repository'. Note: Github repositories can also be used, as long as the repository is public. One important note is that your script must be in a folder called 'crunch_scripts'.
31 4 Bryan Cosca
32
When developing a pipeline, we have an arvados best practices guideline for how to use your git repository effectively "here.":https://dev.arvados.org/projects/arvados/wiki/Git_strategy_for_pipeline_development
33 1 Bryan Cosca
34 2 Bryan Cosca
h3. Writing script_parameters
35 1 Bryan Cosca
36 5 Bryan Cosca
"Script_parameters":http://doc.arvados.org/api/schema/PipelineTemplate.html are inputs that can be called in your crunch script. Each script parameter can have any dataclass: Collection, File, number, text. Collection uses the pdh string (ex. 39c6f22d40001074f4200a72559ae7eb+5745), File passes in a file path in a collection (ex. 39c6f22d40001074f4200a72559ae7eb+5745/foo.txt), number passes in any integer, and text passes in any string.
37 1 Bryan Cosca
38 2 Bryan Cosca
The default parameter is useful for using a collection you know will most likely be used, so the user does not have to input it manually. For example, a reference genome collection that will be used throughout the entire pipeline.
39
40
The title and description parameters are useful for showing what the script parameter is doing, but is not necessary.
41
42 7 Bryan Cosca
For example, pipeline template with script parameters:
43
44
<pre>
45
"reference_collection":{
46
 "required":true,
47
 "dataclass":"Collection"
48
},
49
"bwa_collection":{
50
 "required":true,
51
 "dataclass":"Collection",
52
 "default":"39c6f22d40001074f4200a72559ae7eb+5745"
53
},
54
 "sample":{
55
 "required":true,
56
 "dataclass":"Collection",
57
 "title":"Input FASTQ Collection",
58
 "description":"Input the fastq collection for BWA mem"
59
},
60
"read_group":{
61
 "required":true,
62
 "dataclass":"Text"
63
},
64
"additional_params":{
65
 "required":false,
66
 "dataclass":"Text"
67
},
68
</pre>
69
70
yields this view in workbench:
71
72
!7d1b807a78e3bd095d02913dd1074ddf.png!
73
74
The inputs tab in the pipeline instance page shows all the required parameters. You can click 'Choose' to grab a collection from a project for the reference_collection and input FASTQ Collection parameters. You can type in the read_group you want to use here as well. You can change the bwa_collection, but since you set the default collection, you only need to change it when you need to.
75
76
For the 'additional_params' parameter, since its not required, its in the 'Components' tab, where you can set it:
77
78 8 Bryan Cosca
!752b7261b5710fbf362db26f315fc45d.png!
79 7 Bryan Cosca
80 2 Bryan Cosca
h3. Writing runtime_constraints
81
82
"Runtime_constraints":http://doc.arvados.org/api/schema/Job.html are inputs in your job that help choose node parameters that your pipeline will run on. Optimizing these parameters can be found in the "Pipeline_Optimization wiki.":https://dev.arvados.org/projects/arvados/wiki/Pipeline_Optimization
83
84 6 Bryan Cosca
One runtime constraint is docker_image. It is suggested that while developing you use the latest version of the image, which you can specify by using the name of the image. When in production, you should use the portable data hash of the image you specifically want to use to avoid problems when accidentally changing the image or other conflicts.
85 3 Bryan Cosca
86
Using min_nodes will spin up as many nodes as you've specified. Be warned that you can allocate your entire cluster to your job, so use this with caution.
87
88
The max_tasks_per_node parameter will allow you to allocate more computations on your node. By default, this is 1. If you are under utilizing your nodes, you can try to increase this number. Keep in mind that the total CPU/RAM/space usage of your tasks should fit on your node. It's very easy to overestimate the compute power of your tasks. Using something like "crunchstat-summary":https://dev.arvados.org/projects/arvados/wiki/Pipeline_Optimization should help bridge this gap.