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



235
236
237
238
239
240
# File 'lib/workflow_manager/cluster.rb', line 235

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

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

TODO



225
226
227
# File 'lib/workflow_manager/cluster.rb', line 225

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

#delete_command(target) ⇒ Object



232
233
234
# File 'lib/workflow_manager/cluster.rb', line 232

def delete_command(target)
  # TODO
end

#job_ends?(log_file) ⇒ Boolean

TODO

Returns:

  • (Boolean)


219
220
221
# File 'lib/workflow_manager/cluster.rb', line 219

def job_ends?(log_file)
  # TODO
end

#job_pending?(job_id) ⇒ Boolean

TODO

Returns:

  • (Boolean)


222
223
224
# File 'lib/workflow_manager/cluster.rb', line 222

def job_pending?(job_id)
  # TODO
end

#job_running?(job_id) ⇒ Boolean

Returns:

  • (Boolean)


216
217
218
# File 'lib/workflow_manager/cluster.rb', line 216

def job_running?(job_id)
  # TODO
end

#kill_command(job_id) ⇒ Object

TODO



228
229
230
231
# File 'lib/workflow_manager/cluster.rb', line 228

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

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



202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/workflow_manager/cluster.rb', line 202

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