Class: WorkflowManager::TaskSpooler
Instance Attribute Summary
Attributes inherited from Cluster
#log_dir, #name, #options
Instance Method Summary
collapse
#copy_commands, #delete_command, #job_ends?
Methods inherited from Cluster
#copy_commands, #default_node, #delete_command, #generate_new_job_script, #initialize, #job_ends?, #job_pending?
Instance Method Details
#cluster_nodes ⇒ Object
124
125
126
|
# File 'lib/workflow_manager/cluster.rb', line 124
def cluster_nodes
{"Local with TaskSpooler" => ""}
end
|
#job_running?(pid) ⇒ Boolean
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/workflow_manager/cluster.rb', line 106
def job_running?(pid)
command = "tsp"
result = IO.popen(command) do |io|
flag = false
while line=io.gets
x = line.split
if x[0].to_i == pid.to_i
flag = true
break
end
end
flag
end
result
end
|
#kill_command(job_id) ⇒ Object
121
122
123
|
# File 'lib/workflow_manager/cluster.rb', line 121
def kill_command(job_id)
command = "tsp -k #{job_id}"
end
|
#submit_job(script_file, script_content, option = '') ⇒ Object
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/workflow_manager/cluster.rb', line 94
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 = "tsp sh -c 'bash #{new_job_script} 1> #{log_file} 2> #{err_file}'"
pid = spawn(command)
Process.detach(pid)
[pid.to_s, log_file, command]
end
end
|