Class: WorkflowManager::HydraCluster

Inherits:
Cluster
  • Object
show all
Defined in:
lib/workflow_manager/cluster.rb

Instance Attribute Summary

Attributes inherited from Cluster

#log_dir, #name, #options

Instance Method Summary collapse

Methods inherited from Cluster

#default_node, #generate_new_job_script, #initialize

Constructor Details

This class inherits a constructor from WorkflowManager::Cluster

Instance Method Details

#cluster_nodesObject

TODO



286
287
288
289
290
291
# File 'lib/workflow_manager/cluster.rb', line 286

def cluster_nodes
  # TODO
  nodes = {
    'cluster/largemem' => 'cluster/largemem',
  }
end

#copy_commands(org_dir, dest_parent_dir, now = nil) ⇒ Object

TODO



276
277
278
# File 'lib/workflow_manager/cluster.rb', line 276

def copy_commands(org_dir, dest_parent_dir, now=nil)
  # TODO
end

#delete_command(target) ⇒ Object



283
284
285
# File 'lib/workflow_manager/cluster.rb', line 283

def delete_command(target)
  # TODO
end

#job_ends?(log_file) ⇒ Boolean

TODO

Returns:

  • (Boolean)


270
271
272
# File 'lib/workflow_manager/cluster.rb', line 270

def job_ends?(log_file)
  # TODO
end

#job_pending?(job_id) ⇒ Boolean

TODO

Returns:

  • (Boolean)


273
274
275
# File 'lib/workflow_manager/cluster.rb', line 273

def job_pending?(job_id)
  # TODO
end

#job_running?(job_id) ⇒ Boolean

Returns:

  • (Boolean)


267
268
269
# File 'lib/workflow_manager/cluster.rb', line 267

def job_running?(job_id)
  # TODO
end

#kill_command(job_id) ⇒ Object

TODO



279
280
281
282
# File 'lib/workflow_manager/cluster.rb', line 279

def kill_command(job_id)
  # TODO
  command = "ssh hydra; scancel #{job_id}"
end

#submit_job(script_file, script_content, option = '') ⇒ Object



253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/workflow_manager/cluster.rb', line 253

def submit_job(script_file, script_content, option='')
  # TODO
  if script_name = File.basename(script_file) and script_name =~ /\.sh$/
    new_job_script = generate_new_job_script(script_name, script_content)
    new_job_script_base = File.basename(new_job_script)
    log_file = File.join(@log_dir, new_job_script_base + "_o.log")
    err_file = File.join(@log_dir, new_job_script_base + "_e.log")
    #command = "g-sub -o #{log_file} -e #{err_file} #{option} #{new_job_script}"
    command = "cat #{new_job_script} |ssh hydra 'cat > #{new_job_script_base}; source /etc/profile; module load cluster/largemem; sbatch #{new_job_script_base};'"
    job_id = `#{command}`
    job_id = job_id.match(/Submitted batch job (\d+)/)[1]
    [job_id, log_file, command]
  end
end