Class: ScbiDblastWorker
- Inherits:
-
ScbiMapreduce::Worker
- Object
- ScbiMapreduce::Worker
- ScbiDblastWorker
- Defined in:
- lib/scbi_distributed_blast/scbi_dblast_worker.rb
Instance Method Summary collapse
-
#closing_worker ⇒ Object
called once, when the worker is about to be closed.
-
#process_object(objs) ⇒ Object
process_object method is called for each received object.
-
#receive_initial_config(parameters) ⇒ Object
receive_initial_config is called only once just after the first connection, when initial parameters are received from manager.
-
#starting_worker ⇒ Object
starting_worker method is called one time at initialization and allows you to initialize your variables.
Instance Method Details
#closing_worker ⇒ Object
called once, when the worker is about to be closed
61 62 63 |
# File 'lib/scbi_distributed_blast/scbi_dblast_worker.rb', line 61 def closing_worker end |
#process_object(objs) ⇒ Object
process_object method is called for each received object. Be aware that objs is always an array, and you must iterate over it if you need to process it independently
The value returned here will be received by the work_received method at your worker_manager subclass.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/scbi_distributed_blast/scbi_dblast_worker.rb', line 40 def process_object(objs) chunk=[] # iterate over all objects received objs.each do |n,f| chunk<< ">"+n chunk<< f # convert to uppercase # f.downcase! end # puts "Doing blast to #{@params[:blast_cmd]}" blast=BatchBlast.do_blast_cmd(chunk.join("\n"),@params[:blast_cmd]) # return objs back to manager return blast end |
#receive_initial_config(parameters) ⇒ Object
receive_initial_config is called only once just after the first connection, when initial parameters are received from manager
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/scbi_distributed_blast/scbi_dblast_worker.rb', line 21 def receive_initial_config(parameters) # Reads the parameters # You can use worker logs at any time in this way: # $WORKER_LOG.info "Params received" # save received parameters, if any @params = parameters end |
#starting_worker ⇒ Object
starting_worker method is called one time at initialization and allows you to initialize your variables
10 11 12 13 14 15 |
# File 'lib/scbi_distributed_blast/scbi_dblast_worker.rb', line 10 def starting_worker # You can use worker logs at any time in this way: # $WORKER_LOG.info "Starting a worker" end |