Class: WorkflowManager::FGCZCluster
- Defined in:
- lib/workflow_manager/cluster.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Cluster
Instance Method Summary collapse
- #cluster_nodes ⇒ Object
- #copy_commands(org_dir, dest_parent_dir, now = nil) ⇒ Object
- #delete_command(target) ⇒ Object
- #job_ends?(log_file) ⇒ Boolean
- #job_pending?(job_id) ⇒ Boolean
- #job_running?(job_id) ⇒ Boolean
- #kill_command(job_id) ⇒ Object
- #submit_job(script_file, script_content, option = '') ⇒ Object
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_nodes ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/workflow_manager/cluster.rb', line 165 def cluster_nodes nodes = { 'fgcz-c-043: cpu 24,mem 23 GB,scr 11T' => 'fgcz-c-043', 'fgcz-c-044: cpu 16,mem 128 GB,scr 500G' => 'fgcz-c-044', 'fgcz-c-045: cpu 64,mem 504 GB,scr 15T' => 'fgcz-c-045', 'fgcz-c-046: cpu 64,mem 504 GB,scr 11T' => 'fgcz-c-046', 'fgcz-c-047: cpu 32,mem 1 TB,scr 28T' => 'fgcz-c-047', 'fgcz-c-048: cpu 48,mem 252 GB,scr 3.5T' => 'fgcz-c-048', 'fgcz-c-049: cpu 8,mem 63 GB,scr 1.7T' => 'fgcz-c-049', 'fgcz-c-051: cpu 8,mem 31 GB,scr 800G' => 'fgcz-c-051', 'fgcz-c-052: cpu 8,mem 31 GB,scr 800G' => 'fgcz-c-052', 'fgcz-c-053: cpu 8,mem 31 GB,scr 800G' => 'fgcz-c-053', 'fgcz-c-054: cpu 8,mem 31 GB,scr 800G' => 'fgcz-c-054', 'fgcz-c-055: cpu 8,mem 31 GB,scr 800G' => 'fgcz-c-055', 'fgcz-c-057: cpu 8,mem 31 GB,scr 200G' => 'fgcz-c-057', 'fgcz-c-058: cpu 8,mem 31 GB,scr 200G' => 'fgcz-c-058', 'fgcz-c-059: cpu 8,mem 31 GB,scr 200G' => 'fgcz-c-059', 'fgcz-c-061: cpu 8,mem 31 GB,scr 200G' => 'fgcz-c-061', 'fgcz-c-063: cpu 12,mem 70 GB,scr 450G' => 'fgcz-c-063', 'fgcz-c-065: cpu 24,mem 70 GB,scr 197G' => 'fgcz-c-065', 'fgcz-h-004: cpu 8,mem 30 GB,scr 400G' => 'fgcz-h-004', 'fgcz-h-009: cpu 8,mem 30 GB,scr 500G' => 'fgcz-h-009', 'fgcz-h-010: cpu 8,mem 30 GB,scr 400G' => 'fgcz-h-010', } end |
#copy_commands(org_dir, dest_parent_dir, now = nil) ⇒ Object
149 150 151 152 153 154 155 156 157 158 |
# File 'lib/workflow_manager/cluster.rb', line 149 def copy_commands(org_dir, dest_parent_dir, now=nil) commands = if now == "force" target_file = File.join(dest_parent_dir, File.basename(org_dir)) ["g-req copynow -f #{org_dir} #{dest_parent_dir}"] elsif now ["g-req copynow #{org_dir} #{dest_parent_dir}"] else ["g-req -w copy #{org_dir} #{dest_parent_dir}"] end end |
#delete_command(target) ⇒ Object
162 163 164 |
# File 'lib/workflow_manager/cluster.rb', line 162 def delete_command(target) command = "g-req remove #{target}" end |
#job_ends?(log_file) ⇒ Boolean
124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/workflow_manager/cluster.rb', line 124 def job_ends?(log_file) log_flag = false IO.popen("tail -n 10 #{log_file} 2> /dev/null") do |io| while line=io.gets if line =~ /__SCRIPT END__/ log_flag = true break end end end log_flag end |
#job_pending?(job_id) ⇒ Boolean
136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/workflow_manager/cluster.rb', line 136 def job_pending?(job_id) qstat_flag = false IO.popen('qstat -u "*"') do |io| while line=io.gets jobid, prior, name, user, state, *others = line.chomp.split if jobid.strip == job_id and state =~ /qw/ qstat_flag = true break end end end qstat_flag end |
#job_running?(job_id) ⇒ Boolean
111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/workflow_manager/cluster.rb', line 111 def job_running?(job_id) qstat_flag = false IO.popen('qstat -u "*"') do |io| while line=io.gets jobid, prior, name, user, state, *others = line.chomp.split if jobid.strip == job_id and state == 'r' qstat_flag = true break end end end qstat_flag end |
#kill_command(job_id) ⇒ Object
159 160 161 |
# File 'lib/workflow_manager/cluster.rb', line 159 def kill_command(job_id) command = "qdel #{job_id}" end |
#submit_job(script_file, script_content, option = '') ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# 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/ script_name = script_name.split(/\.sh/).first + ".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] else err_msg = "FGCZCluster#submit_job, ERROR: script_name is not *.sh: #{File.basename(script_file)}" warn err_msg raise err_msg end end |