Class: BashManager
Class Method Summary
collapse
Instance Method Summary
collapse
#asign_queue_id, #close_file, #create_file, #create_folder, descendants, #exec, #get_all_deps, #get_dependencies, #get_queue_system_dependencies, #get_relations_and_folders, #init_log, #launch2queue_system, #launch_job_in_folder, #make_environment_file, #read_file, #rm_done_dependencies, select_manager, select_queue_manager, #sort_jobs_by_dependencies, #system_call, system_call, #write_file, #write_job
Constructor Details
#initialize(exec_folder, options, commands, persist_variables) ⇒ BashManager
Returns a new instance of BashManager.
4
5
6
7
8
9
10
11
12
|
# File 'lib/autoflow/queue_managers/bash_manager.rb', line 4
def initialize(exec_folder, options, commands, persist_variables)
super
@queued = []
@count = 0
@pids = {}
@path2execution_script = File.join(@exec_folder, 'execution.sh')
create_file('execution.sh', @exec_folder)
write_file('execution.sh', '#! /usr/bin/env bash')
end
|
Class Method Details
.available?(options) ⇒ Boolean
44
45
46
|
# File 'lib/autoflow/queue_managers/bash_manager.rb', line 44
def self.available?(options)
return true
end
|
.priority ⇒ Object
48
49
50
|
# File 'lib/autoflow/queue_managers/bash_manager.rb', line 48
def self.priority
return 0
end
|
Instance Method Details
#get_queue_system_id(shell_output) ⇒ Object
40
41
42
|
# File 'lib/autoflow/queue_managers/bash_manager.rb', line 40
def get_queue_system_id(shell_output)
return nil
end
|
#launch_all_jobs ⇒ Object
14
15
16
17
18
|
# File 'lib/autoflow/queue_managers/bash_manager.rb', line 14
def launch_all_jobs
super
close_file('execution.sh', 0755)
system_call("#{@path2execution_script} > #{File.join(File.dirname(@path2execution_script),'output')} & ", @exec_folder)
end
|
#submit_job(job, ar_dependencies) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/autoflow/queue_managers/bash_manager.rb', line 24
def submit_job(job, ar_dependencies)
write_file('execution.sh','')
if !ar_dependencies.empty?
ar_dependencies.each do |dep|
cmd = "wait \"$pid#{@pids[dep]}\"\nif [ $? -ne 0 ]\nthen \n\techo \"#{job.name} failed\"\n\texit\nfi"
write_file('execution.sh', cmd)
end
end
write_file('execution.sh', "cd #{job.attrib[:exec_folder]}")
write_file('execution.sh', "./#{job.name}.sh &> task_log & pid#{@count}=$!")
@pids[job.name] = @count
@count += 1
@queued << job.name return nil
end
|
20
21
22
|
# File 'lib/autoflow/queue_managers/bash_manager.rb', line 20
def (id, node, sh)
end
|