lib/ripe/worker_controller/preparer.rb
##
# Prepare a worker from a group of sample blocks.
#
# @param worker_sample_blocks [Hash] a list containing as many elements
#   as there are samples in the group, with each element containing
#   +[String, Blocks::Block]+
# @param params [Hash] worker-level parameter list
# @return [DB::Worker] worker
Prepare a worker from a group of sample blocks.
Prepare a worker from a group of sample blocks .
def prepare_worker(worker_sample_blocks, params)
        worker = DB::Worker.create(handle: params[:handle])
        worker_blocks = prepare_worker_blocks(worker_sample_blocks, worker)
        params = params.merge({
          name:    worker.id,
          stdout:  worker.stdout,
          stderr:  worker.stderr,
          command: Blocks::SerialBlock.new(*worker_blocks).command,
        })
        worker_block = Blocks::LiquidBlock.new("#{PATH}/share/moab.sh", params)
        File.open(worker.sh, 'w') { |f| f.write(worker_block.command) }
        worker.update({
          status:       :prepared,
          ppn:          params[:ppn],
          queue:        params[:queue],
          walltime:     params[:walltime],
          user:         `whoami`.chomp,
          project_name: params[:project_name],
        })
        worker
      end
def prepare_worker ( worker_sample_blocks , params ) worker = DB :: Worker . create ( handle : params [ :handle ] ) worker_blocks = prepare_worker_blocks ( worker_sample_blocks , worker ) params = params . merge ( { name : worker . id , stdout : worker . stdout , stderr : worker . stderr , command : Blocks :: SerialBlock . new ( * worker_blocks ) . command , } ) worker_block = Blocks :: LiquidBlock . new ( "#{PATH}/share/moab.sh" , params ) File . open ( worker . sh , 'w' ) { | f | f . write ( worker_block . command ) } worker . update ( { status : :prepared , ppn : params [ :ppn ] , queue : params [ :queue ] , walltime : params [ :walltime ] , user : ` whoami ` . chomp , project_name : params [ :project_name ] , } ) worker end
Prepare a worker from a group of sample blocks.
Prepare a worker from a group of sample blocks .
# Combine all grouped sample blocks into a single worker block
None
DB::Worker
worker_sample_blocks
a list containing as many elements as there are samples in the group, with each element containing +[String, Blocks::Block]+
a list containing as many elements as there are samples in the group with each element containing + [ String Blocks :: Block ] +
params
worker-level parameter list
worker - level parameter list