From b0f13ff77e29b4c8f79f8cfc63c57bb7c104de26 Mon Sep 17 00:00:00 2001 From: Carl Vitzthum Date: Wed, 13 Feb 2019 16:46:39 -0500 Subject: [PATCH 1/3] Fixed an issue that I created; added uuid back into frame=raw results for expand_es_metadata --- dcicutils/_version.py | 2 +- dcicutils/ff_utils.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dcicutils/_version.py b/dcicutils/_version.py index 28e42f3f6..a3317c88d 100644 --- a/dcicutils/_version.py +++ b/dcicutils/_version.py @@ -1,4 +1,4 @@ """Version information.""" # The following line *must* be the last in the module, exactly as formatted: -__version__ = "0.6.1" +__version__ = "0.6.2" diff --git a/dcicutils/ff_utils.py b/dcicutils/ff_utils.py index 8dca542f6..62530106f 100644 --- a/dcicutils/ff_utils.py +++ b/dcicutils/ff_utils.py @@ -611,6 +611,7 @@ def remove_keys(my_dict, remove_list): frame_resp = remove_keys(es_item['object'], ignore_field) else: frame_resp = remove_keys(es_item['properties'], ignore_field) + frame_resp['uuid'] = uuid # uuid is not in properties, so add it store[obj_key].append(frame_resp) item_uuids.add(uuid) else: # this case should not happen From f8b80532a010ca24d18f973af451f59ecc8f6378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Koray=20K=C4=B1rl=C4=B1?= Date: Thu, 14 Feb 2019 14:35:31 -0500 Subject: [PATCH 2/3] changes to tests for expand metadata --- test/test_ff_utils.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/test/test_ff_utils.py b/test/test_ff_utils.py index 83f394f02..add54057c 100644 --- a/test/test_ff_utils.py +++ b/test/test_ff_utils.py @@ -509,8 +509,13 @@ def test_expand_es_metadata(integrated_ff): test_list = ['7f9eb396-5c1a-4c5e-aebf-28ea39d6a50f'] key, ff_env = integrated_ff['ff_key'], integrated_ff['ff_env'] store, uuids = ff_utils.expand_es_metadata(test_list, key=key, ff_env=ff_env) - assert len(uuids) == 10 - assert 'file_processed' in store + print(store.keys()) + + for pos_case in ['file_processed', 'user', 'file_format', 'award', 'lab']: + assert pos_case in store + for neg_case in ['workflow_run_awsem', 'workflow', 'file_reference', 'software', 'workflow_run_sbg', + 'quality_metric_pairsqc', 'quality_metric_fastqc']: + assert neg_case not in store # make sure the frame is raw (default) test_item = store['file_processed'][0] assert test_item['lab'].startswith('828cd4fe') @@ -521,9 +526,7 @@ def test_expand_es_metadata_frame_object(integrated_ff): test_list = ['7f9eb396-5c1a-4c5e-aebf-28ea39d6a50f'] key, ff_env = integrated_ff['ff_key'], integrated_ff['ff_env'] store, uuids = ff_utils.expand_es_metadata(test_list, store_frame='object', key=key, ff_env=ff_env) - assert len(uuids) == 10 - assert 'file_processed' in store - # make sure the frame is raw (default) + # make sure the frame is object (default) test_item = store['file_processed'][0] assert test_item['lab'].startswith('/labs/') @@ -533,16 +536,22 @@ def test_expand_es_metadata_add_wfrs(integrated_ff): test_list = ['7f9eb396-5c1a-4c5e-aebf-28ea39d6a50f'] key, ff_env = integrated_ff['ff_key'], integrated_ff['ff_env'] store, uuids = ff_utils.expand_es_metadata(test_list, add_pc_wfr=True, key=key, ff_env=ff_env) - assert len(uuids) == 73 + for pos_case in ['workflow_run_awsem', 'workflow', 'file_reference', 'software', 'workflow_run_sbg', + 'quality_metric_pairsqc', 'quality_metric_fastqc']: + assert pos_case in store @pytest.mark.integrated def test_expand_es_metadata_ignore_fields(integrated_ff): test_list = ['7f9eb396-5c1a-4c5e-aebf-28ea39d6a50f'] key, ff_env = integrated_ff['ff_key'], integrated_ff['ff_env'] - store, uuids = ff_utils.expand_es_metadata(test_list, add_pc_wfr=True, ignore_field=['quality_metric'], + store, uuids = ff_utils.expand_es_metadata(test_list, add_pc_wfr=True, ignore_field=['quality_metric', + 'output_quality_metrics'], key=key, ff_env=ff_env) - assert len(uuids) == 71 + for pos_case in ['workflow_run_awsem', 'workflow', 'file_reference', 'software', 'workflow_run_sbg']: + assert pos_case in store + for neg_case in ['quality_metric_pairsqc', 'quality_metric_fastqc']: + neg_case not in store @pytest.mark.file_operation From 086d32fd90bedb3cd6ddee2a737e07dfd71ef711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Koray=20K=C4=B1rl=C4=B1?= Date: Thu, 14 Feb 2019 14:36:17 -0500 Subject: [PATCH 3/3] take out print --- test/test_ff_utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/test_ff_utils.py b/test/test_ff_utils.py index add54057c..0b763666d 100644 --- a/test/test_ff_utils.py +++ b/test/test_ff_utils.py @@ -509,8 +509,6 @@ def test_expand_es_metadata(integrated_ff): test_list = ['7f9eb396-5c1a-4c5e-aebf-28ea39d6a50f'] key, ff_env = integrated_ff['ff_key'], integrated_ff['ff_env'] store, uuids = ff_utils.expand_es_metadata(test_list, key=key, ff_env=ff_env) - print(store.keys()) - for pos_case in ['file_processed', 'user', 'file_format', 'award', 'lab']: assert pos_case in store for neg_case in ['workflow_run_awsem', 'workflow', 'file_reference', 'software', 'workflow_run_sbg',