sushi_fabric 1.1.3 → 1.1.7

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: 07c091813e683833c643c422de04c2a225ad3475ce46cf864003836c6b1056f9
4
- data.tar.gz: 03fa7b3efd213571886969d39e40cdb88e6af13e3b37a0ab195fafcc94a061da
3
+ metadata.gz: 59e67c9d4fe0a5833a2f5cee1cea4bed7961a88ee86e1d393c009855458a5940
4
+ data.tar.gz: a109369c8f10c36f910587e9185ba71e66f56ad1985671cf1a13084b84e9162b
5
5
  SHA512:
6
- metadata.gz: 49dc7c8c246fb31206cf949c0f2279ed6bced0d3c947a6c843cc0017899ede527650b6b862ff9846f8504be70e2a8360742ec68c40638878db647f3707d3f796
7
- data.tar.gz: 23ceb3abf7b4928ccdc92b1fc04fe745d9924374a7767d583f5a64e8947464463aa4577ba548ef1648cf4ce13c0a5f39aae93ba5468bce0d8d809c4aada436e2
6
+ metadata.gz: 61b7d5dbd9570f10935795ec7db46adf4f030f379f699617085c533f52e4c1978f69d9f0190ae6bb5968e09d820aec02c1181ece79eb9463c89ac689a08bcdc6
7
+ data.tar.gz: 7e96d353ec8b808060117dc88e0c762469d0eaae15ab52ee0dc96fcc9c52438864a81dcbfed11713f03c9c613adcf960b61c28b536ed03c2275e3e9aa500d41b
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20211104-160141'
3
+ # Version = '20220207-142315'
4
4
 
5
5
  require 'csv'
6
6
  require 'fileutils'
@@ -116,7 +116,11 @@ class ::Hash
116
116
  if v
117
117
  @defaults[k] = v
118
118
  else
119
- @defaults[k]
119
+ if @defaults
120
+ @defaults[k]
121
+ else
122
+ ""
123
+ end
120
124
  end
121
125
  end
122
126
  def data_type(k)
@@ -252,7 +256,7 @@ class SushiApp
252
256
  end
253
257
  def set_input_dataset
254
258
  if @dataset_tsv_file
255
- dataset_tsv = CSV.readlines(@dataset_tsv_file, {:headers=>true, :col_sep=>"\t"})
259
+ dataset_tsv = CSV.readlines(@dataset_tsv_file, :headers=>true, :col_sep=>"\t")
256
260
  @dataset_hash = []
257
261
  @dataset = []
258
262
  dataset_tsv.each do |row|
@@ -384,14 +388,23 @@ class SushiApp
384
388
  @result_dir = File.join(@project, @result_dir_base)
385
389
  @scratch_result_dir = File.join(SCRATCH_DIR, @result_dir_base)
386
390
  @job_script_dir = File.join(@scratch_result_dir, 'scripts')
391
+ @uploaded_files_dir = File.join(@scratch_result_dir, 'uploaded')
387
392
  @gstore_result_dir = File.join(@gstore_dir, @result_dir)
388
393
  @gstore_script_dir = File.join(@gstore_result_dir, 'scripts')
389
394
  @gstore_project_dir = File.join(@gstore_dir, @project)
395
+ @gstore_uploaded_dir = File.join(@gstore_result_dir, 'uploaded')
390
396
  set_file_paths
391
397
  end
392
398
  def prepare_result_dir
393
399
  FileUtils.mkdir_p(@scratch_result_dir)
394
400
  FileUtils.mkdir_p(@job_script_dir)
401
+ @uploaded_files = []
402
+ @params.each do |key, value|
403
+ if @params[key, 'file_upload']
404
+ FileUtils.mkdir_p(@uploaded_files_dir)
405
+ @uploaded_files << value
406
+ end
407
+ end
395
408
  end
396
409
  def check_latest_modules_version(modules)
397
410
  command_out = %x[ bash -lc "source #{@module_source}; module whatis #{modules.join(" ")} 2>&1" | cut -f 1 -d " " | uniq ]
@@ -577,7 +590,14 @@ rm -rf #{@scratch_dir} || exit 1
577
590
  CSV.open(file_path, 'w', :col_sep=>"\t") do |out|
578
591
  out << ["sushi_app", self.class.name]
579
592
  @output_params.each do |key, value|
580
- out << [key, value]
593
+ if @output_params[key, 'file_upload']
594
+ uploaded_file_path = File.join(@result_dir, "uploaded", File.basename(value))
595
+ out << [key, uploaded_file_path]
596
+ @params[key] = uploaded_file_path
597
+ @output_params[key] = uploaded_file_path
598
+ else
599
+ out << [key, value]
600
+ end
581
601
  end
582
602
  end
583
603
  file_path
@@ -629,6 +649,18 @@ rm -rf #{@scratch_dir} || exit 1
629
649
  end
630
650
  com
631
651
  end
652
+ def copy_uploaded_files
653
+ if not @uploaded_files.empty?
654
+ @uploaded_files.each do |file|
655
+ FileUtils.cp(file, @uploaded_files_dir)
656
+ command = "cp #{file} #{@uploaded_files_dir}"
657
+ puts command
658
+ FileUtils.rm_r(File.dirname(file))
659
+ command = "rm -rf #{File.dirname(file)}"
660
+ puts command
661
+ end
662
+ end
663
+ end
632
664
  def copy_inputdataset_parameter_jobscripts
633
665
  org = @scratch_result_dir
634
666
  dest = @gstore_project_dir
@@ -779,6 +811,12 @@ rm -rf #{@scratch_dir} || exit 1
779
811
  data_set.id
780
812
  end
781
813
  end
814
+ def save_parameters_in_sushi_db
815
+ if @next_dataset_id and next_dataset = DataSet.find_by_id(@next_dataset_id)
816
+ next_dataset.job_parameters = @output_params
817
+ next_dataset.save
818
+ end
819
+ end
782
820
  def main(mock=false)
783
821
  ## sushi writes creates the job scripts and builds the result data set that is to be generated
784
822
  @result_dataset = []
@@ -825,6 +863,7 @@ rm -rf #{@scratch_dir} || exit 1
825
863
  unless NO_ROR
826
864
  @current_user ||= nil
827
865
  @next_dataset_id = save_data_set(data_set_arr.to_a.flatten, headers, rows, @current_user, @child)
866
+ save_parameters_in_sushi_db
828
867
 
829
868
  unless @off_bfabric_registration
830
869
  if next_dataset = DataSet.find_by_id(@next_dataset_id)
@@ -841,6 +880,7 @@ rm -rf #{@scratch_dir} || exit 1
841
880
  end
842
881
  end
843
882
  end
883
+ copy_uploaded_files
844
884
  copy_inputdataset_parameter_jobscripts
845
885
 
846
886
  # job submittion
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.7"
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.3
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Functional Genomics Center Zurich
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-04 00:00:00.000000000 Z
11
+ date: 2022-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,7 +69,7 @@ homepage: ''
69
69
  licenses:
70
70
  - MIT
71
71
  metadata: {}
72
- post_install_message:
72
+ post_install_message:
73
73
  rdoc_options: []
74
74
  require_paths:
75
75
  - lib
@@ -84,8 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubygems_version: 3.0.3.1
88
- signing_key:
87
+ rubygems_version: 3.2.32
88
+ signing_key:
89
89
  specification_version: 4
90
90
  summary: workflow manager client.
91
91
  test_files: