def test_serve_daemon(self): extra_args = ["--daemon", "--pid_file", self._pid_file] self._launch_thread_and_wait(self._run, extra_args) user_gi = self._user_gi assert len(user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0 user_gi.histories.create_history(TEST_HISTORY_NAME) kill_pid_file(self._pid_file)
def cli_daemon_galaxy(runner, pid_file, port, command_list, exit_code=0): t = launch_and_wait_for_galaxy(port, check_exit_code, args=[runner, command_list, exit_code]) yield io.kill_pid_file(pid_file) t.join(timeout=60)
def cli_daemon_galaxy(runner, pid_file, port, command_list, exit_code=0): future = launch_and_wait_for_galaxy(port, check_exit_code, args=[runner, command_list, exit_code]) yield io.kill_pid_file(pid_file) _wait_on_future_suppress_exception(future)
def kill(self): if self._ctx.verbose: shell(["ps", "ax"]) exists = os.path.exists(self.pid_file) print("Killing pid file [%s]" % self.pid_file) print("pid_file exists? [%s]" % exists) if exists: print("pid_file contents are [%s]" % open(self.pid_file, "r").read()) kill_pid_file(self.pid_file)
def _test_serve_profile(self, *db_options): new_profile = "planemo_test_profile_%s" % uuid.uuid4() extra_args = [ "--daemon", "--pid_file", self._pid_file, "--profile", new_profile, ] extra_args.extend(db_options) self._launch_thread_and_wait(self._run, extra_args) user_gi = self._user_gi assert len(user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0 user_gi.histories.create_history(TEST_HISTORY_NAME) kill_pid_file(self._pid_file) self._launch_thread_and_wait(self._run, extra_args) assert len(user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 1
def test_shed_serve(self): extra_args = ["--daemon", "--pid_file", self._pid_file, "--shed_target", "toolshed"] fastqc_path = os.path.join(TEST_REPOS_DIR, "fastqc") self._serve_artifact = fastqc_path self._launch_thread_and_wait(self._run_shed, extra_args) user_gi = self._user_gi found = False tool_ids = None for i in range(30): tool_ids = [t["id"] for t in user_gi.tools.get_tools()] if "toolshed.g2.bx.psu.edu/repos/devteam/fastqc/fastqc/0.71" in tool_ids: found = True break time.sleep(5) assert found, "Failed to find fastqc id in %s" % tool_ids kill_pid_file(self._pid_file)
def test_shed_serve(self): extra_args = ["--daemon", "--pid_file", self._pid_file, "--shed_target", "toolshed"] fastqc_path = os.path.join(TEST_REPOS_DIR, "fastqc") self._serve_artifact = fastqc_path self._launch_thread_and_wait(self._run_shed, extra_args) user_gi = self._user_gi found = False tool_ids = None for i in range(30): tool_ids = [t["id"] for t in user_gi.tools.get_tools()] if any(_.startswith("toolshed.g2.bx.psu.edu/repos/devteam/fastqc/fastqc/") for _ in tool_ids): found = True break time.sleep(5) assert found, "Failed to find fastqc id in %s" % tool_ids kill_pid_file(self._pid_file)
def test_serve_profile(self): port = network_util.get_free_port() pid_file = os.path.join(self._home, "test.pid") extra_args = [ "--daemon", "--pid_file", pid_file, "--profile", "moo", ] serve = functools.partial(self._run, port, extra_args) self._launch_thread_and_wait(serve, port) assert network_util.wait_net_service("127.0.0.1", port) admin_gi = api.gi(port) user_api_key = api.user_api_key(admin_gi) user_gi = api.gi(port, user_api_key) assert len(user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0 user_gi.histories.create_history(TEST_HISTORY_NAME) kill_pid_file(pid_file) self._launch_thread_and_wait(serve, port) assert len(user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 1
def _test_serve_profile(self, *db_options): new_profile = "planemo_test_profile_%s" % uuid.uuid4() extra_args = [ "--daemon", "--pid_file", self._pid_file, "--profile", new_profile, ] extra_args.extend(db_options) self._launch_thread_and_wait(self._run, extra_args) user_gi = self._user_gi assert len( user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0 user_gi.histories.create_history(TEST_HISTORY_NAME) kill_pid_file(self._pid_file) self._launch_thread_and_wait(self._run, extra_args) assert len( user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 1
def test_serve_profile(self): port = network_util.get_free_port() pid_file = os.path.join(self._home, "test.pid") extra_args = [ "--daemon", "--pid_file", pid_file, "--profile", "moo", ] serve = functools.partial(self._run, port, extra_args) self._launch_thread_and_wait(serve, port) assert network_util.wait_net_service("127.0.0.1", port) admin_gi = api.gi(port) user_api_key = api.user_api_key(admin_gi) user_gi = api.gi(port, user_api_key) assert len( user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0 user_gi.histories.create_history(TEST_HISTORY_NAME) kill_pid_file(pid_file) self._launch_thread_and_wait(serve, port) assert len( user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 1
def kill(self): kill_pid_file(self.pid_file)