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

Support disk directive for local executor #5652

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bentsherman
Copy link
Member

Close #5636

This PR adds support for the disk directive to the local executor. It uses File::getUsableSpace() to estimate the total available disk space at the beginning of the run.

Disk requirements are ignored when using the local executor with a remote filesystem via Fusion.

@bentsherman bentsherman requested a review from pditommaso January 7, 2025 19:02
@bentsherman bentsherman requested a review from a team as a code owner January 7, 2025 19:02
Copy link

netlify bot commented Jan 7, 2025

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit 445677e
🔍 Latest deploy log https://app.netlify.com/sites/nextflow-docs-staging/deploys/677fedb24a43aa0008b996c2
😎 Deploy Preview https://deploy-preview-5652--nextflow-docs-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@christopher-hakkaart
Copy link
Contributor

The documentation looks good. I'll leave the code review for someone else.

Signed-off-by: Ben Sherman <[email protected]>
Copy link
Member

@pditommaso pditommaso left a comment

Choose a reason for hiding this comment

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

Not sure about this PR. First the avail disk storage is a dynamic value, while CPUs and memory are static.

Moreover the main needed for using CPUs and memory is throttling task submission to avoid over allocation avail resources. But this cannot be done with disk storage and therefore it would ultimately just thrown an error as when the task run out of space

log.debug "Local executor is using a remote work directory -- task disk requirements will be ignored"
return 0
}
(session.getExecConfigProp(name, 'disk', session.workDir.toFile().getUsableSpace()) as MemoryUnit).toBytes()
Copy link
Member

Choose a reason for hiding this comment

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

But the avail disk changes over time, how to take into account free spaces can increase or decrease while the workflow is running?

@bentsherman
Copy link
Member Author

I will let @schorlton-bugseq make his case since he submitted the original issue. As for my thoughts:

Disk works exactly the same way as memory. There is a total amount and a currently available amount. The local executor doesn't prevent any task from using more than their allocated memory (unless Docker is enabled), it just uses the task resources as "hints" to limit the parallelism accordingly. The same is true for disk, it's just a hint that the user can use to limit the parallelism based on how much disk space the user estimates each task will need.

The only practical difference is that the steady-state disk usage is likely higher than steady-state memory usage, so it's more accurate to use the currently available disk space at the start of the run as the "total", rather than the true total.

Overall, it's a simple change that's opt-in and provides the same guarantees as the memory tracking, so I'm fine with it.

@schorlton-bugseq
Copy link

schorlton-bugseq commented Jan 10, 2025

First, I want to thank the three of you for such a fast turnaround on this and being so receptive to the request!

The main example that I would be interested in is not even kicking off a process if the process has a specified disk requirement which is greater than the available disk space - else one risks filling their disk and failing the process, which could take a long time to fail and cause unnecessary headache/cost if the directive was not specified. Specific examples where I see this to be useful are processes where the outputs will be predictably massive and fill standard disks, e.g. downloading large files (TBs in size), generating simulated data, or certain read alignment tasks (e.g. hundreds of secondary/supplementary alignments per read).

I leave to you the specifics of the parallelism as I don't fully appreciate the complexities of nextflow job scheduling or its guarantees. One could imagine in a complex scenario keeping track of allocated disk to each process and updating available disk after the process completes to account for the allocated vs actually used disk space in a dynamic fashion...this seems complex although maybe you already have this figured out! Alternatively, probably some simpler assumptions with clear documentation would more than suffice for most nf users and the use cases described above.

Thanks again for your hard work and responsiveness!

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.

Feature Request: Support disk directive with local executor
4 participants