Skip to content
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

Improve shed install for workflows #1351

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions planemo/engine/galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ class GalaxyEngine(BaseEngine, metaclass=abc.ABCMeta):
def _run(self, runnables, job_paths):
"""Run job in Galaxy."""
results = []
for runnable, job_path in zip(runnables, job_paths):
self._ctx.vlog(f"Serving artifact [{runnable}] with Galaxy.")
with self.ensure_runnables_served([runnable]) as config:
self._ctx.vlog(f"Running job path [{job_path}]")
with self.ensure_runnables_served(runnables) as config:
for runnable, job_path in zip(runnables, job_paths):
self._ctx.log(f"Running [{runnable}] - [{job_path}] with Galaxy.")
if self._ctx.verbose:
self._ctx.log(f"Running Galaxy with API configuration [{config.user_api_config}]")
run_response = execute(self._ctx, config, runnable, job_path, **self._kwds)
Expand Down
21 changes: 16 additions & 5 deletions planemo/galaxy/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Callable,
Dict,
List,
TYPE_CHECKING,
)
from urllib.parse import urlparse

Expand All @@ -24,14 +25,23 @@
inputs_normalized,
outputs_normalized,
)
from typing_extensions import NamedTuple

from planemo.galaxy.api import gi
from planemo.io import warn

if TYPE_CHECKING:
from ephemeris.shed_tools import InstallRepoDict

FAILED_REPOSITORIES_MESSAGE = "Failed to install one or more repositories."
GALAXY_WORKFLOWS_PREFIX = "gxid://workflows/"


class InstalledShedRepos(NamedTuple):
installed_repositories: List["InstallRepoDict"]
updated_repositories: List["InstallRepoDict"]


def load_shed_repos(runnable):
if runnable.type.name != "galaxy_workflow":
return []
Expand Down Expand Up @@ -88,16 +98,17 @@ def install_shed_repos(
install_results.errored_repositories.extend(update_results.errored_repositories)
updated_repos = update_results.installed_repositories
else:
updated_repos = None
updated_repos = []

if install_results.errored_repositories:
msg = f"{FAILED_REPOSITORIES_MESSAGE}: \n{yaml.safe_dump(install_results.errored_repositories)}"
if ignore_dependency_problems:
warn(FAILED_REPOSITORIES_MESSAGE)
warn(msg)
else:
raise Exception(FAILED_REPOSITORIES_MESSAGE)
return install_results.installed_repositories, updated_repos
raise Exception(msg)
return InstalledShedRepos(install_results.installed_repositories, updated_repos)
else:
return None, None
return InstalledShedRepos([], [])


def import_workflow(path, admin_gi, user_gi, from_path=False):
Expand Down