2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/96abe113c582/ Changeset: 96abe113c582 Branch: next-stable User: greg Date: 2014-08-05 16:09:20 Summary: Fix for writing entries to shed_tool_conf.xml so that sym linked files are handled correctly (thanks Bjoern), and making changes to this and data manager config files thread-safe. Affected #: 2 files diff -r 7cacfb33db90dee8c4e9ce78a3a735cd6cef8490 -r 96abe113c582eed53fcf143bd516ad9cf5152c26 lib/tool_shed/galaxy_install/tools/data_manager.py --- a/lib/tool_shed/galaxy_install/tools/data_manager.py +++ b/lib/tool_shed/galaxy_install/tools/data_manager.py @@ -1,5 +1,6 @@ import logging import os +import threading from tool_shed.galaxy_install.tools import tool_panel_manager @@ -18,12 +19,19 @@ Persist the current in-memory list of config_elems to a file named by the value of config_filename. """ - fh = open( config_filename, 'wb' ) - fh.write( '<?xml version="1.0"?>\n<data_managers>\n' ) - for elem in config_elems: - fh.write( xml_util.xml_to_string( elem ) ) - fh.write( '</data_managers>\n' ) - fh.close() + lock = threading.Lock() + lock.acquire( True ) + try: + fh = open( config_filename, 'wb' ) + fh.write( '<?xml version="1.0"?>\n<data_managers>\n' ) + for elem in config_elems: + fh.write( xml_util.xml_to_string( elem ) ) + fh.write( '</data_managers>\n' ) + fh.close() + except Exception, e: + log.exception( "Exception in DataManagerHandler.data_manager_config_elems_to_xml_file: %s" % str( e ) ) + finally: + lock.release() def install_data_managers( self, shed_data_manager_conf_filename, metadata_dict, shed_config_dict, relative_install_dir, repository, repository_tools_tups ): diff -r 7cacfb33db90dee8c4e9ce78a3a735cd6cef8490 -r 96abe113c582eed53fcf143bd516ad9cf5152c26 lib/tool_shed/galaxy_install/tools/tool_panel_manager.py --- a/lib/tool_shed/galaxy_install/tools/tool_panel_manager.py +++ b/lib/tool_shed/galaxy_install/tools/tool_panel_manager.py @@ -1,7 +1,6 @@ import logging import os -import shutil -import tempfile +import threading import galaxy.tools from galaxy.tools.search import ToolBoxSearch @@ -90,15 +89,19 @@ Persist the current in-memory list of config_elems to a file named by the value of config_filename. """ - fd, filename = tempfile.mkstemp( prefix="tmp-toolshed-cetxf" ) - os.write( fd, '<?xml version="1.0"?>\n' ) - os.write( fd, '<toolbox tool_path="%s">\n' % str( tool_path ) ) - for elem in config_elems: - os.write( fd, '%s' % xml_util.xml_to_string( elem, use_indent=True ) ) - os.write( fd, '</toolbox>\n' ) - os.close( fd ) - shutil.move( filename, os.path.abspath( config_filename ) ) - os.chmod( config_filename, 0644 ) + lock = threading.Lock() + lock.acquire( True ) + try: + fh = open( config_filename, 'wb' ) + fh.write( '<?xml version="1.0"?>\n<toolbox tool_path="%s">\n' % str( tool_path ) ) + for elem in config_elems: + fh.write( xml_util.xml_to_string( elem, use_indent=True ) ) + fh.write( '</toolbox>\n' ) + fh.close() + except Exception, e: + log.exception( "Exception in ToolPanelManager.config_elems_to_xml_file: %s" % str( e ) ) + finally: + lock.release() def generate_tool_elem( self, tool_shed, repository_name, changeset_revision, owner, tool_file_path, tool, tool_section ): https://bitbucket.org/galaxy/galaxy-central/commits/626c583781a1/ Changeset: 626c583781a1 User: greg Date: 2014-08-05 16:09:56 Summary: Merged next-stable Affected #: 2 files diff -r 213a23e98fec2ad620483e36286ce4a35b3f7c1f -r 626c583781a1d6f2d550fb3c2c4b357f1f3d5273 lib/tool_shed/galaxy_install/tools/data_manager.py --- a/lib/tool_shed/galaxy_install/tools/data_manager.py +++ b/lib/tool_shed/galaxy_install/tools/data_manager.py @@ -1,5 +1,6 @@ import logging import os +import threading from tool_shed.galaxy_install.tools import tool_panel_manager @@ -18,12 +19,19 @@ Persist the current in-memory list of config_elems to a file named by the value of config_filename. """ - fh = open( config_filename, 'wb' ) - fh.write( '<?xml version="1.0"?>\n<data_managers>\n' ) - for elem in config_elems: - fh.write( xml_util.xml_to_string( elem ) ) - fh.write( '</data_managers>\n' ) - fh.close() + lock = threading.Lock() + lock.acquire( True ) + try: + fh = open( config_filename, 'wb' ) + fh.write( '<?xml version="1.0"?>\n<data_managers>\n' ) + for elem in config_elems: + fh.write( xml_util.xml_to_string( elem ) ) + fh.write( '</data_managers>\n' ) + fh.close() + except Exception, e: + log.exception( "Exception in DataManagerHandler.data_manager_config_elems_to_xml_file: %s" % str( e ) ) + finally: + lock.release() def install_data_managers( self, shed_data_manager_conf_filename, metadata_dict, shed_config_dict, relative_install_dir, repository, repository_tools_tups ): diff -r 213a23e98fec2ad620483e36286ce4a35b3f7c1f -r 626c583781a1d6f2d550fb3c2c4b357f1f3d5273 lib/tool_shed/galaxy_install/tools/tool_panel_manager.py --- a/lib/tool_shed/galaxy_install/tools/tool_panel_manager.py +++ b/lib/tool_shed/galaxy_install/tools/tool_panel_manager.py @@ -1,7 +1,6 @@ import logging import os -import shutil -import tempfile +import threading import galaxy.tools from galaxy.tools.search import ToolBoxSearch @@ -90,15 +89,19 @@ Persist the current in-memory list of config_elems to a file named by the value of config_filename. """ - fd, filename = tempfile.mkstemp( prefix="tmp-toolshed-cetxf" ) - os.write( fd, '<?xml version="1.0"?>\n' ) - os.write( fd, '<toolbox tool_path="%s">\n' % str( tool_path ) ) - for elem in config_elems: - os.write( fd, '%s' % xml_util.xml_to_string( elem, use_indent=True ) ) - os.write( fd, '</toolbox>\n' ) - os.close( fd ) - shutil.move( filename, os.path.abspath( config_filename ) ) - os.chmod( config_filename, 0644 ) + lock = threading.Lock() + lock.acquire( True ) + try: + fh = open( config_filename, 'wb' ) + fh.write( '<?xml version="1.0"?>\n<toolbox tool_path="%s">\n' % str( tool_path ) ) + for elem in config_elems: + fh.write( xml_util.xml_to_string( elem, use_indent=True ) ) + fh.write( '</toolbox>\n' ) + fh.close() + except Exception, e: + log.exception( "Exception in ToolPanelManager.config_elems_to_xml_file: %s" % str( e ) ) + finally: + lock.release() def generate_tool_elem( self, tool_shed, repository_name, changeset_revision, owner, tool_file_path, tool, tool_section ): 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.