Class: Quorum::JobQueueService

Inherits:
Object
  • Object
show all
Defined in:
app/models/quorum/job_queue_service.rb

Class Method Summary collapse

Class Method Details

.queue_fetch_worker(fetch_data) ⇒ Object

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.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'app/models/quorum/job_queue_service.rb', line 41

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

.queue_search_workers(job) ⇒ Object

Queue search workers.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/models/quorum/job_queue_service.rb', line 7

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