Class: WorkflowManager::FGCZDevian10Cluster
- Inherits:
-
Cluster
- Object
- Cluster
- WorkflowManager::FGCZDevian10Cluster
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, #node_list
Instance Method Details
#cluster_nodes ⇒ Object
430
431
432
433
434
435
|
# File 'lib/workflow_manager/cluster.rb', line 430
def cluster_nodes
nodes = {
'fgcz-h-900: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-900',
'fgcz-h-901: cpu 8,mem 30 GB,scr 400G' => 'fgcz-h-901',
}
end
|
#copy_commands(org_dir, dest_parent_dir, now = nil, queue = "light") ⇒ Object
414
415
416
417
418
419
420
421
422
423
|
# File 'lib/workflow_manager/cluster.rb', line 414
def copy_commands(org_dir, dest_parent_dir, now=nil, queue="light")
commands = if now == "force"
target_file = File.join(dest_parent_dir, File.basename(org_dir))
["g-req copynow -f #{org_dir} #{dest_parent_dir}"]
elsif now
["g-req copynow #{org_dir} #{dest_parent_dir}"]
else
["g-req -w copy #{org_dir} #{dest_parent_dir}"]
end
end
|
#delete_command(target) ⇒ Object
427
428
429
|
# File 'lib/workflow_manager/cluster.rb', line 427
def delete_command(target)
command = "g-req remove #{target}"
end
|
#job_ends?(log_file) ⇒ Boolean
389
390
391
392
393
394
395
396
397
398
399
400
|
# File 'lib/workflow_manager/cluster.rb', line 389
def job_ends?(log_file)
log_flag = false
IO.popen("tail -n 10 #{log_file} 2> /dev/null") do |io|
while line=io.gets
if line =~ /__SCRIPT END__/
log_flag = true
break
end
end
end
log_flag
end
|
#job_pending?(job_id) ⇒ Boolean
401
402
403
404
405
406
407
408
409
410
411
412
413
|
# File 'lib/workflow_manager/cluster.rb', line 401
def job_pending?(job_id)
qstat_flag = false
IO.popen('squeue') do |io|
while line=io.gets
jobid, partition, name, user, state, *others = line.chomp.split
if jobid.strip == job_id and state =~ /PD/
qstat_flag = true
break
end
end
end
qstat_flag
end
|
#job_running?(job_id) ⇒ Boolean
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
|
# File 'lib/workflow_manager/cluster.rb', line 374
def job_running?(job_id)
qstat_flag = false
IO.popen('squeue') do |io|
while line=io.gets
jobid, partition, name, user, state, *others = line.chomp.split
if jobid.strip == job_id and state == 'R'
qstat_flag = true
break
end
end
end
qstat_flag
end
|
#kill_command(job_id) ⇒ Object
424
425
426
|
# File 'lib/workflow_manager/cluster.rb', line 424
def kill_command(job_id)
command = "scancel #{job_id}"
end
|
#submit_job(script_file, script_content, option = '') ⇒ Object
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
# File 'lib/workflow_manager/cluster.rb', line 355
def submit_job(script_file, script_content, option='')
if script_name = File.basename(script_file) and script_name =~ /\.sh/
script_name = script_name.split(/\.sh/).first + ".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} -q course #{option} #{new_job_script}"
job_id = `#{command}`
job_id = job_id.chomp.split.last
[job_id, log_file, command]
else
err_msg = "FGCZDevian10Cluster#submit_job, ERROR: script_name is not *.sh: #{File.basename(script_file)}"
warn err_msg
raise err_msg
end
end
|