Navigation Menu

Skip to content

Commit

Permalink
Fix test case for tool manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Sep 1, 2016
1 parent 99acb36 commit 9f7c749
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
9 changes: 9 additions & 0 deletions lib/galaxy/config.py
Expand Up @@ -13,7 +13,9 @@
import string
import sys
import tempfile
import time
import threading

from datetime import timedelta

from six import string_types
Expand Down Expand Up @@ -800,6 +802,13 @@ class ConfiguresGalaxyMixin:
def _configure_genome_builds( self, data_table_name="__dbkeys__", load_old_style=True ):
self.genome_builds = GenomeBuilds( self, data_table_name=data_table_name, load_old_style=load_old_style )

def wait_for_toolbox_reload(self, old_toolbox):
while True:
# Wait till toolbox reload has been triggered
# and make sure toolbox has finished reloading)
if not self.toolbox.has_reloaded(old_toolbox):
time.sleep(1)

def reload_toolbox(self):
# Initialize the tools, making sure the list of tool configs includes the reserved migrated_tools_conf.xml file.

Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/tools/toolbox/base.py
Expand Up @@ -89,6 +89,9 @@ def __init__( self, config_filenames, tool_root_dir, app, tool_conf_watcher=None
self._load_tool_panel()
self._save_integrated_tool_panel()

def has_reloaded(self, other_toolbox):
return self._reload_count != other_toolbox._reload_count

def create_tool( self, config_file, repository_id=None, guid=None, **kwds ):
raise NotImplementedError()

Expand Down
7 changes: 2 additions & 5 deletions lib/tool_shed/galaxy_install/tools/tool_panel_manager.py
Expand Up @@ -36,12 +36,9 @@ def add_to_shed_tool_config( self, shed_tool_conf_dict, elem_list ):
for elem_entry in elem_list:
config_elems.append( elem_entry )
# Persist the altered shed_tool_config file.
reload_count = self.app.toolbox._reload_count
toolbox = self.app.toolbox
self.config_elems_to_xml_file( config_elems, shed_tool_conf, tool_path )
# Wait till toolbox reload has been triggered
# and make sure toolbox has finished reloading)
while self.app.toolbox._reload_count <= reload_count:
time.sleep(1)
self.app.wait_for_toolbox_reload(toolbox)

def add_to_tool_panel( self, repository_name, repository_clone_url, changeset_revision, repository_tools_tups, owner,
shed_tool_conf, tool_panel_dict, new_install=True, tool_panel_section_mapping={} ):
Expand Down
5 changes: 5 additions & 0 deletions test/unit/tools_support.py
Expand Up @@ -154,6 +154,11 @@ def __init__( self, test_directory, mock_model=True ):
self.name = "galaxy"
self._toolbox_lock = MockLock()

def wait_for_toolbox_reload(self, toolbox):
# TODO: If the tpm test case passes, does the operation really
# need to wait.
return True


class MockLock( object ):
def __enter__(self):
Expand Down

0 comments on commit 9f7c749

Please sign in to comment.