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

Micromamba + cache full example #66

Closed
adriangb opened this issue Aug 23, 2020 · 6 comments
Closed

Micromamba + cache full example #66

adriangb opened this issue Aug 23, 2020 · 6 comments

Comments

@adriangb
Copy link

adriangb commented Aug 23, 2020

Hi, I'm trying to get the absolute fastest times, especially on windows. I see that over at mamba, micromamba is soon going to support windows soon (link) and support for installing form files at some point (mamba-org/mamba#461). It would be really cool to be able to use this action + cache + micromamba for what I assume is going to be blazing fast installs. Once they get windows working (or maybe before) it would be great to get support and a full example of that combination here.

I would imagine this would look something like this:

     - name: Cache conda/mamba
        uses: actions/cache@v2
        env:
          CACHE_NUMBER: 0
        with:
          path: ~/conda_pkgs_dir
          key: conda-${{ runner.os }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('test-env.yml') }}

      - name: Setup micromamba
        uses: goanpeca/setup-miniconda@v1
        with:
          channels: conda-forge
          activate-environment: test
          micromamba-version: "*"
          use-only-tar-bz2: true  # requried for caching
          environment-file: test-env.yml

      - name: Show conda environment
        shell: bash -l {0}
        run: |
          micromamba list

Hopefully this would the first run download and install micromamba and then use micromamba to install the test environment using test-env.yml.

Subsequent runs would then use micromamba from the cache (i.e. no need to re-download and re-install micromamba since it's a single file) and just activate/update the test env.

@goanpeca
Copy link
Member

goanpeca commented Aug 23, 2020

Hi @adriangb thanks for the suggestion.

When micromamba becomes available, it will probably require its own Github action. Some things to keep in mind:

  • Always having to download micromamba and install will be slower, than having it bundled in the Github Worker, but to make that happen mamba requires more adoption.
  • Cache is a balance between how much time it takes to download, how much time it takes to zip the package cache and how much time it takes to unzip it, so there are cases were caching

I don't really see an advantage over bundled miniconda (what comes with the Github Worker and just installing mamba from there. Am I missing something 🙃 ?

@adriangb
Copy link
Author

adriangb commented Aug 23, 2020

I may be misunderstanding how this action works, but...

Currently this uses the bundled miniconda to download the latest mamba? Are you saying that this will be faster than downloading micromamba directly, so there's no point in using micromamba?

@goanpeca
Copy link
Member

goanpeca commented Aug 23, 2020

Currently this uses the bundled miniconda to download the latest mamba? Are you saying that this will be faster than downloading micromamba directly, so there's no point in using micromamba?

Yep. Unless micromamba comes preinstalled in the Github Runners, which would avoid a download and an install step, then I see no real gain.

There may be a very small gain 🤷 , but I would say it is marginal as long as we depend on a network to download things.

@adriangb
Copy link
Author

adriangb commented Aug 23, 2020

That makes sense. So if I want the fastest installs, would the following be my best bet:

     - name: Cache conda/mamba
        uses: actions/cache@v2
        env:
          CACHE_NUMBER: 0
        with:
          path: ~/conda_pkgs_dir
          key: conda-${{ runner.os }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('test-env.yml') }}

      - name: Setup mamba
        uses: goanpeca/setup-miniconda@v1
        with:
          channels: conda-forge
          activate-environment: test
          mamba-version: "*"
          use-only-tar-bz2: true  # requried for caching
          environment-file: test-env.yml

      - name: Show conda environment
        shell: bash -l {0}
        run: |
          mamba list

@goanpeca
Copy link
Member

goanpeca commented Aug 23, 2020

That makes sense. So if I want the fastest installs, would the following be my best bet:

Yes, but it may depend on the other items I mentioned before:

  • Time it takes to download
  • Time it takes to zip the package cache
  • Time it takes to unzip it,

Depending on how small/big your env is, it might be worth to cache, or it may not be worth it. And I do not have a rule of thumb.... 🤷

@adriangb
Copy link
Author

Makes sense, I'll have to test both ways!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants