sushi_fabric 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20151106-140410'
3
+ # Version = '20151120-070708'
4
4
 
5
5
  require 'csv'
6
6
  require 'fileutils'
@@ -201,6 +201,7 @@ class SushiApp
201
201
  attr_accessor :next_dataset_comment
202
202
  attr_accessor :workflow_manager
203
203
  attr_accessor :current_user
204
+ attr_accessor :logger
204
205
  def initialize
205
206
  @gstore_dir = GSTORE_DIR
206
207
  @project = nil
@@ -402,19 +403,42 @@ rm -rf #{@scratch_dir} || exit 1
402
403
  gsub_options << "-n #{@params['node']}" unless @params['node'].to_s.empty?
403
404
  gsub_options << "-r #{@params['ram']}" unless @params['ram'].to_s.empty?
404
405
  gsub_options << "-s #{@params['scratch']}" unless @params['scratch'].to_s.empty?
405
- command = "wfm_monitoring --server #{WORKFLOW_MANAGER} --project #{@project.gsub(/p/,'')} --logdir #{@gstore_script_dir} #{job_script} #{gsub_options.join(' ')}"
406
+ command = "wfm_monitoring --server #{WORKFLOW_MANAGER} --user #{@user} --project #{@project.gsub(/p/,'')} --logdir #{@gstore_script_dir} #{job_script} #{gsub_options.join(' ')}"
406
407
  puts "submit: #{command}"
407
408
 
408
409
  project_number = @project.gsub(/p/, '')
409
410
  @workflow_manager||=DRbObject.new_with_uri(WORKFLOW_MANAGER)
410
411
  script_content = File.read(job_script)
411
- @workflow_manager.start_monitoring(job_script, @user, 0, script_content, project_number, gsub_options.join(' '), @gstore_script_dir)
412
+ job_id = 0
413
+ begin
414
+ job_id = @workflow_manager.start_monitoring(job_script, @user, 0, script_content, project_number, gsub_options.join(' '), @gstore_script_dir)
415
+ rescue => e
416
+ time = Time.now.strftime("[%Y.%m.%d %H:%M:%S]")
417
+ @logger.error("*"*50)
418
+ @logger.error("submit_command error #{time}")
419
+ @logger.error("error: #{e}")
420
+ @logger.error("job_script: #{job_script}, @user: #{@user}, script_content: #{script_content.class} #{script_content.to_s.length} chrs, project_number: #{project_number}, gsub_options: #{gsub_options}, job_id: #{job_id}")
421
+ @logger.error("*"*50)
422
+ end
423
+ job_id
412
424
  end
413
425
  def submit(job_script)
414
- job_id = submit_command(job_script)
415
- job_id = job_id.to_i
416
- unless job_id.to_i > 1
417
- raise 'failed in job submitting'
426
+ begin
427
+ job_id = submit_command(job_script)
428
+ job_id = job_id.to_i
429
+ unless job_id.to_i > 1
430
+ @logger.error("#"*50)
431
+ time = Time.now.strftime("[%Y.%m.%d %H:%M:%S]")
432
+ @logger.error("error happened in job submitting, but maybe file. #{time}")
433
+ @logger.error("#"*50)
434
+ job_id = nil
435
+ end
436
+ rescue
437
+ @logger.error("@"*50)
438
+ time = Time.now.strftime("[%Y.%m.%d %H:%M:%S]")
439
+ @logger.error("error happened in job submitting, but maybe file. #{time}")
440
+ @logger.error("@"*50)
441
+ job_id = nil
418
442
  end
419
443
  job_id
420
444
  end
@@ -462,7 +486,22 @@ rm -rf #{@scratch_dir} || exit 1
462
486
  end
463
487
  def copy_commands(org_dir, dest_parent_dir, now=nil)
464
488
  @workflow_manager||=DRbObject.new_with_uri(WORKFLOW_MANAGER)
465
- @workflow_manager.copy_commands(org_dir, dest_parent_dir, now)
489
+ com = ''
490
+ cnt_retry = 0
491
+ begin
492
+ com = @workflow_manager.copy_commands(org_dir, dest_parent_dir, now)
493
+ rescue => e
494
+ time = Time.now.strftime("[%Y.%m.%d %H:%M:%S]")
495
+ @logger.error("*"*50)
496
+ @logger.error("copy_command error #{time}")
497
+ @logger.error("error: #{e}")
498
+ @logger.error("org_dir: #{org_dir}, dest_parent_dir: #{dest_parent_dir}, now: #{now}")
499
+ @logger.error("*"*50)
500
+ sleep 1
501
+ cnt_retry += 1
502
+ retry if cnt_retry < 3
503
+ end
504
+ com
466
505
  end
467
506
  def copy_inputdataset_parameter_jobscripts
468
507
  org = @scratch_result_dir
@@ -610,9 +649,10 @@ rm -rf #{@scratch_dir} || exit 1
610
649
 
611
650
  # job submittion
612
651
  @job_scripts.each_with_index do |job_script, i|
613
- job_id = submit(job_script)
614
- @job_ids << job_id
615
- print "Submit job #{File.basename(job_script)} job_id=#{job_id}"
652
+ if job_id = submit(job_script)
653
+ @job_ids << job_id
654
+ print "Submit job #{File.basename(job_script)} job_id=#{job_id}"
655
+ end
616
656
  end
617
657
 
618
658
  puts
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sushi_fabric
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.0
5
+ version: 0.5.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Functional Genomics Center Zurich
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2015-11-06 00:00:00 Z
13
+ date: 2015-11-20 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler