sushi_fabric 1.1.2 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8673a804328196ed41af9ab969a5ae84871bcdfe642e699c7564d9a30ebeb5b
4
- data.tar.gz: 3749f2baffa9e17e37e26e36d5942bcef0d70d0ad6e1b34844892e48ab2e9482
3
+ metadata.gz: 9fedc477c136f74445e146138c9e0aa66be6fb2ab0c01da53c88827f19ac6363
4
+ data.tar.gz: 935cee957707889446cbd842e506551cb6269a38f71ad300e3c828bdac6790a0
5
5
  SHA512:
6
- metadata.gz: 0dc67d3759495c74ca090c919843dd2be3a05243a74bf9ad5a4966c9522d9434216320a9ad98edcb01eea7207f7caececa1212c4c0cefef7f561fe5710690121
7
- data.tar.gz: 1e81885828d563c1008c1b80b40f88fd9045de043715ca99c60b900dedb8671eda0746d90fb1a4505332230c0294cad073001c2b9af6ca3643f756e4e7f9f395
6
+ metadata.gz: 42da71dbf0da6dab834e42f943d2dd0fb8a8a29598e8274927abb2233fc9db15953961adb60fd99ce45ed265ea7d33e3f77949be7c6aaf05c9699d7c69ba94d0
7
+ data.tar.gz: 79f887cb36630cbc1ad3c8d8b1b8c6431348a5707cc83db17572223724ea275e6564c2ca885cbe52b7d427fb1ddafa69cd50db96d101797b266852b088861345
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20211015-142855'
3
+ # Version = '20220127-101054'
4
4
 
5
5
  require 'csv'
6
6
  require 'fileutils'
@@ -240,8 +240,6 @@ class SushiApp
240
240
  @params['cores'] = nil
241
241
  @params['ram'] = nil
242
242
  @params['scratch'] = nil
243
- @params['node'] = ''
244
- @params['queue'] = ''
245
243
  @params['partition'] = ''
246
244
  @params['process_mode'] = 'SAMPLE'
247
245
  @params['samples'] = ''
@@ -386,14 +384,23 @@ class SushiApp
386
384
  @result_dir = File.join(@project, @result_dir_base)
387
385
  @scratch_result_dir = File.join(SCRATCH_DIR, @result_dir_base)
388
386
  @job_script_dir = File.join(@scratch_result_dir, 'scripts')
387
+ @uploaded_files_dir = File.join(@scratch_result_dir, 'uploaded')
389
388
  @gstore_result_dir = File.join(@gstore_dir, @result_dir)
390
389
  @gstore_script_dir = File.join(@gstore_result_dir, 'scripts')
391
390
  @gstore_project_dir = File.join(@gstore_dir, @project)
391
+ @gstore_uploaded_dir = File.join(@gstore_result_dir, 'uploaded')
392
392
  set_file_paths
393
393
  end
394
394
  def prepare_result_dir
395
395
  FileUtils.mkdir_p(@scratch_result_dir)
396
396
  FileUtils.mkdir_p(@job_script_dir)
397
+ @uploaded_files = []
398
+ @params.each do |key, value|
399
+ if @params[key, 'file_upload']
400
+ FileUtils.mkdir_p(@uploaded_files_dir)
401
+ @uploaded_files << value
402
+ end
403
+ end
397
404
  end
398
405
  def check_latest_modules_version(modules)
399
406
  command_out = %x[ bash -lc "source #{@module_source}; module whatis #{modules.join(" ")} 2>&1" | cut -f 1 -d " " | uniq ]
@@ -517,6 +524,7 @@ rm -rf #{@scratch_dir} || exit 1
517
524
  gsub_options << "-p #{@params['partition']}" unless @params['partition'].to_s.empty?
518
525
  gsub_options << "-r #{@params['ram']}" unless @params['ram'].to_s.empty?
519
526
  gsub_options << "-s #{@params['scratch']}" unless @params['scratch'].to_s.empty?
527
+ gsub_options << "-i #{@params['nice']}" unless @params['nice'].to_s.empty?
520
528
  command = "wfm_monitoring --server #{WORKFLOW_MANAGER} --user #{@user} --project #{@project.gsub(/p/,'')} --logdir #{@gstore_script_dir} #{job_script} #{gsub_options.join(' ')}"
521
529
  puts "submit: #{command}"
522
530
 
@@ -578,7 +586,14 @@ rm -rf #{@scratch_dir} || exit 1
578
586
  CSV.open(file_path, 'w', :col_sep=>"\t") do |out|
579
587
  out << ["sushi_app", self.class.name]
580
588
  @output_params.each do |key, value|
581
- out << [key, value]
589
+ if @output_params[key, 'file_upload']
590
+ uploaded_file_path = File.join(@result_dir, "uploaded", File.basename(value))
591
+ out << [key, uploaded_file_path]
592
+ @params[key] = uploaded_file_path
593
+ @output_params[key] = uploaded_file_path
594
+ else
595
+ out << [key, value]
596
+ end
582
597
  end
583
598
  end
584
599
  file_path
@@ -630,6 +645,18 @@ rm -rf #{@scratch_dir} || exit 1
630
645
  end
631
646
  com
632
647
  end
648
+ def copy_uploaded_files
649
+ if not @uploaded_files.empty?
650
+ @uploaded_files.each do |file|
651
+ FileUtils.cp(file, @uploaded_files_dir)
652
+ command = "cp #{file} #{@uploaded_files_dir}"
653
+ puts command
654
+ FileUtils.rm_r(File.dirname(file))
655
+ command = "rm -rf #{File.dirname(file)}"
656
+ puts command
657
+ end
658
+ end
659
+ end
633
660
  def copy_inputdataset_parameter_jobscripts
634
661
  org = @scratch_result_dir
635
662
  dest = @gstore_project_dir
@@ -780,6 +807,12 @@ rm -rf #{@scratch_dir} || exit 1
780
807
  data_set.id
781
808
  end
782
809
  end
810
+ def save_parameters_in_sushi_db
811
+ if @next_dataset_id and next_dataset = DataSet.find_by_id(@next_dataset_id)
812
+ next_dataset.job_parameters = @output_params
813
+ next_dataset.save
814
+ end
815
+ end
783
816
  def main(mock=false)
784
817
  ## sushi writes creates the job scripts and builds the result data set that is to be generated
785
818
  @result_dataset = []
@@ -826,6 +859,7 @@ rm -rf #{@scratch_dir} || exit 1
826
859
  unless NO_ROR
827
860
  @current_user ||= nil
828
861
  @next_dataset_id = save_data_set(data_set_arr.to_a.flatten, headers, rows, @current_user, @child)
862
+ save_parameters_in_sushi_db
829
863
 
830
864
  unless @off_bfabric_registration
831
865
  if next_dataset = DataSet.find_by_id(@next_dataset_id)
@@ -842,6 +876,7 @@ rm -rf #{@scratch_dir} || exit 1
842
876
  end
843
877
  end
844
878
  end
879
+ copy_uploaded_files
845
880
  copy_inputdataset_parameter_jobscripts
846
881
 
847
882
  # job submittion
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.6"
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: 1.1.2
4
+ version: 1.1.6
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: 2021-10-15 00:00:00.000000000 Z
11
+ date: 2022-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler