sushi_fabric 0.9.6 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 326d811109da5893c3ac6ea35f946f18849e1bb4
4
- data.tar.gz: adce9f2299a8b16217cfd715f82ad0f894f3b0d9
2
+ SHA256:
3
+ metadata.gz: 6bb6ed61655c7decac6439f7bd3c73784888ae9686d2611c10f9d4c40bda0621
4
+ data.tar.gz: 91e98688ac53cfc55560decb2537ee1b38e9c93d24ffb4cfae02875088e2e910
5
5
  SHA512:
6
- metadata.gz: 9369616e25ddabc40f335f5490bb925591cb52f642e6326cccfbe2205bc807be81983e1f530993ae0256488f3903fc3b3c47e09a2a6f0d261e93e475f712921e
7
- data.tar.gz: fedae1c8626fb161831a5e2989c9aeab0cccf54459d09996339f1005322908a4a368326804fec7cee52639fd43272f71d3703de4180640ad3aebe52514ea04a8
6
+ metadata.gz: d2ffd594a92358285b0996f0fa06053af38cb65cfe337049b0e619f7e590fdd8ae91b005adfa50c088ced30b7c8235dd7f6d469f36284af62e5a94f5bab7d4b7
7
+ data.tar.gz: b5ee9600a1e1b2fe1d76b27bc37cc30a230a5cafb0e613fb5ab13f587ddade33e8f365c87be81e315239d78fb90c99bffe9f65d5ede95f62c8947c1c540be75a
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20200409-110502'
3
+ # Version = '20201105-115625'
4
4
 
5
5
  require 'csv'
6
6
  require 'fileutils'
@@ -237,6 +237,7 @@ class SushiApp
237
237
  @params['ram'] = nil
238
238
  @params['scratch'] = nil
239
239
  @params['node'] = ''
240
+ @params['queue'] = ''
240
241
  @params['process_mode'] = 'SAMPLE'
241
242
  @params['samples'] = ''
242
243
  @job_ids = []
@@ -389,16 +390,18 @@ class SushiApp
389
390
  FileUtils.mkdir_p(@scratch_result_dir)
390
391
  FileUtils.mkdir_p(@job_script_dir)
391
392
  end
392
- def check_latest_module_version(mod)
393
- command_out = %x[ bash -lc "source #{@module_source}; module whatis #{mod} 2>&1" ]
394
- latest_mod = nil
395
- command_out.split("\n").each do |line|
396
- if line =~ /#{mod}/
397
- latest_mod = line.split.first
398
- break
393
+ def check_latest_modules_version(modules)
394
+ command_out = %x[ bash -lc "source #{@module_source}; module whatis #{modules.join(" ")} 2>&1" | cut -f 1 -d " " | sort | uniq ]
395
+ latest_modules = []
396
+ command_out.split("\n").each do |line_|
397
+ line = line_.chomp
398
+ unless line.empty?
399
+ if line =~ /#{modules.join("|")}/
400
+ latest_modules << line
401
+ end
399
402
  end
400
403
  end
401
- latest_mod
404
+ latest_modules
402
405
  end
403
406
  def job_header
404
407
  @scratch_dir = if @params['process_mode'] == 'SAMPLE'
@@ -418,9 +421,17 @@ class SushiApp
418
421
  ""
419
422
  end
420
423
  module_add_commands = if @modules and !@modules.empty?
421
- modules_with_version = @modules.map{|mod| check_latest_module_version(mod)}
422
- modules_with_version.compact!
423
- "module add #{modules_with_version.join(' ')}"
424
+ modules_with_version = check_latest_modules_version(@modules)
425
+ if @modules.length == modules_with_version.length
426
+ modules_with_version.compact!
427
+ "module add #{modules_with_version.join(' ')}"
428
+ else
429
+ @logger.error("#"*100)
430
+ @logger.error("# Error in checking modules ")
431
+ @logger.error("# Please check if all modules are correctly installed, searched #{@modules.join(",")} but only detected #{modules_with_version.join(",")}")
432
+ @logger.error("#"*100)
433
+ "exit # Please check if all modules are correctly installed, searched #{@modules.join(",")} but only detected #{modules_with_version.join(",")}"
434
+ end
424
435
  else
425
436
  ""
426
437
  end
@@ -447,6 +458,13 @@ cd $SCRATCH_DIR || exit 1
447
458
  end
448
459
  def job_footer
449
460
  @out.print "#### JOB IS DONE WE PUT THINGS IN PLACE AND CLEAN AUP\n"
461
+ if File.exist?("/usr/local/ngseq/miniconda3/etc/profile.d/conda.sh")
462
+ @out.print <<-EOS
463
+ . "/usr/local/ngseq/miniconda3/etc/profile.d/conda.sh"
464
+ conda activate sushi
465
+ EOS
466
+ end
467
+
450
468
  if @output_files
451
469
  @output_files.map{|header| next_dataset[header]}.each do |file|
452
470
  # in actual case, to save under /srv/gstore/
@@ -759,28 +777,14 @@ rm -rf #{@scratch_dir} || exit 1
759
777
  if mock
760
778
  make_dummy_files
761
779
  end
762
- copy_inputdataset_parameter_jobscripts
763
780
 
764
- # job submittion
765
- gstore_job_script_paths = []
766
- @job_scripts.each_with_index do |job_script, i|
767
- if job_id = submit(job_script, mock)
768
- @job_ids << job_id
769
- print "Submit job #{File.basename(job_script)} job_id=#{job_id}"
770
- gstore_job_script_paths << File.join(@gstore_script_dir, File.basename(job_script))
771
- end
772
- end
773
-
774
- puts
775
- print 'job scripts: '
776
- p @job_scripts
777
781
  print 'result dataset: '
778
782
  p @result_dataset
779
783
 
780
784
  # copy application data to gstore
781
785
  @next_dataset_tsv_path = save_next_dataset_as_tsv
782
786
 
783
- if !@job_ids.empty? and @dataset_sushi_id and dataset = DataSet.find_by_id(@dataset_sushi_id.to_i)
787
+ if @dataset_sushi_id and dataset = DataSet.find_by_id(@dataset_sushi_id.to_i)
784
788
  data_set_arr = []
785
789
  headers = []
786
790
  rows = []
@@ -805,20 +809,45 @@ rm -rf #{@scratch_dir} || exit 1
805
809
  unless @off_bfabric_registration
806
810
  if next_dataset = DataSet.find_by_id(@next_dataset_id)
807
811
  next_dataset.register_bfabric(bfabric_application_number: @next_dataset_bfabric_application_number)
812
+ if next_dataset.workunit_id
813
+ @job_scripts.each do |job_script|
814
+ open(job_script, "a") do |out|
815
+ out.puts "WORKUNIT_ID=#{next_dataset.workunit_id}"
816
+ out.puts "update_resource_size -w $WORKUNIT_ID"
817
+ end
818
+ end
819
+ end
808
820
  end
809
821
  end
822
+ end
823
+ end
824
+ copy_inputdataset_parameter_jobscripts
825
+
826
+ # job submittion
827
+ gstore_job_script_paths = []
828
+ @job_scripts.each_with_index do |job_script, i|
829
+ if job_id = submit(job_script, mock)
830
+ @job_ids << job_id
831
+ print "Submit job #{File.basename(job_script)} job_id=#{job_id}"
832
+ gstore_job_script_paths << File.join(@gstore_script_dir, File.basename(job_script))
833
+ end
834
+ end
835
+
836
+ puts
837
+ print 'job scripts: '
838
+ p @job_scripts
810
839
 
811
- # save job and dataset relation in Sushi DB
812
- job_ids.each_with_index do |job_id, i|
813
- new_job = Job.new
814
- new_job.submit_job_id = job_id.to_i
815
- new_job.script_path = gstore_job_script_paths[i]
816
- new_job.next_dataset_id = @next_dataset_id
817
- new_job.save
818
- new_job.data_set.jobs << new_job
819
- new_job.data_set.save
820
- end
821
840
 
841
+ unless @job_ids.empty? or NO_ROR
842
+ # save job and dataset relation in Sushi DB
843
+ job_ids.each_with_index do |job_id, i|
844
+ new_job = Job.new
845
+ new_job.submit_job_id = job_id.to_i
846
+ new_job.script_path = gstore_job_script_paths[i]
847
+ new_job.next_dataset_id = @next_dataset_id
848
+ new_job.save
849
+ new_job.data_set.jobs << new_job
850
+ new_job.data_set.save
822
851
  end
823
852
  end
824
853
  copy_nextdataset
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "0.9.6"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sushi_fabric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Functional Genomics Center Zurich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-09 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubyforge_project:
88
- rubygems_version: 2.6.14
87
+ rubygems_version: 3.0.3
89
88
  signing_key:
90
89
  specification_version: 4
91
90
  summary: workflow manager client.