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

Add 'channels' options; save cache on action failure; extend docs #45

Merged
merged 7 commits into from
May 9, 2022

Conversation

jonashaag
Copy link
Collaborator

@jonashaag jonashaag commented Mar 10, 2022

Rel #42

Closes #44

@jonashaag jonashaag marked this pull request as ready for review March 10, 2022 08:26
@jonashaag jonashaag marked this pull request as draft March 10, 2022 08:27
@jonashaag jonashaag force-pushed the cache-failure branch 2 times, most recently from cc5ce1b to 94117ea Compare March 10, 2022 09:16
@jonashaag
Copy link
Collaborator Author

Hah Screenshot 2022-03-10 at 10 22 54

@@ -104,11 +104,7 @@ async function installMicromambaPosix (micromambaUrl) {
linux: 'wget -qO- --retry-connrefused --waitretry=10 -t 5'
}[MAMBA_PLATFORM]
const downloadCmd = `${downloadProg} ${micromambaUrl} | tar -xvjO bin/micromamba > ${PATHS.micromambaExe}`
try {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Was that download retry there on purpose?

Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to have a retry of the micromamba download for a couple of times because there can always be some downtime (e.g. on the micromamba server or the anaconda server).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added something back.

@@ -37,24 +37,20 @@ function getInputAsArray (name) {
.filter(x => x !== '')
}

async function executeBash (command, opts = { setFailed: true }) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed the execute functions so that they actually halt the action, not only log the error and continue.

core.info(`${action} env ${envName}`)
const quotedExtraSpecsStr = selectSelectors(extraSpecs).map(e => `"${e}"`).join(' ')
const cmd = `micromamba ${action} -n ${envName} ${quotedExtraSpecsStr} --strict-channel-priority -y -f ${envFilePath}`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed the code to work with no env file and only extra specs.

@@ -73,6 +69,10 @@ function sha256 (s) {
return h.digest().hexSlice()
}

function sha256Short (s) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Shortened env file content hashes for better legibility.

@jonashaag jonashaag marked this pull request as ready for review March 10, 2022 10:02
README.md Show resolved Hide resolved
Co-authored-by: Tom de Geus <[email protected]>
@jonashaag jonashaag force-pushed the cache-failure branch 2 times, most recently from a4af6e2 to 5af807d Compare March 13, 2022 22:01
@jonashaag jonashaag changed the title Cache on action failure; extend docs Add 'channels' options; save cache on action failure; extend docs Mar 14, 2022
@tdegeus
Copy link
Contributor

tdegeus commented Mar 24, 2022

Thanks @jonashaag for this! Would be nice to get merged soon

@jonashaag
Copy link
Collaborator Author

@wolfv

@jonashaag
Copy link
Collaborator Author

ping @wolfv

@jonashaag
Copy link
Collaborator Author

This PR also fixes silently ignored errors in executePwsh

@wolfv
Copy link
Member

wolfv commented Apr 11, 2022

I like it.

I wonder if we're making a mistake by not using YAML lists where appropriate (extra specs and channels could be proper lists...)

What do you think?

@jonashaag
Copy link
Collaborator Author

One argument against it is that it's slightly more cumbersome to have conditional extra-specs/channels:

extra-specs: |
  ${{ some-condition && 'python=3.7' || '' }}

vs (does that even work?)

extra-specs:
  ${{ some-condition && '- python=3.7' || '' }}

or even

extra-specs:
  ${{ some-condition && format('- python={}', some-version) || '' }}

I guess we could just ignore empty lists items (is - even a valid YAML line?).

The | style is what GitHub does eg. in the cache action, but it's unclear why actions/cache#510.

I guess it's safe to support both syntaxes as well...

@@ -7,7 +7,8 @@ inputs:
environment-file:
description: >-
The environment.yml or .lock file for the conda environment.
If 'false', no enviroment will be created (only Micromamba will be installed).
If 'false', no enviroment will be created (only Micromamba will be installed)
Copy link
Member

Choose a reason for hiding this comment

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

I think this might be too late, but could we also use null?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems that GHA deletes inputs with foo: null from the actual inputs that are being passed to the action. foo: 'null' would work but feels ugly. So I suggest to keep false.

@wolfv
Copy link
Member

wolfv commented Apr 27, 2022

LGTM!

@jonashaag
Copy link
Collaborator Author

@wolfv if you're OK with the extra-specs syntax I think we should merge this.

@wolfv wolfv merged commit 18d8ee1 into mamba-org:main May 9, 2022
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

Successfully merging this pull request may close these issues.

caching: upload directly after installing the environment
3 participants