|
2 | 2 | FF_functions
|
3 | 3 | ============
|
4 | 4 |
|
| 5 | +create_metawfr |
| 6 | +************** |
| 7 | + |
| 8 | +Function to create a meta-workflow-run json structure for case from case metadata. |
| 9 | +Return json structure for the meta-workflow-run. |
| 10 | +Can automatically post the meta-workflow-run as *MetaWorkflowRun* object on the portal and patch ``meta_workflow_run`` key for case with the new uuid. |
| 11 | + |
| 12 | +``create_metawfr_from_case(metawf_uuid<str>, case_uuid<str>, type<str>, ff_key<key>, post=False, patch_case=False, verbose=False)`` |
| 13 | + |
| 14 | +.. code-block:: python |
| 15 | +
|
| 16 | + from magma_ff import create_metawfr |
| 17 | +
|
| 18 | + # UUIDs |
| 19 | + metawf_uuid = '' # uuid for meta-workflow |
| 20 | + case_uuid = '' # uuid for the case |
| 21 | +
|
| 22 | + # Post | Patch |
| 23 | + # post=True to automatically post a new MetaWorkflowRun object on the portal |
| 24 | + # patch_case=True to update meta_workflow_run for case with uuid for new meta-workflow-run |
| 25 | +
|
| 26 | + # type |
| 27 | + # 'WGS trio', 'WGS proband', 'WGS cram proband' |
| 28 | + type = 'WGS trio' |
| 29 | +
|
| 30 | + # ff_key |
| 31 | + # -> key generated by ff_utils to authenticate on the portal |
| 32 | +
|
| 33 | + metawfr_json = create_metawfr.create_metawfr_from_case(metawf_uuid, case_uuid, type, ff_key, post=False, patch_case=False, verbose=False) |
| 34 | +
|
| 35 | +
|
5 | 36 | run_metawfr
|
6 | 37 | ***********
|
7 | 38 |
|
8 | 39 | Function to run workflow-runs in meta-workflow-run.
|
9 | 40 | Calculates which workflow-runs are ready to run, starts the run with tibanna and patch the metadata.
|
10 | 41 |
|
11 |
| -``run_metawfr(metawfr_uuid<str>, ff_key<key>, verbose=False, sfn='tibanna_zebra', env='fourfront-cgap')`` |
| 42 | +``run_metawfr(metawfr_uuid<str>, ff_key<key>, verbose=False, sfn='tibanna_zebra', env='fourfront-cgap', maxcount=None)`` |
12 | 43 |
|
13 | 44 | .. code-block:: python
|
14 | 45 |
|
| 46 | + from magma_ff import run_metawfr |
| 47 | +
|
| 48 | + # UUIDs |
| 49 | + metawfr_uuid = '' # uuid for meta-workflow-run |
| 50 | +
|
| 51 | + # ff_key |
| 52 | + # -> key generated by ff_utils to authenticate on the portal |
| 53 | +
|
| 54 | + # env |
| 55 | + # environment to use to access metadata |
| 56 | + env = 'fourfront-cgap' |
| 57 | +
|
| 58 | + # sfn |
| 59 | + # step function to use for tibanna |
| 60 | + sfn = 'tibanna_zebra' |
| 61 | +
|
| 62 | + run_metawfr.run_metawfr(metawfr_uuid, ff_key, verbose=False, sfn='tibanna_zebra', env='fourfront-cgap', maxcount=None) |
15 | 63 |
|
16 | 64 |
|
17 | 65 | status_metawfr
|
18 | 66 | **************
|
19 | 67 |
|
20 | 68 | Function to check and patch status for workflow-runs in meta-workflow-run that are running.
|
| 69 | +Update the status to ``completed`` or ``failed`` for finished runs. |
21 | 70 |
|
22 | 71 | ``status_metawfr(metawfr_uuid<str>, ff_key<key>, verbose=False, env='fourfront-cgap')``
|
23 | 72 |
|
24 | 73 | .. code-block:: python
|
25 | 74 |
|
| 75 | + from magma_ff import status_metawfr |
| 76 | +
|
| 77 | + # UUIDs |
| 78 | + metawfr_uuid = '' # uuid for meta-workflow-run |
| 79 | +
|
| 80 | + # ff_key |
| 81 | + # -> key generated by ff_utils to authenticate on the portal |
| 82 | +
|
| 83 | + # env |
| 84 | + # environment to use to access metadata |
| 85 | + env = 'fourfront-cgap' |
| 86 | +
|
| 87 | + status_metawfr.status_metawfr(metawfr_uuid, ff_key, verbose=False, env=env) |
26 | 88 |
|
27 | 89 |
|
28 | 90 | import_metawfr
|
29 | 91 | **************
|
30 | 92 |
|
31 |
| -Function to import metadata for meta-workflow-run from a different meta-workflow-run. |
| 93 | +Creates a new meta-workflow-run json structure for case using specified ``create_metawfr`` function. |
| 94 | +Imports information from different meta-workflow-run specified as ``metawfr_uuid`` for steps that are listed in ``steps_name``. |
| 95 | +Return json structure for the new meta-workflow-run. |
| 96 | +Can automatically post the new meta-workflow-run as *MetaWorkflowRun* object on the portal. |
32 | 97 |
|
33 |
| -``import_metawfr(metawf_uuid<str>, metawfr_uuid<str>, case_uuid<str>, steps_name<str list>, create_metawfr<function>, ff_key<key>, post=False, verbose=False)`` |
| 98 | +``import_metawfr(metawf_uuid<str>, metawfr_uuid<str>, case_uuid<str>, steps_name<str list>, create_metawfr<function>, type<str>, ff_key<key>, post=False, verbose=False)`` |
34 | 99 |
|
35 | 100 | .. code-block:: python
|
| 101 | +
|
| 102 | + from magma_ff import import_metawfr |
| 103 | + from magma_ff import create_metawfr |
| 104 | +
|
| 105 | + # UUIDs |
| 106 | + metawf_uuid = '' # uuid for meta-workflow |
| 107 | + metawfr_uuid = '' # uuid for old meta-workflow-run to import |
| 108 | + case_uuid = '' # uuid for the case |
| 109 | +
|
| 110 | + # Post |
| 111 | + # post=True to automatically post a new MetaWorkflowRun object on the portal |
| 112 | +
|
| 113 | + # ff_key |
| 114 | + # -> key generated by ff_utils to authenticate on the portal |
| 115 | +
|
| 116 | + # type |
| 117 | + # 'WGS trio', 'WGS proband', 'WGS cram proband' |
| 118 | + type = 'WGS trio' |
| 119 | +
|
| 120 | + # steps_name |
| 121 | + steps_name = ['workflow_granite-mpileupCounts', 'workflow_gatk-ApplyBQSR-check'] |
| 122 | +
|
| 123 | + # create_metawfr |
| 124 | + # function to use to create a new meta-workflow-run structure from case |
| 125 | + # e.g. create_metawfr.create_metawfr_from_case |
| 126 | +
|
| 127 | + metawfr_json = import_metawfr.import_metawfr(metawf_uuid, metawfr_uuid, case_uuid, steps_name, create_metawfr.create_metawfr_from_case, type, ff_key) |
| 128 | +
|
| 129 | +
|
| 130 | +reset_metawfr |
| 131 | +************* |
| 132 | + |
| 133 | +Re-set workflow-runs in meta-workflow-run that correspond to a step defined in ``step_name`` and with status in ``status``. |
| 134 | + |
| 135 | +``reset_status(metawfr_uuid<str>, status<str | str list>, step_name<str | str list>, ff_key<key>, verbose=False)`` |
| 136 | + |
| 137 | +.. code-block:: python |
| 138 | +
|
| 139 | + from magma_ff import reset_metawfr |
| 140 | +
|
| 141 | + # UUIDs |
| 142 | + metawfr_uuid = '' # uuid for meta-workflow-run |
| 143 | +
|
| 144 | + # ff_key |
| 145 | + # -> key generated by ff_utils to authenticate on the portal |
| 146 | +
|
| 147 | + # step_name |
| 148 | + # name or list of names for step-workflows that need to be reset |
| 149 | + step_name = ['workflow_granite-mpileupCounts', 'workflow_gatk-ApplyBQSR-check'] |
| 150 | +
|
| 151 | + # status |
| 152 | + # status or list of status to reset |
| 153 | + status = 'failed' # running | completed | failed |
| 154 | +
|
| 155 | + reset_metawfr.reset_status(metawfr_uuid, status, step_name, ff_key, verbose=False) |
0 commit comments