Skip to content

Commit 411244c

Browse files
committed
added shards and gather_input
1 parent 77e6fa2 commit 411244c

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

docs/yaml_metaworkflow.rst

+18
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ Template
6262
dependencies:
6363
- <workflow_name>[@<tag>]
6464
65+
## Fixed shards ####################
66+
# Allows to force a fixed shards structure ignoring
67+
# the input structure, scatter and gather dimensions
68+
####################################
69+
shards: [[<string>], ..] # e.g., [['0'], ['1'], ['2']]
70+
6571
## Lock version ####################
6672
# Specific version to use
6773
# for the workflow
@@ -96,6 +102,7 @@ Template
96102
gather: <integer>
97103
input_dimension: <integer>
98104
extra_dimension: <integer>
105+
gather_input: <integer>
99106
# All the following fields are optional and provided as example,
100107
# can be expanded to anything accepted by the schema
101108
mount: <boolean>
@@ -188,6 +195,12 @@ dependencies
188195
Workflows that must complete before kicking the current step.
189196
List of workflows in the the format ``<workflow_name>[@<tag>]``.
190197

198+
shards
199+
^^^^^^
200+
Allows to force a fixed shards structure for the current step.
201+
Override input structure, scatter and gather dimensions.
202+
Shards structure as list, e.g., ``[['0'], ['1'], ['2']]``.
203+
191204
version
192205
^^^^^^^
193206
Version to use for the corresponding workflow instead of the default specified for the repository.
@@ -305,3 +318,8 @@ extra_dimension
305318
Additional increment to dimension used when creating the specific input for the step.
306319
This will be applied on top of ``gather``, if any, and will only affect the input.
307320
This will not affect gather dimension in building the pipeline structure.
321+
322+
gather_input
323+
------------
324+
Equivalent to ``gather`` in collecting output from previous shards.
325+
This will not affect scatter or gather dimensions in building pipeline structure.

docs/yaml_workflow.rst

+17-2
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,25 @@ We recommend to use this new type to implement QCs.
175175
When using ``quality_metric_generic`` as a ``qc_type``, it is possible to generate two different types of output: a key-value pairs JSON file and a compressed file.
176176
The JSON file can be used to create a summary report of the quality metrics generated by the QC process.
177177
The compressed file can be used to store the original output for the QC, including additional data or graphs.
178-
Both the JSON file and compressed file will be attached to the file specified as target by ``argument_to_be_attached_to``.
179-
The content of the JSON file will be patched directly on the target file, while the compressed file will be made available for download on the file via a link.
178+
Both the JSON file and compressed file will be attached to the file specified as target by ``argument_to_be_attached_to`` with a ``QualityMetricGeneric`` object.
179+
The content of the JSON file will be patched directly on the object, while the compressed file will be made available for download via a link.
180180
The output type can be specified by setting ``json: True`` or ``zipped: True`` in the the QC output definition.
181181

182+
Template for ``quality_metric_generic``:
183+
184+
.. code-block:: python
185+
186+
}
187+
"name": "Quality metric name",
188+
"qc_values": [
189+
{
190+
"key": "Name of the key",
191+
"tooltip": "Tooltip for the key",
192+
"value": "Value for the key"
193+
}
194+
]
195+
}
196+
182197
secondary_files
183198
^^^^^^^^^^^^^^^
184199
This field can be used for output **files**.

pipeline_utils/lib/yaml_parser.py

+4
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ class YAMLMetaWorkflow(YAMLTemplate):
359359
OUTPUT_SCHEMA = 'output'
360360
CONFIG_SCHEMA = 'config'
361361
DEPENDENCIES_SCHEMA = 'dependencies'
362+
SHARDS_SCHEMA = 'shards'
362363
PROBAND_ONLY_SCHEMA = 'proband_only'
363364

364365
def __init__(self, data):
@@ -446,6 +447,9 @@ def _workflows(self, version, project):
446447
# hard dependencies
447448
if values.get(self.DEPENDENCIES_SCHEMA):
448449
workflow_[self.DEPENDENCIES_SCHEMA] = values[self.DEPENDENCIES_SCHEMA]
450+
# fixed shards
451+
if values.get(self.SHARDS_SCHEMA):
452+
workflow_[self.SHARDS_SCHEMA] = values[self.SHARDS_SCHEMA]
449453
workflows.append(workflow_)
450454

451455
return workflows

pipeline_utils/schemas/yaml_metaworkflow.py

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
schema.ITEMS: {
6666
schema.TYPE: schema.STRING
6767
}
68+
},
69+
'shards': {
70+
schema.DESCRIPTION: 'Shards structure to create for the step',
71+
schema.TYPE: schema.ARRAY
6872
}
6973
},
7074
schema.REQUIRED: ['input', 'config']
@@ -107,6 +111,9 @@
107111
'gather': {
108112
schema.TYPE: schema.NUMBER
109113
},
114+
'gather_input': {
115+
schema.TYPE: schema.NUMBER
116+
},
110117
'input_dimension': {
111118
schema.TYPE: schema.NUMBER
112119
},

0 commit comments

Comments
 (0)