Mercurial > repos > cathywise > truststore_browse
comparison TrustStoreGalaxyBrowse.py @ 14:c7287129f37f
And again.
| author | Wise, Catherine (Digital, Acton) <Catherine.Wise@csiro.au> |
|---|---|
| date | Thu, 25 Jun 2015 09:16:21 +1000 |
| parents | da8958ad788e |
| children | 8b88de25dd2c |
comparison
equal
deleted
inserted
replaced
| 13:da8958ad788e | 14:c7287129f37f |
|---|---|
| 7 import os | 7 import os |
| 8 import json | 8 import json |
| 9 import operator | 9 import operator |
| 10 import urlparse | 10 import urlparse |
| 11 from py_ts import TrustStoreClient, utils | 11 from py_ts import TrustStoreClient, utils |
| 12 import galaxy.model # need to import model before sniff to resolve a circular import dependency | 12 # import galaxy.model # need to import model before sniff to resolve a circular import dependency |
| 13 from galaxy.datatypes.checkers import util | 13 from galaxy.datatypes.checkers import util |
| 14 from galaxy.datatypes import sniff | 14 # from galaxy.datatypes import sniff |
| 15 from galaxy.datatypes.registry import Registry | 15 # from galaxy.datatypes.registry import Registry |
| 16 | 16 |
| 17 # Tell urllib3 to use pyOpenSSL because we are on old Python stdlib. | 17 # Tell urllib3 to use pyOpenSSL because we are on old Python stdlib. |
| 18 # import urllib3.contrib.pyopenssl | 18 # import urllib3.contrib.pyopenssl |
| 19 # urllib3.contrib.pyopenssl.inject_into_urllib3() | 19 # urllib3.contrib.pyopenssl.inject_into_urllib3() |
| 20 # | 20 # |
| 120 output_data = all_params.get('output_data') | 120 output_data = all_params.get('output_data') |
| 121 extra_files_path, file_name, ext, out_data_name, hda_id, dataset_id = \ | 121 extra_files_path, file_name, ext, out_data_name, hda_id, dataset_id = \ |
| 122 operator.itemgetter('extra_files_path', 'file_name', 'ext', 'out_data_name', 'hda_id', 'dataset_id')(output_data[0]) | 122 operator.itemgetter('extra_files_path', 'file_name', 'ext', 'out_data_name', 'hda_id', 'dataset_id')(output_data[0]) |
| 123 extra_files_path = json_params['__new_file_path__'] | 123 extra_files_path = json_params['__new_file_path__'] |
| 124 | 124 |
| 125 datatypes_registry = Registry() | 125 # datatypes_registry = Registry() |
| 126 datatypes_registry.load_datatypes( | 126 # datatypes_registry.load_datatypes( |
| 127 root_dir=all_params['job_config']['GALAXY_ROOT_DIR'], | 127 # root_dir=all_params['job_config']['GALAXY_ROOT_DIR'], |
| 128 config=all_params['job_config']['GALAXY_DATATYPES_CONF_FILE'] | 128 # config=all_params['job_config']['GALAXY_DATATYPES_CONF_FILE'] |
| 129 ) | 129 # ) |
| 130 | 130 |
| 131 url_params = urlparse.unquote(json_params['URL']).split(";") | 131 url_params = urlparse.unquote(json_params['URL']).split(";") |
| 132 if len(url_params) < 3: | 132 if len(url_params) < 3: |
| 133 print("The url we got back is malformed: "+ json_params['URL']) | 133 print("The url we got back is malformed: "+ json_params['URL']) |
| 134 sys.exit(5) | 134 sys.exit(5) |
| 196 download = truststore.getFile(store, location) | 196 download = truststore.getFile(store, location) |
| 197 if download is None: | 197 if download is None: |
| 198 print("File %s not found." % location.name) | 198 print("File %s not found." % location.name) |
| 199 sys.exit(4) | 199 sys.exit(4) |
| 200 ungzip(download, target_output_filename) | 200 ungzip(download, target_output_filename) |
| 201 ext = sniff.handle_uploaded_dataset_file(filename, datatypes_registry, ext=ext) | 201 # ext = sniff.handle_uploaded_dataset_file(target_output_filename, datatypes_registry, ext=ext) |
| 202 print("Guessed file type: " + ext) | 202 # print("Guessed file type: " + ext) |
| 203 print("in file: " + properties_file) | |
| 203 metadata_file.write( | 204 metadata_file.write( |
| 204 metadata_to_json(dataset_id, target_output_filename, name, ext, data_type)) | 205 metadata_to_json(dataset_id, target_output_filename, name, extension, data_type)) |
| 205 else: | 206 else: |
| 206 print("Store is damaged or we don't have sufficient access.") | 207 print("Store is damaged or we don't have sufficient access.") |
| 207 sys.exit(4) | 208 sys.exit(4) |
| 208 | 209 |
| 209 | 210 |
