Skip to content

Commit

Permalink
Merge pull request #1298 from mvdbeek/extend_startup_time
Browse files Browse the repository at this point in the history
Make startup timeout configurable
  • Loading branch information
martenson committed Oct 19, 2022
2 parents 053eb01 + 37c4ff6 commit 2de34aa
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions planemo/galaxy/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def _serve(ctx, runnables, **kwds):
raise Exception(message)
host = kwds.get("host", "127.0.0.1")

timeout = 500
startup_timeout = kwds.get("galaxy_startup_timeout", 900)
galaxy_url = f"http://{host}:{port}"
galaxy_alive = sleep(galaxy_url, verbose=ctx.verbose, timeout=timeout)
galaxy_alive = sleep(galaxy_url, verbose=ctx.verbose, timeout=startup_timeout)
if not galaxy_alive:
raise Exception(
"Attempted to serve Galaxy at %s, but it failed to start in %d seconds." % (galaxy_url, timeout)
f"Attempted to serve Galaxy at {galaxy_url}, but it failed to start in {startup_timeout} seconds."
)
config.install_workflows()
if kwds.get("pid_file"):
Expand Down
10 changes: 10 additions & 0 deletions planemo/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,15 @@ def mulled_containers_option():
)


def galaxy_startup_timeout_option():
return planemo_option(
"--galaxy_startup_timeout",
type=click.IntRange(1),
default=900,
help="Wait for galaxy to start before assuming Galaxy did not start.",
)


def install_galaxy_option():
return planemo_option(
"--install_galaxy", is_flag=True, help="Download and configure a disposable copy of Galaxy from github."
Expand Down Expand Up @@ -1191,6 +1200,7 @@ def galaxy_target_options():
galaxy_email_option(),
galaxy_docker_options(),
mulled_containers_option(),
galaxy_startup_timeout_option(),
# Profile options...
job_config_option(),
tool_dependency_dir_option(),
Expand Down
10 changes: 10 additions & 0 deletions tests/test_cmd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
class CmdTestTestCase(CliTestCase):
"""Integration tests for the ``test`` command."""

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
def test_startup_timeout(self):
"""Test --galaxy_startup_timeout."""
with self._isolate():
test_artifact = os.path.join(TEST_DATA_DIR, DATA_MANAGER_TEST_PATH)
test_command = self._test_command(
"--galaxy_startup_timeout", "1", test_artifact, "--no_dependency_resolution"
)
self._check_exit_code(test_command, exit_code=1)

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
def test_data_manager(self):
"""Test testing a data manager test."""
Expand Down

0 comments on commit 2de34aa

Please sign in to comment.