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

Use ephemeral-storage for disk directive and k8s executor #2998

Merged
merged 13 commits into from
Nov 19, 2022

Conversation

bentsherman
Copy link
Member

Closes #2986

This PR includes the following changes:

  • add support for emptyDir ephemeral volume mounts in k8s
  • add support for disk directive in k8s via ephemeral-storage resource type and emptyDir volume

@bentsherman bentsherman marked this pull request as ready for review June 27, 2022 21:53
@bentsherman
Copy link
Member Author

I need to test it to make sure, but based on the K8s docs, this PR should make it possible to request local disk storage for k8s tasks. You have to specify both the disk directive and the emptyDir pod option in your Nextflow config:

process {
    disk = 10.GB
    pod = [ [emptyDir: [:], mountPath: '/scratch'] ]
    scratch = '/scratch' // direct tasks to use the local storage
}

As a side bonus, you can also use emptyDir backed by memory:

process {
    memory = 10.GB
    pod = [ [emptyDir: [medium: 'Memory'], mountPath: '/scratch'] ]
    scratch = '/scratch'
}

@bentsherman
Copy link
Member Author

Hello, this seems to be a must for k8s 1.24 where under some circumstances, ephemeral-storage is enforced.

The node was low on resource: ephemeral-storage. Container nf-7884aa3757d610b56f730720f484453f was using 61810400Ki, which exceeds its request of 0.

@xhejtman I think I have seen this issue occasionally for earlier versions as well, but I haven't figured out why it happens. It seems to happen when the underlying node storage is exhausted, regardless of how much ephemeral-storage was allocated.

@xhejtman
Copy link
Contributor

@xhejtman I think I have seen this issue occasionally for earlier versions as well, but I haven't figured out why it happens. It seems to happen when the underlying node storage is exhausted, regardless of how much ephemeral-storage was allocated.

yes, this was my fault - node was by mistake configured without enough of local storage and therefore I discarded the comment. But it can happen, of course, under normal circumstances as well. More interresting question is, why this problem led to pipeline fail instead of re-run this task.

@bentsherman
Copy link
Member Author

Feel free to submit an issue for it. If you can identify the exception that was thrown, then we can check the error handling logic and possibly change it to trigger a retry instead of workflow termination.

@pditommaso
Copy link
Member

I'm not getting what's the difference between this and #2988?

@bentsherman
Copy link
Member Author

The other PR adds support for the csi ephemeral volume type, whereas this PR adds support for the emptyDir ephemeral volume type (and uses it to implement the disk directive for K8s).

Basically these PRs add two different ephemeral volume types. Ephemeral volumes must be added on a case-by-case basis because you can't provision them with a PVC. ConfigMap and Secret are two ephemeral volume types that we already support, so these new types are supported in much the same way. I think both are worth supporting because csi allows you to use remote secret vaults and emptyDir allows you to allocate per-task scratch storage.

@pditommaso
Copy link
Member

Ok, i've merged with master and solved the conflicts. @bentsherman please check everything is fine c353d8a

@bentsherman
Copy link
Member Author

@pditommaso Everything looks good, test worked, this one is ready to merge.

@pditommaso pditommaso merged commit b548e1c into master Nov 19, 2022
@pditommaso pditommaso deleted the issue-2986_ephemeral-storage-emptydir branch November 19, 2022 13:44
@ebioman
Copy link

ebioman commented Jan 18, 2023

I need to test it to make sure, but based on the K8s docs, this PR should make it possible to request local disk storage for k8s tasks. You have to specify both the disk directive and the emptyDir pod option in your Nextflow config:

process {
    disk = 10.GB
    pod = [ [emptyDir: [:], mountPath: '/scratch'] ]
    scratch = '/scratch' // direct tasks to use the local storage
}

As a side bonus, you can also use emptyDir backed by memory:

process {
    memory = 10.GB
    pod = [ [emptyDir: [medium: 'Memory'], mountPath: '/scratch'] ]
    scratch = '/scratch'
}

Hi
Sorry but is this now fully supported ?
I tried running a process with:

   disk = 10.GB
    pod  emptyDir: [:]
    pod  mountPath: '/scratch'

added in the specific process but it returned

Caused by:
  Unknown pod options: [emptyDir:[:]]

using nextflow version 22.10.5.5840

@bentsherman
Copy link
Member Author

Hi @ebioman , it was not included in v22.10. Based on the merge commit, it is available in all of the edge releases since then. I would just use the latest edge release.

@ebioman
Copy link

ebioman commented Jan 18, 2023

Ah sorry missed that 🙂 thanks a lot for the info.
Will definitely try then the edge release 👍

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.

Use ephemeral-storage for disk directive and k8s executor
4 participants