Priority control in custom nextflow pipeline

Hi team,

I have a question regarding changing the priority of samples while they are already running through the analysis pipeline.

Our team has designed a custom Nextflow pipeline where each sample is assigned an initial priority (for example, “Regular”) when the analysis starts. However, there are situations where the priority of a sample needs to be changed to “Urgent” after the pipeline has already been initiated.

The team has indicated that it is not possible to change the priority of a sample once the analysis is in progress. I was wondering if that is indeed a limitation of Nextflow, or if there is a way to bypass this and elevate a running sample to the highest execution priority without restarting the analysis.

Since we process thousands of samples every day, the ability to change the priority of an in-flight sample is an important operational requirement. I would appreciate any guidance or insight you can provide on whether this is possible or if there are any recommended approaches to handle such scenarios.

Thank you,

Ankit

I’m pretty sure that Nextflow doesn’t have a concept of priority. Tasks are executed in the order they appear in the input channels. In theory, you could use the fair directive for all processes in the pipeline and sort the inputs at the beginning according to priority, but that would be highly inefficient. The underlying executor might have a concept of priority (e.g. Slurm), but it would be up to the pipeline to handle this.
However sample priority is implemented in your specific pipeline, it is not possible to change a parameter while the pipeline is running. That would be very difficult to implement and extremely error-prone. It would also make pipeline runs basically impossible to reproduce, which is an important feature of Nextflow. You could stop the pipeline, change the parameters and resume the run, but for a pipeline-wide parameter like this, it would almost certainly invalidate the entire cache.