Skip to content

Implement beta support for discovering mulled containers for dependencies.#2986

Merged
martenson merged 7 commits intogalaxyproject:devfrom
jmchilton:mulled
Oct 11, 2016
Merged

Implement beta support for discovering mulled containers for dependencies.#2986
martenson merged 7 commits intogalaxyproject:devfrom
jmchilton:mulled

Conversation

@jmchilton
Copy link
Member

@jmchilton jmchilton commented Sep 29, 2016

tl;dr - Free community managed Docker containers for all tools whose requirements are resolvable with bioconda.

Brings in the latest mulled work that was migrated into galaxy-lib and made to work with combinations of requirements, local caching, non-bioconda channels, etc....

The local test can be run with the following commands:

virtualenv planemo-venv
. planemo-venv/bin/activate
pip install --upgrade pip 
pip install planemo 
planemo serve --galaxy_root . --mulled_containers test/functional/tools/mulled_example_multi_1.xml
# Open localhost:9090 and run the example tool - you will see Galaxy build the container on the fly.

Then open a web browser and run the new test tool - it should find the container you built and use it without any explicit markup required in the tool XML.

This demonstrates the local cached mulled containers - but remote ones on quay.io will also be used dynamically if GALAXY_CONFIG_ENABLE_BETA_MULLED_CONTAINERS is enabled - such as the ones @bgruening built for every package in bioconda.

Update: Replaced old manual test description with much more automated approach using new release of planemo leveraging all this magic. Old instructions were:

virtualenv .galaxy-lib-venv
. .galaxy-lib-venv/bin/activate
pip install galaxy-lib
mulled-build-tool build test/functional/tools/mulled_example_multi_1.xml  # Builds a mulled container locally for tool.
export GALAXY_CONFIG_ENABLE_BETA_MULLED_CONTAINERS=True
emacs config/job_conf.xml # Configure a Docker-enabled destination for mulled_example_multi_1
GALAXY_RUN_WITH_TEST_TOOLS=1 sh run.sh

@@ -0,0 +1,18 @@
<tool id="mulled_example_multi_1" name="mulled_example_multi_1" version="0.1.0">
<command><![CDATA[
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this tool test anything? It also fails planemo lint ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the test tools fail planemo lint. As for the tests - I don't have any because this tool really depends on the dependency resolvers working which none of the other framework test tools do. I want them testing the core tool framework - not the ... lets say dependency resolution ecosystem.

@bgruening
Copy link
Member

Obviously I'm a huge fan of this and because it contains code from us I will not vote. Just one thing this PR contains some useful tools for handling/searching mulled containers and I'm not sure these should be under lib/, but I see that these are useful in galaxy-lib for planemo etc...

Moreover, thanks a lot to @thriqon who's master thesis made all this possible!

@jmchilton jmchilton changed the title Implement beta support for discovering mulled containers for dependencies. [WIP] Implement beta support for discovering mulled containers for dependencies. Sep 30, 2016
else:
name = image_name(targets)
for cached_image in cached_images:
if name == cached_image.hash:
Copy link
Member

@mvdbeek mvdbeek Oct 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cached_image can be aCachedMulledImageSingleTarget that doesn't have a hash attribute, right? if cached_image.multi_target and name == cached_image.hash: should be OK

raise Exception("requets library is unavailable, functionality not available.")

url = 'https://quay.io/api/v1/repository/%s/%s' % (namespace, pkg_name)
response = requests.get(url, timeout=None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fails with:

galaxy.tools.deps.mulled.util WARNING 2016-10-02 11:41:39,416 {u'status': 401, u'error_message': u'Requires authentication', u'title': u'invalid_token', u'error_type': u'invalid_token', u'detail': u'Requires authentication', u'type': u'https://quay.io/api/v1/error/invalid_token'}

Copy link
Member

@mvdbeek mvdbeek Oct 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, I'm using something like https://gist.github.com/mvdbeek/5e48d2c21c1440e22bda895769f5e450 for v2 registries.
seems that you get a 401 also if the repository doesn't exist ...

@mvdbeek
Copy link
Member

mvdbeek commented Oct 2, 2016

Amazing! If there is only a single requirement to resolve it even works with my WIP udocker implementation.

jmchilton added a commit to galaxyproject/galaxy-lib that referenced this pull request Oct 3, 2016
@jmchilton
Copy link
Member Author

Okay - I've pushed through another iteration on this. I've:

  • Fixed the problem referenced by @mvdbeek if the mulled dependency is missing on quay.io.
  • Added another container resolver that will actually just build the container as needed - it comes after checking if they are locally cached or available on quay.io.
  • Made it so that involucro - the tool that handles the Docker interactions when building mulled containers - will install on-demand.
  • Added more documentation to galaxy.ini.sample.
  • Added the destination option requires_container - to force job destinations to run containerized jobs and fail if a relevant container is not configured (either by the tool author or deployer). This will enable planemo to force containers to be available during testing and quickly signal an obvious error if they are not.
  • Update galaxy-lib with some other changes to enable all of this.

@jmchilton jmchilton changed the title [WIP] Implement beta support for discovering mulled containers for dependencies. Implement beta support for discovering mulled containers for dependencies. Oct 3, 2016
@jmchilton
Copy link
Member Author

Did a release of planemo which again greatly reduces the barrier to testing this PR. The new --mulled_containers flag should take care of configuring the resolvers and setting a job_conf.xml with Docker enabled. I update the PR description with new testing instructions.

@natefoo
Copy link
Member

natefoo commented Oct 5, 2016

👍 this is amazing.

@bgruening
Copy link
Member

Oh, we have a 👍 @jmchilton we have a 👍 :)
I think I need to adopt it to the new namespace, but hey we have a 👍 !!!!

…for dependencies.

Contains all mulled fixes and enhancements through 16.10.7 including several bug fixes from @bgruening.
This is great for security in production. For my own greedy concerns, I'm adding it for development however. I don't want someone to be testing mulled containers and accidently run the job locally.
@jmchilton
Copy link
Member Author

Updated to include the latest fixes from @bgruening's work downstream in galaxy-lib (through version 16.10.7 of that library) and rebased into two clean, atomic commits.

@martenson
Copy link
Member

to trigger retesting

@martenson martenson closed this Oct 10, 2016
@martenson martenson reopened this Oct 10, 2016
@martenson martenson merged commit 7db241f into galaxyproject:dev Oct 11, 2016
@jmchilton
Copy link
Member Author

Thanks for the reviews all and thanks for the merge @martenson!

@bgruening
Copy link
Member

🎉 🎈 I think I take a week off - this PR is awesome!
Docker for free for everyone!

mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Oct 28, 2016
Similar to galaxyproject#2986, implement
a mechanism that allows tool dependencies to be cached.

If the `use_cached_dependency_manager` option is set to True in
galaxy.ini, we build a hash of the combination of a tools' requirements,
and store the resulting environment in a directory specified by the
`tool_dependency_cache_dir` option in galaxy.ini.
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Oct 28, 2016
Similar to galaxyproject#2986, implement
a mechanism that allows tool dependencies to be cached.

If the `use_cached_dependency_manager` option is set to True in
galaxy.ini, we build a hash of the combination of a tools' requirements,
and store the resulting environment in a directory specified by the
`tool_dependency_cache_dir` option in galaxy.ini.
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Oct 28, 2016
Similar to galaxyproject#2986, implement
a mechanism that allows tool dependencies to be cached.

If the `use_cached_dependency_manager` option is set to True in
galaxy.ini, we build a hash of the combination of a tools' requirements,
and store the resulting environment in a directory specified by the
`tool_dependency_cache_dir` option in galaxy.ini.
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Oct 28, 2016
Similar to galaxyproject#2986, implement
a mechanism that allows tool dependencies to be cached.

If the `use_cached_dependency_manager` option is set to True in
galaxy.ini, we build a hash of the combination of a tools' requirements,
and store the resulting environment in a directory specified by the
`tool_dependency_cache_dir` option in galaxy.ini.
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Nov 2, 2016
Similar to galaxyproject#2986, implement
a mechanism that allows tool dependencies to be cached.

If the `use_cached_dependency_manager` option is set to True in
galaxy.ini, we build a hash of the combination of a tools' requirements,
and store the resulting environment in a directory specified by the
`tool_dependency_cache_dir` option in galaxy.ini.
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Nov 7, 2016
Similar to galaxyproject#2986, implement
a mechanism that allows tool dependencies to be cached.

If the `use_cached_dependency_manager` option is set to True in
galaxy.ini, we build a hash of the combination of a tools' requirements,
and store the resulting environment in a directory specified by the
`tool_dependency_cache_dir` option in galaxy.ini.
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Nov 14, 2016
Similar to galaxyproject#2986, implement
a mechanism that allows tool dependencies to be cached.

If the `use_cached_dependency_manager` option is set to True in
galaxy.ini, we build a hash of the combination of a tools' requirements,
and store the resulting environment in a directory specified by the
`tool_dependency_cache_dir` option in galaxy.ini.
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Nov 23, 2016
Similar to galaxyproject#2986, implement
a mechanism that allows tool dependencies to be cached.

If the `use_cached_dependency_manager` option is set to True in
galaxy.ini, we build a hash of the combination of a tools' requirements,
and store the resulting environment in a directory specified by the
`tool_dependency_cache_dir` option in galaxy.ini.
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Nov 29, 2016
Similar to galaxyproject#2986, implement
a mechanism that allows tool dependencies to be cached.

If the `use_cached_dependency_manager` option is set to True in
galaxy.ini, we build a hash of the combination of a tools' requirements,
and store the resulting environment in a directory specified by the
`tool_dependency_cache_dir` option in galaxy.ini.
jmchilton added a commit to jmchilton/galaxy that referenced this pull request Dec 20, 2016
Fix thanks to @stevecassidy. Fixes galaxyproject#3207.

Broken with introduction of container resolution stradegies in galaxyproject#2986.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants