workflow_manager 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/workflow_manager/server.rb +29 -27
- data/lib/workflow_manager/version.rb +1 -1
- metadata +1 -1
@@ -163,7 +163,6 @@ module WorkflowManager
|
|
163
163
|
flag = false
|
164
164
|
break
|
165
165
|
end
|
166
|
-
p file
|
167
166
|
end
|
168
167
|
flag
|
169
168
|
end
|
@@ -208,41 +207,44 @@ module WorkflowManager
|
|
208
207
|
def start_monitoring2(script_path, script_content, user='sushi_lover', project_number=0, sge_options='', log_dir='')
|
209
208
|
# script_path is only used to generate a log file name
|
210
209
|
# It is not used to read the script contents
|
210
|
+
go_submit = false
|
211
|
+
waiting_time = 0
|
211
212
|
gstore_dir, input_dataset_path = input_dataset_tsv_path(script_content)
|
212
213
|
if gstore_dir and input_dataset_path
|
213
214
|
file_list = input_dataset_file_list(input_dataset_path)
|
214
215
|
file_list.map!{|file| File.join(gstore_dir, file)}
|
215
216
|
waiting_max = 60*60*8 # 8h
|
216
|
-
#
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
waiting_time += @interval
|
223
|
-
end
|
217
|
+
# wait until the files come
|
218
|
+
until waiting_time > waiting_max or go_submit = input_dataset_exist?(file_list)
|
219
|
+
sleep @interval
|
220
|
+
waiting_time += @interval
|
221
|
+
end
|
222
|
+
end
|
224
223
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
loop do
|
231
|
-
# check status
|
232
|
-
current_status = check_status(job_id, log_file)
|
224
|
+
job_id, log_file, command = if go_submit
|
225
|
+
@cluster.submit_job(script_path, script_content, sge_options)
|
226
|
+
else
|
227
|
+
raise "stop submitting #{File.basename(script_path)}, since waiting_time #{waiting_time} > #{waiting_max}"
|
228
|
+
end
|
233
229
|
|
234
|
-
|
235
|
-
|
230
|
+
if job_id and log_file
|
231
|
+
# job status check until it finishes with success or fail
|
232
|
+
worker = Thread.new(log_dir, script_path, script_content, sge_options) do |log_dir, script_path, script_content, sge_options|
|
233
|
+
loop do
|
234
|
+
# check status
|
235
|
+
current_status = check_status(job_id, log_file)
|
236
236
|
|
237
|
-
|
238
|
-
|
237
|
+
# save time and status
|
238
|
+
update_time_status(job_id, current_status, script_path, user, project_number)
|
239
239
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
240
|
+
# finalize (kill current thred) in case of success or fail
|
241
|
+
finalize_monitoring(current_status, log_file, log_dir)
|
242
|
+
|
243
|
+
# wait
|
244
|
+
sleep @interval
|
245
|
+
end # loop
|
246
|
+
end
|
247
|
+
job_id
|
246
248
|
end
|
247
249
|
end
|
248
250
|
def start_monitoring(submit_command, user = 'sushi lover', resubmit = 0, script = '', project_number = 0, sge_options='', log_dir = '')
|