Replies: 2 comments 2 replies
|
So it's a Java library? How do you collect traces from tasks that are running on a different node? |
2 replies
|
Alright, then consider myself humbled once again. I guess we will keep the library for our purpose (tracking the metrics of Nextflow as an orchestrator on the head node), but I can see why other use cases are not covered by the proposed approach. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
As I have now repeatedly sunken my teeth into the Nextflow core code I know that the trace value extraction is currently handled by the command-trace.txt file which consists of multiple shell commands that are then integrated into every
.command.runfile and called by inserting thenxf_tracecommand here:nextflow/modules/nextflow/src/main/groovy/nextflow/executor/BashWrapperBuilder.groovy
Line 610 in 0285c3b
While we recently developed our own trace value reconstruction at the session level for the nf-co2footprint plugin, we encountered a library that made this job so much easier and the resulting code a lot more readable:
The OS hardware information (OSHI) library
I have done a short consideration of upsides and downsides of a possible switch:
✅ Upsides
Better compatibility with different operating systems
The library is well maintained and support a myriad of OS. The current solution provides only limited integration with MacOS (which is not necessary because of containerization, I know).
No change to methodology on OSX
The library calls the same registers in
/procif you are on Linux. So while the code may change, the results do not.Better maintainability
The code I encountered in
command-trace.txtlooks frankly speaking a bit like a relic. Most of it was written more than eight years ago with little changes since its conception. It could be documented more thoroughly, the variable names are often less than verbose, it contains duplicates, ... That is not to say that it is all bad, I just think there is a reason why we use Java/Groovy for larger code segments, as it provides so many more ways to document stuff, to construct logical links, and make the code readable.Save storage space
250 lines are written for each task that is run by any pipeline because the script is inserted in
.command.run.For a pipeline like
rnaseq, which has 303 tasks when executing thetest_fullprofile, this amounts to about 75000 lines. By comparison, the complete Groovy code within the Nextflow repo (all files with.groovyending) are 277148 lines, so roughly 1/4th of that is stored in theworkdirectory every time this pipeline is executed. We all know that the size of theworkdirectory can explode quickly and this would provide one step to mitigate that problem by approximately 2.5MB for each similar run.A replacement of
command-trace.txtcould also make some parts incommand-run.txtsuperfluous. For instance thenxf_datemethod.❌ Downsides
Work overhead
You have to implement it, write tests, ...
Additional dependency
While I think of the library as a solid piece of code that is maintained since 2015 by a core of dedicated developers, nobody can guarantee that it will not introduce unforeseen consequences.
⏳ TLDR
I think the OSHI libary is a better solution for obtaining trace values than the current Bash scripting approach. At least I would have preferred to work with that.
If you want to have a look at our approach: https://github.com/nextflow-io/nf-co2footprint/blob/master/src/main/nextflow/co2footprint/Recorders/SessionTraceRecorder.groovy
All reactions