Class: WorkflowManager::FGCZCluster
- Inherits:
-
Cluster
- Object
- Cluster
- WorkflowManager::FGCZCluster
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
#generate_new_job_script, #initialize
Instance Method Details
#copy_commands(org_dir, dest_parent_dir) ⇒ Object
111
112
113
|
# File 'lib/workflow_manager/cluster.rb', line 111
def copy_commands(org_dir, dest_parent_dir)
commands = ["g-req -w copy #{org_dir} #{dest_parent_dir}"]
end
|
#job_ends?(log_file) ⇒ Boolean
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/workflow_manager/cluster.rb', line 99
def job_ends?(log_file)
log_flag = false
IO.popen("tail -n 10 #{log_file}") do |io|
while line=io.gets
if line =~ /__SCRIPT END__/
log_flag = true
break
end
end
end
log_flag
end
|
#job_running?(job_id) ⇒ Boolean
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/workflow_manager/cluster.rb', line 87
def job_running?(job_id)
qstat_flag = false
IO.popen('qstat -u "*"') do |io|
while line=io.gets
if line =~ /#{job_id}/
qstat_flag = true
break
end
end
end
qstat_flag
end
|
#submit_job(script_file, script_content, option = '') ⇒ Object
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/workflow_manager/cluster.rb', line 75
def submit_job(script_file, script_content, option='')
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}"
job_id = `#{command}`
job_id = job_id.match(/Your job (\d+) \(/)[1]
[job_id, log_file, command]
end
end
|