Exemplo n.º 1
0
def update_wf_batch_status(cromwell_auth, wf_id, include_in_batch=True):
    # Update workflow batch status to indicate whether wf should be included in final batch or not
    labels = {
        const.CROMWELL_BATCH_STATUS_FIELD:
        const.CROMWELL_BATCH_STATUS_INCLUDE_FLAG
    }
    if not include_in_batch:
        labels[
            const.
            CROMWELL_BATCH_STATUS_FIELD] = const.CROMWELL_BATCH_STATUS_EXCLUDE_FLAG
    CromwellAPI.patch_labels(wf_id,
                             labels,
                             cromwell_auth,
                             raise_for_status=True)
Exemplo n.º 2
0
    def test_path_labels_returns_200(self, mock_request):
        workflow_id = 'labeltest'
        new_label = {'foo': 'bar'}

        def _request_callback(request, context):
            context.status_code = 200
            context.headers['test'] = 'header'
            return {'id': request.url.split('/')[-2], 'labels': new_label}

        for cromwell_auth in self.auth_options:
            mock_request.patch(
                '{0}/api/workflows/v1/{1}/labels'.format(
                    cromwell_auth.url, workflow_id
                ),
                json=_request_callback,
            )
            result = CromwellAPI.patch_labels(workflow_id, new_label, cromwell_auth)
            self.assertEqual(result.status_code, 200)
            self.assertEqual(result.json()['id'], workflow_id)
            self.assertEqual(result.json()['labels'], new_label)