-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow adding new data tables without restart #4617
Merged
jmchilton
merged 10 commits into
galaxyproject:dev
from
mvdbeek:data_manager_watch_new_tables
Sep 19, 2017
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3f38e81
Update tables to watch when installing new data manager
mvdbeek 843d2e4
Assign correct guids to DM tools after TS install
mvdbeek d06fb09
Make DynamicOptions use updated tool_data_tables
mvdbeek 2e6654b
Linting fixes
mvdbeek a4c4d82
Make watchdog a conditional dependency
mvdbeek 4b40300
Remove unused root_dir argument
mvdbeek 2d844a8
Add watchdog to dev-requirements so it is available for integration t…
mvdbeek 9d3af63
Skip DataManagerIntegrationTestCase when watchdog unavailable
mvdbeek 706434d
Append temp dirs to test_driver list of temp dirs
mvdbeek 642aaa8
Do cleanup if skip_cleanup is not set
mvdbeek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,5 @@ chronos-python==0.38.0 | |
|
||
# Synnefo / Pithos+ object store client | ||
kamaki | ||
|
||
watchdog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ NoseHTML | |
twill==0.9.1 | ||
mock | ||
selenium | ||
watchdog | ||
|
||
# For relase process | ||
pygithub3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import os | ||
import random | ||
import shutil | ||
import string | ||
import tempfile | ||
|
||
from base import integration_util | ||
from base.populators import DatasetPopulator | ||
from nose.plugins.skip import SkipTest | ||
|
||
|
||
SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__)) | ||
TOOL_SHEDS_CONF = os.path.join(SCRIPT_DIRECTORY, "tool_sheds_conf.xml") | ||
|
||
SHED_TOOL_CONF = string.Template("""<?xml version="1.0"?> | ||
<toolbox tool_path="$shed_tools_path"> | ||
</toolbox>""") | ||
|
||
SHED_DATA_MANAGER_CONF = """<?xml version="1.0"?> | ||
<data_managers> | ||
</data_managers>""" | ||
|
||
SHED_DATA_TABLES = """<?xml version="1.0"?> | ||
<tables> | ||
</tables>""" | ||
|
||
CREATE_DBKEY_PAYLOAD = {'tool_shed_url': 'https://toolshed.g2.bx.psu.edu', | ||
'name': 'data_manager_fetch_genome_dbkeys_all_fasta', | ||
'owner': 'devteam', | ||
'changeset_revision': 'b1bc53e9bbc5'} | ||
SAM_FASTA_PAYLOAD = {'tool_shed_url': 'https://toolshed.g2.bx.psu.edu', | ||
'name': 'data_manager_sam_fasta_index_builder', | ||
'owner': 'devteam', | ||
'changeset_revision': '1865e693d8b2'} | ||
FETCH_TOOL_ID = 'toolshed.g2.bx.psu.edu/repos/devteam/data_manager_fetch_genome_dbkeys_all_fasta/data_manager_fetch_genome_all_fasta_dbkey/0.0.2' | ||
FETCH_GENOME_DBKEYS_ALL_FASTA_INPUT = {"dbkey_source|dbkey_source_selector": "new", | ||
"dbkey_source|dbkey": "NC_001617.1", | ||
"dbkey_source|dbkey_name": "NC_001617.1", | ||
"sequence_name": "NC_001617.1", | ||
"sequence_id": "NC_001617.1", | ||
"reference_source|reference_source_selector": "ncbi", | ||
"reference_source|requested_identifier": "NC_001617.1", | ||
"sorting|sort_selector": "as_is"} | ||
SAM_FASTA_ID = "toolshed.g2.bx.psu.edu/repos/devteam/data_manager_sam_fasta_index_builder/sam_fasta_index_builder/0.0.2" | ||
SAM_FASTA_INPUT = {"all_fasta_source": "NC_001617.1", "sequence_name": "", "sequence_id": ""} | ||
|
||
|
||
class DataManagerIntegrationTestCase(integration_util.IntegrationTestCase): | ||
|
||
"""Test data manager installation and table reload through the API""" | ||
|
||
framework_tool_and_types = True | ||
|
||
def setUp(self): | ||
super(DataManagerIntegrationTestCase, self).setUp() | ||
self.dataset_populator = DatasetPopulator(self.galaxy_interactor) | ||
|
||
@classmethod | ||
def handle_galaxy_config_kwds(cls, config): | ||
try: | ||
import watchdog # noqa: F401 | ||
except ImportError: | ||
raise SkipTest("watchdog library is not available") | ||
cls.username = cls.get_secure_ascii_digits() | ||
cls.conda_tmp_prefix = tempfile.mkdtemp() | ||
cls.shed_tools_dir = tempfile.mkdtemp() | ||
cls.shed_tool_data_dir = tempfile.mkdtemp() | ||
config["conda_auto_init"] = True | ||
config["conda_auto_install"] = True | ||
config["conda_prefix"] = os.path.join(cls.conda_tmp_prefix, 'conda') | ||
config["tool_sheds_config_file"] = TOOL_SHEDS_CONF | ||
config["tool_config_file"] = os.path.join(cls.shed_tools_dir, 'shed_tool_conf.xml') | ||
config["shed_data_manager_config_file"] = os.path.join(cls.shed_tool_data_dir, 'shed_data_manager_config_file') | ||
config["shed_tool_data_table_config"] = os.path.join(cls.shed_tool_data_dir, 'shed_data_table_conf.xml') | ||
config["shed_tool_data_path"] = cls.shed_tool_data_dir | ||
config["tool_data_path"] = cls.shed_tool_data_dir | ||
config["watch_tool_data_dir"] = True | ||
config["admin_users"] = "%s@galaxy.org" % cls.username | ||
with open(config["tool_config_file"], 'w') as tool_conf_file: | ||
tool_conf_file.write(SHED_TOOL_CONF.substitute(shed_tools_path=cls.shed_tools_dir)) | ||
with open(config["shed_data_manager_config_file"], 'w') as shed_data_config: | ||
shed_data_config.write(SHED_DATA_MANAGER_CONF) | ||
with open(config["shed_tool_data_table_config"], 'w') as shed_data_table_config: | ||
shed_data_table_config.write(SHED_DATA_TABLES) | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
"""Shutdown Galaxy server and cleanup temp directory.""" | ||
for dir in [cls.conda_tmp_prefix, cls.shed_tool_data_dir, cls.shed_tools_dir]: | ||
shutil.rmtree(dir) | ||
cls._test_driver.tear_down() | ||
cls._app_available = False | ||
|
||
def test_data_manager_installation_table_reload(self): | ||
""" | ||
Test that we can install data managers, create a new dbkey, and use that dbkey in a downstream data manager. | ||
""" | ||
create_response = self._post('/tool_shed_repositories/new/install_repository_revision', data=CREATE_DBKEY_PAYLOAD, admin=True) | ||
self._assert_status_code_is(create_response, 200) | ||
create_response = self._post('/tool_shed_repositories/new/install_repository_revision', data=SAM_FASTA_PAYLOAD, admin=True) | ||
self._assert_status_code_is(create_response, 200) | ||
|
||
with self._different_user(email="%s@galaxy.org" % self.username): | ||
with self.dataset_populator.test_history() as history_id: | ||
run_response = self.dataset_populator.run_tool(tool_id=FETCH_TOOL_ID, | ||
inputs=FETCH_GENOME_DBKEYS_ALL_FASTA_INPUT, | ||
history_id=history_id, | ||
assert_ok=False) | ||
self.dataset_populator.wait_for_tool_run(history_id=history_id, run_response=run_response) | ||
run_response = self.dataset_populator.run_tool(tool_id=SAM_FASTA_ID, | ||
inputs=SAM_FASTA_INPUT, | ||
history_id=history_id, | ||
assert_ok=False) | ||
self.dataset_populator.wait_for_tool_run(history_id=history_id, run_response=run_response) | ||
|
||
def create_local_user(self): | ||
"""Creates a local user and returns the user id.""" | ||
password = self.get_secure_ascii_digits() | ||
payload = {'username': self.username, | ||
'password': password, | ||
'email': "%s@galaxy.org" % self.username} | ||
create_response = self._post('/users', data=payload, admin=True) | ||
self._assert_status_code_is(create_response, 200) | ||
response = create_response.json() | ||
return response['id'] | ||
|
||
def create_api_key_for_user(self, user_id): | ||
create_response = self._post("/users/%s/api_key" % user_id, data={}, admin=True) | ||
self._assert_status_code_is(create_response, 200) | ||
return create_response.json() | ||
|
||
@classmethod | ||
def get_secure_ascii_digits(cls, n=12): | ||
return ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.digits) for _ in range(12)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0"?> | ||
<tool_sheds> | ||
<tool_shed name="Galaxy Main Tool Shed" url="https://toolshed.g2.bx.psu.edu/"/> | ||
</tool_sheds> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about instead of overriding this you put and empty method called
_cleanup_galaxy()
that matches_prepare_galaxy()
in the base class and then just use that here. Might be even cleaner to define a list in parent class called_configuration_files
that you can just append to that will get cleaned up automatically. This way you don't need to do anything in this class besides register them and then later on we can make the tests respectGALAXY_TEST_NO_CLEANUP
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I like this idea so much I already implemented it. If you just append these directories to
self._test_driver.temp_directories
they should be taken care of automatically. No need to declare a tearDown method.