Sha256: fc7b6b3ff46426fce1b1e82662c7008a42d8c55593a3e952d4b237c8ae00c2ac

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

module Quorum
  class JobQueueService

    #
    # Queue search workers.
    #
    def self.queue_search_workers(job)
      blast_jobs = []
      if job.blastn_job && job.blastn_job.queue
        blast_jobs << Workers::System.create_search_command("blastn", job.id)
      end
      if job.blastx_job && job.blastx_job.queue
        blast_jobs << Workers::System.create_search_command("blastx", job.id)
      end
      if job.tblastn_job && job.tblastn_job.queue
        blast_jobs << Workers::System.create_search_command("tblastn", job.id)
      end
      if job.blastp_job && job.blastp_job.queue
        blast_jobs << Workers::System.create_search_command("blastp", job.id)
      end

      unless blast_jobs.blank?
        blast_jobs.each do |b|
          Workers::System.enqueue(
            b,
            Quorum.blast_remote,
            Quorum.blast_ssh_host,
            Quorum.blast_ssh_user,
            Quorum.blast_ssh_options
          )
        end
      end
    end

    #
    # Queue fetch worker to send blast hit sequence. Return job meta_id for
    # for data access.
    #
    # See JobsController#send_blast_hit_sequence for more info.
    #
    def self.queue_fetch_worker(fetch_data)
      unless fetch_data.valid?
        return nil
      end

      cmd = Workers::System.create_blast_fetch_command(
        fetch_data.blast_dbs,
        fetch_data.hit_id,
        fetch_data.hit_display_id,
        fetch_data.algo
      )

      data = Workers::System.enqueue(
        cmd,
        Quorum.blast_remote,
        Quorum.blast_ssh_host,
        Quorum.blast_ssh_user,
        Quorum.blast_ssh_options,
        true
      )

      [{ meta_id: data.meta_id }]
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
quorum-0.8.2 app/models/quorum/job_queue_service.rb
quorum-0.8.1 app/models/quorum/job_queue_service.rb
quorum-0.8.0 app/models/quorum/job_queue_service.rb