Skip to content

Commit

Permalink
Make container resolution via dependency API optional, off by default.
Browse files Browse the repository at this point in the history
Makes resolution grid a dependency resolution grid. Deviates from the previous legacy API by not showing containers now - reasons for this are laid out here - galaxyproject#7125 (comment).
  • Loading branch information
jmchilton committed Nov 7, 2019
1 parent 4886e2d commit fa67bf0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 15 deletions.
10 changes: 5 additions & 5 deletions client/galaxy/scripts/components/admin/Dependencies/Landing.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<div>
<b-nav tabs>
<b-nav-item v-bind:active="mode == 'resolution'" @click="setMode('resolution')">Resolution</b-nav-item>
<b-nav-item v-bind:active="mode == 'container'" @click="setMode('container')">Container</b-nav-item>
<b-nav-item v-bind:active="mode == 'dependencies'" @click="setMode('dependencies')">Dependencies</b-nav-item>
<b-nav-item v-bind:active="mode == 'containers'" @click="setMode('containers')">Containers</b-nav-item>
<b-nav-item v-bind:active="mode == 'unused'" @click="setMode('unused')">Unused</b-nav-item>
</b-nav>
<resolution-index v-if="mode == 'resolution'" />
<container-index v-else-if="mode == 'container'" />
<resolution-index v-if="mode == 'dependencies'" />
<container-index v-else-if="mode == 'containers'" />
<unused-index v-else-if="mode == 'unused'" />
</div>
</template>
Expand All @@ -24,7 +24,7 @@ export default {
components: { ContainerIndex, ResolutionIndex, UnusedIndex },
data: function() {
return {
mode: "resolution"
mode: "dependencies"
};
},
methods: {
Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/tool_util/deps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def _requirements_to_dependencies_dict(self, requirements, search=False, **kwds)
index = kwds.get('index')
install = kwds.get('install', False)
resolver_type = kwds.get('resolver_type')
include_containers = kwds.get('include_containers', False)
container_type = kwds.get('container_type')
require_exact = kwds.get('exact', False)
return_null_dependencies = kwds.get('return_null', False)
Expand Down Expand Up @@ -239,6 +240,8 @@ def _requirements_to_dependencies_dict(self, requirements, search=False, **kwds)
if hasattr(resolver, "resolve_all"):
resolve = resolver.resolve_all
elif isinstance(resolver, ContainerResolver):
if not include_containers:
continue
if not install and resolver.builds_on_resolution:
# don't want to build images here
continue
Expand Down
4 changes: 4 additions & 0 deletions lib/galaxy/tool_util/deps/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ def summarize_requirements(self, **kwds):
summary_kwds = {}
if 'index' in kwds:
summary_kwds['index'] = int(kwds['index'])
if 'include_containers' in kwds:
summary_kwds['include_containers'] = asbool(kwds['include_containers'])
if 'container_type' in kwds:
summary_kwds['container_type'] = kwds['container_type']
if 'resolver_type' in kwds:
Expand Down Expand Up @@ -257,6 +259,8 @@ def summarize_tools(self, **kwds):
summary_kwds = {}
if 'index' in kwds:
summary_kwds['index'] = int(kwds['index'])
if 'include_containers' in kwds:
summary_kwds['include_containers'] = asbool(kwds['include_containers'])
if 'container_type' in kwds:
summary_kwds['container_type'] = kwds['container_type']
if 'resolver_type' in kwds:
Expand Down
43 changes: 33 additions & 10 deletions lib/galaxy/webapps/galaxy/api/tool_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,23 @@ def summarize_toolbox(self, trans, **kwds):
Summarize requirements across toolbox (for Tool Management grid). This is an experiemental
API particularly tied to the GUI - expect breaking changes until this notice is removed.
Container resolution via this API is especially experimental and the container resolution
API should be used to summarize this information instead in most cases.
:type index: int
:param index: index of the dependency resolver
:type tool_ids: str
:param tool_ids: tool_id to install dependency for
:type resolver_type: str
:param resolver_type: restrict to uninstall to specified resolver type
:type include_containers: bool
:param include_containers: include container resolvers in resolution
:type container_type: str
:param container_type: restrict to uninstall to specified container type
:type index_by: str
:param index_by: By default consider only context of requirements, group tools by requirements.
Set this to 'tools' to summarize across all tools though. Tools may provide additional
context for container resolution for instance.
:rtype: list
:returns: dictified descriptions of the dependencies, with attribute
Expand All @@ -224,19 +237,24 @@ def toolbox_install(self, trans, payload, index=None, **kwds):
:param index: index of the dependency resolver
:type tool_ids: str
:param tool_ids: tool_id to install dependency for
:type container_type: str
:param container_type: restrict to uninstall to specified container type
:type resolver_type: str
:param resolver_type: restrict to uninstall to specified resolver type
:type include_containers: bool
:param include_containers: include container resolvers in resolution
:type container_type: str
:param container_type: restrict to uninstall to specified container type
"""
tools_by_id = trans.app.toolbox.tools_by_id.copy()
tool_ids = payload.get("tool_ids")
requirements = set([tools_by_id[tid].tool_requirements for tid in tool_ids])
install_kwds = {}
if 'container_type' in payload:
install_kwds['container_type'] = payload['container_type']
if 'resolver_type' in kwds:
install_kwds['resolver_type'] = payload['resolver_type']
for source in [payload, kwds]:
if 'include_containers' in source:
install_kwds['include_containers'] = source['container_type']
if 'container_type' in kwds:
install_kwds['container_type'] = source['container_type']
if 'resolver_type' in source:
install_kwds['resolver_type'] = source['resolver_type']
[self._view.install_dependencies(requirements=r, index=index, **install_kwds) for r in requirements]

@expose_api
Expand All @@ -253,6 +271,8 @@ def toolbox_uninstall(self, trans, payload, index=None, **kwds):
:param index: index of the dependency resolver
:type tool_ids: str
:param tool_ids: tool_id to install dependency for
:type include_containers: bool
:param include_containers: include container resolvers in resolution
:type container_type: str
:param container_type: restrict to uninstall to specified container type
:type resolver_type: str
Expand All @@ -262,10 +282,13 @@ def toolbox_uninstall(self, trans, payload, index=None, **kwds):
tool_ids = payload.get("tool_ids")
requirements = set([tools_by_id[tid].tool_requirements for tid in tool_ids])
install_kwds = {}
if 'container_type' in payload:
install_kwds['container_type'] = payload['container_type']
if 'resolver_type' in kwds:
install_kwds['resolver_type'] = payload['resolver_type']
for source in [payload, kwds]:
if 'include_containers' in source:
install_kwds['include_containers'] = source['container_type']
if 'container_type' in kwds:
install_kwds['container_type'] = source['container_type']
if 'resolver_type' in source:
install_kwds['resolver_type'] = source['resolver_type']

[self._view.uninstall_dependencies(index=index, requirements=r, **install_kwds) for r in requirements]

Expand Down

0 comments on commit fa67bf0

Please sign in to comment.