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
121
122
123
|
# File 'lib/workflow_manager/cluster.rb', line 121
def copy_commands(org_dir, dest_parent_dir)
commands = ["g-req -w copy #{org_dir} #{dest_parent_dir}"]
end
|
#delete_command(target) ⇒ Object
127
128
129
|
# File 'lib/workflow_manager/cluster.rb', line 127
def delete_command(target)
command = "g-req remove #{target}"
end
|
#job_ends?(log_file) ⇒ Boolean
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/workflow_manager/cluster.rb', line 109
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
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/workflow_manager/cluster.rb', line 97
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
|
#kill_command(job_id) ⇒ Object
124
125
126
|
# File 'lib/workflow_manager/cluster.rb', line 124
def kill_command(job_id)
command = "qdel #{job_id}"
end
|
#submit_job(script_file, script_content, option = '') ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/workflow_manager/cluster.rb', line 85
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
|