If you happen to see a question you know the answer to, please do chime in and help your fellow community members. We encourage our fourm members to be more involved, jump in and help out your fellow researchers with their questions. GATK forum is a community forum and helping each other with using GATK tools and research is the cornerstone of our success as a genomics research community.We appreciate your help!

Test-drive the GATK tools and Best Practices pipelines on Terra

Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.
We will be out of the office on November 11th and 13th 2019, due to the U.S. holiday(Veteran's day) and due to a team event(Nov 13th). We will return to monitoring the GATK forum on November 12th and 14th respectively. Thank you for your patience.

Queue: possible to set max number of a certain kind of job?

Let's say I have a case class in a qscript like so:

case class getFileFromRemote(remoteFile:File, localFile:file) extends ExternalCommonArgs with SixteenCoreJob with FourDayJob{
    @Input(doc = "remote") val _remoteFile = remoteFile
    @Output(doc = "local") val _localFile = localFile
    def commandLine = " " + remoteFile + " " + localFile
    this.isIntermediate = true
    this.jobName = "fetchFile"
    this.analysisName = this.jobName

Then I can add it to my script() like so:

add( getFileFromRemote("[email protected]:/path/to/remote", "path/to/local") )

All is well so far.

Lets say that I have lots of files to fetch, so I add jobs in a for loop over a Seq of file names. I then add jobs downstream jobs as usual. The problem that I run in to is that all 1000+ (which uses irods/irsync behind the scenes) sessions will start at the same time, choking the system and nothing will get downloaded.

One solution to my problem would be to be able to set a limit in my fetcher case class, to tell Queue to never submit more than 5 (or so) of these jobs to the cluster. Is that possible, or can anyone see another way around this?

Best Answer


  • pdexheimerpdexheimer Member ✭✭✭✭

    The "correct" way to handle this is outside of Queue, in the job scheduler. On my cluster, LSF will happily enqueue 1000 jobs, and only run them as cores become available. If I wanted to further restrict the number of concurrent jobs, I'd make a new LSF queue that only ran so many jobs.

    To hack Queue to do this, you'd probably have to add code into the loop that moves jobs from pending to executing that would only allow n jobs to execute at once. But that's not the intended behavior, because Queue assumes that it's feeding jobs into a scheduler of some sort

  • @pdexheimer‌ Thanks, and sorry for being unclear.

    Our backend job scheduler is SLURM, which works very well with Drmaa. 1000+ jobs in SLURM is of course no problem. It's not the SLURM system that's being choked (sorry for being unclear), it's system fetching the files. Even using rsync, I suspect that 1000+ parallell connection might not work very well, if at all.

    The issue that my pipeline fetches files from on demand, and when I start the pipeline, there are ≈1500 files to be fetched, each around 5Gb. No, I don't run it from start that often with all samples...

    What I would like to do is to limit only the getFileFromRemote jobs to a max number to be submitted to the queue.

    Maybe something like

    this.maxNumberOfJobsOfThisClass = 5

    in the case class def is what I'm after.

    All jobs of other kinds (alignment, adapter trimming, base recal, realn, etc etc) should be allowed to be submitted to the cluster however many times Queue pleases. As it is now, I have to fetch all files, wait for that to finish fetching every single file and then kick of the pipeline.

    I've been thinking about having one job that fetches all the files, that the rest of the pipeline would depend on, but that would mean that all other jobs would have to wait for the one master fetch job, which just seems.... inelegant, in such a nice pipelining system. ;)

    I understand that such an option is not available, and might be outside of the scope of Queue. Any ideas on workarounds are welcome.

  • Thanks for the suggestions @pdexheimer, I'll try 'em both I think.

Sign In or Register to comment.