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.
@@ -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
- #waiting_max = 60*3 # 3m
217
- worker = Thread.new(0, file_list, log_dir, script_path, script_content, sge_options) do |waiting_time, file_list, log_dir, script_path, script_content, sge_options|
218
- # wait until the files come
219
- until waiting_time > waiting_max or go_submit = input_dataset_exist?(file_list)
220
- p file_list
221
- sleep @interval
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
- job_id, log_file, command = if go_submit
226
- @cluster.submit_job(script_path, script_content, sge_options)
227
- end
228
- if job_id and log_file
229
- # job status check until it finishes with success or fail
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
- # save time and status
235
- update_time_status(job_id, current_status, script_path, user, project_number)
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
- # finalize (kill current thred) in case of success or fail
238
- finalize_monitoring(current_status, log_file, log_dir)
237
+ # save time and status
238
+ update_time_status(job_id, current_status, script_path, user, project_number)
239
239
 
240
- # wait
241
- sleep @interval
242
- end # loop
243
- end # if
244
- job_id
245
- end # Thread
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 = '')
@@ -1,3 +1,3 @@
1
1
  module WorkflowManager
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: workflow_manager
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.7
5
+ version: 0.2.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Functional Genomics Center Zurich