Example #1
0
 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)
Example #2
0
 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)
Example #3
0
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)
Example #4
0
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)
Example #5
0
 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)
Example #6
0
    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
Example #7
0
    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)
Example #8
0
    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)
Example #9
0
    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
Example #10
0
    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
Example #11
0
    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
Example #12
0
 def kill(self):
     kill_pid_file(self.pid_file)
Example #13
0
 def kill(self):
     kill_pid_file(self.pid_file)