diff --git a/peregrine/resources/submission/__init__.py b/peregrine/resources/submission/__init__.py index e522ade3..796a4ece 100644 --- a/peregrine/resources/submission/__init__.py +++ b/peregrine/resources/submission/__init__.py @@ -136,7 +136,7 @@ def get_manifest(): if(bag_path is None): return flask.jsonify({'bag_path': None, 'errors': 'bag_path is required!!!'}), 400 - if peregrine.utils.contain_node_category(export_data,'data_file') == False: + if peregrine.utils.contain_node_with_category(export_data,'data_file') == False: return flask.jsonify({ 'errors': 'No data_file node'}), 400 @@ -149,6 +149,6 @@ def get_manifest(): bag_path=bag_path, bag_info=bag_info, payload=res) - bag = peregrine.utils.create_bdbag(**args) # bag is a compressed file + peregrine.utils.create_bdbag(**args) # bag is a compressed file return flask.jsonify({'data': res}), 200 diff --git a/peregrine/utils/__init__.py b/peregrine/utils/__init__.py index 11cba366..5904a942 100644 --- a/peregrine/utils/__init__.py +++ b/peregrine/utils/__init__.py @@ -1,4 +1,4 @@ -from .payload import get_variables,jsonify_check_errors,parse_request_json,get_keys,contain_node_category +from .payload import get_variables,jsonify_check_errors,parse_request_json,get_keys,contain_node_with_category from .pybdbag import create_bdbag from .scheduling import AsyncPool from .json2csv import flatten_obj,json2tbl \ No newline at end of file diff --git a/peregrine/utils/pybdbag.py b/peregrine/utils/pybdbag.py index 2029ed74..80715c74 100644 --- a/peregrine/utils/pybdbag.py +++ b/peregrine/utils/pybdbag.py @@ -5,8 +5,8 @@ def create_bdbag(bag_path, bag_info, payload, max_row=10000): - """Modify from https://github.com/BD2KGenomics/dcc-dashboard-service/blob/feature/manifest-handover/webservice.py""" - """Create compressed BDbag file.""" + """Modify from https://github.com/BD2KGenomics/dcc-dashboard-service/blob/feature/manifest-handover/webservice.py + Create compressed BDbag file.""" if len(payload) == 0: return @@ -22,10 +22,9 @@ def create_bdbag(bag_path, bag_info, payload, max_row=10000): for k in payload[0].keys(): k = k.replace('_data_','') row.append(k) - writer.writerow(row) + writer.writerow(row) nrow = 1 - for row_dict in payload: row=[] for (k,v) in row_dict.iteritems(): @@ -52,6 +51,6 @@ def create_bdbag(bag_path, bag_info, payload, max_row=10000): def zipdir(path, ziph): """https://github.com/BD2KGenomics/dcc-dashboard-service/blob/feature/manifest-handover/webservice.py""" # ziph is zipfile handle - for root, dirs, files in os.walk(path): + for root, _, files in os.walk(path): for file in files: - ziph.write(os.path.join(root, file)) \ No newline at end of file + ziph.write(os.path.join(root, file))