commit/galaxy-central: greg: Improved temporary directory management in the Tool Shed.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/521b4ff9060b/ Changeset: 521b4ff9060b User: greg Date: 2013-11-13 22:17:33 Summary: Improved temporary directory management in the Tool Shed. Affected #: 6 files diff -r c70a6f517aa96506b3245db857025f567aac0511 -r 521b4ff9060b72f1f8c9f5977f8c4fa2b0bd7877 lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -1093,7 +1093,8 @@ str( repository.name ), changeset_revision, file_type, - export_repository_dependencies ) + export_repository_dependencies, + api=False ) repositories_archive_filename = os.path.basename( repositories_archive.name ) if error_message: message = error_message @@ -1104,6 +1105,8 @@ opened_archive = open( repositories_archive.name ) # Make sure the file is removed from disk after the contents have been downloaded. os.unlink( repositories_archive.name ) + repositories_archive_path, file_name = os.path.split( repositories_archive ) + suc.remove_dir( repositories_archive_path ) return opened_archive repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) metadata = repository_metadata.metadata @@ -3091,6 +3094,7 @@ work_dir ) if message: status = 'error' + suc.remove_dir( work_dir ) break if guid: tool_lineage = self.get_versions_of_tool( trans, repository, repository_metadata, guid ) diff -r c70a6f517aa96506b3245db857025f567aac0511 -r 521b4ff9060b72f1f8c9f5977f8c4fa2b0bd7877 lib/galaxy/webapps/tool_shed/controllers/upload.py --- a/lib/galaxy/webapps/tool_shed/controllers/upload.py +++ b/lib/galaxy/webapps/tool_shed/controllers/upload.py @@ -248,6 +248,8 @@ status = 'error' # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file. tool_util.reset_tool_data_tables( trans.app ) + if uploaded_directory: + suc.remove_dir( uploaded_directory ) trans.response.send_redirect( web.url_for( controller='repository', action='browse_repository', id=repository_id, @@ -255,6 +257,8 @@ message=message, status=status ) ) else: + if uploaded_directory: + suc.remove_dir( uploaded_directory ) status = 'error' # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file. tool_util.reset_tool_data_tables( trans.app ) diff -r c70a6f517aa96506b3245db857025f567aac0511 -r 521b4ff9060b72f1f8c9f5977f8c4fa2b0bd7877 lib/tool_shed/galaxy_install/install_manager.py --- a/lib/tool_shed/galaxy_install/install_manager.py +++ b/lib/tool_shed/galaxy_install/install_manager.py @@ -464,10 +464,7 @@ if display_path: # Load proprietary datatype display applications self.app.datatypes_registry.load_display_applications( installed_repository_dict=repository_dict ) - try: - shutil.rmtree( work_dir ) - except: - pass + suc.remove_dir( work_dir ) def install_repository( self, repository_elem, tool_shed_repository, install_dependencies, is_repository_dependency=False ): """Install a single repository, loading contained tools into the tool panel.""" diff -r c70a6f517aa96506b3245db857025f567aac0511 -r 521b4ff9060b72f1f8c9f5977f8c4fa2b0bd7877 lib/tool_shed/galaxy_install/repository_util.py --- a/lib/tool_shed/galaxy_install/repository_util.py +++ b/lib/tool_shed/galaxy_install/repository_util.py @@ -575,10 +575,7 @@ tool_shed_repository=tool_shed_repository, tool_dependencies_config=tool_dependencies_config, tool_dependencies=tool_shed_repository.tool_dependencies ) - try: - shutil.rmtree( work_dir ) - except: - pass + suc.remove_dir( work_dir ) suc.update_tool_shed_repository_status( trans.app, tool_shed_repository, trans.model.ToolShedRepository.installation_status.INSTALLED ) else: # An error occurred while cloning the repository, so reset everything necessary to enable another attempt. @@ -817,10 +814,7 @@ for installed_tool_dependency in installed_tool_dependencies: if installed_tool_dependency.status in [ trans.model.ToolDependency.installation_status.ERROR ]: repair_dict = add_repair_dict_entry( repository.name, installed_tool_dependency.error_message ) - try: - shutil.rmtree( work_dir ) - except: - pass + suc.remove_dir( work_dir ) suc.update_tool_shed_repository_status( trans.app, repository, trans.model.ToolShedRepository.installation_status.INSTALLED ) return repair_dict diff -r c70a6f517aa96506b3245db857025f567aac0511 -r 521b4ff9060b72f1f8c9f5977f8c4fa2b0bd7877 lib/tool_shed/util/export_util.py --- a/lib/tool_shed/util/export_util.py +++ b/lib/tool_shed/util/export_util.py @@ -103,7 +103,7 @@ attributes, sub_elements = get_repository_attributes_and_sub_elements( ordered_repository, archive_name ) elem = xml_util.create_element( 'repository', attributes=attributes, sub_elements=sub_elements ) exported_repository_registry.exported_repository_elems.append( elem ) - shutil.rmtree( work_dir ) + suc.remove_dir( work_dir ) # Keep information about the export in a file name export_info.xml in the archive. sub_elements = generate_export_elem( tool_shed_url, repository, changeset_revision, export_repository_dependencies, api ) export_elem = xml_util.create_element( 'export_info', attributes=None, sub_elements=sub_elements ) diff -r c70a6f517aa96506b3245db857025f567aac0511 -r 521b4ff9060b72f1f8c9f5977f8c4fa2b0bd7877 lib/tool_shed/util/metadata_util.py --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -747,6 +747,7 @@ # Reset the value of the app's tool_data_path and tool_data_table_config_path to their respective original values. app.config.tool_data_path = original_tool_data_path app.config.tool_data_table_config_path = original_tool_data_table_config_path + suc.remove_dir( work_dir ) return metadata_dict, invalid_file_tups def generate_package_dependency_metadata( app, elem, valid_tool_dependencies_dict, invalid_tool_dependencies_dict ): Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org