sushi_fabric 1.1.1 → 1.1.5

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: f27bf481942df3066dc10ead974eb849cbc0c2f7ad010599d2d75b7cdf9d6762
4
- data.tar.gz: fd39ea3911fd3f9571ceb4c3b2071e51103109d85f7e9e042edabddc95733adc
3
+ metadata.gz: df087d665373defd52bfde8eb52acd6f3bfafd3092d220f7c95cdc75d949045c
4
+ data.tar.gz: 4dbc0933dfe40e740879b2a7b757f75a16f1a0f88a8df67800537c1ea3d42ea0
5
5
  SHA512:
6
- metadata.gz: 36560e6365fe052621295480761c71b1082601f645261a728910e8c03372a601fdfd8ea9883233a68212eaf0cbd60598a32c62fcbc068445b6c150bdf170aeb8
7
- data.tar.gz: 930e64f997d8383991e88c5c6f21fab27d5c1f40e59e16987b002a62615d96aa65571eca1c055708c75b0f96496bd3bf3a9ee72d025e5a75e1e1e79b8143c973
6
+ metadata.gz: dfa9b02cd70f2b112d2ffc9c3679a7d1590a5ce9388149588b7d026d34b705832af3371b7c84f9a873056dda454372be9dfd33e8cb491ddc7322b0f6192402a7
7
+ data.tar.gz: 4b79c6dda54fb542ac3d4e0bad03f5333729b76f21b0e2758b14a3402b6dba04f9824b1e26d9cca05e050a69af19cf5e3ce8e8338894b116c4ad89a61144419d
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20210813-192118'
3
+ # Version = '20211209-162918'
4
4
 
5
5
  require 'csv'
6
6
  require 'fileutils'
@@ -20,6 +20,7 @@ module SushiFabric
20
20
  config.scratch_dir = '/tmp/scratch'
21
21
  config.module_source = nil
22
22
  config.course_mode = nil
23
+ config.rails_host = nil
23
24
  end
24
25
 
25
26
  # load custmized parameters if there is
@@ -41,6 +42,7 @@ module SushiFabric
41
42
  config.scratch_dir = '/tmp/scratch'
42
43
  config.module_source = nil
43
44
  config.course_mode = nil
45
+ config.rails_host = nil
44
46
  end
45
47
  end
46
48
  EOF
@@ -53,7 +55,7 @@ end
53
55
  SUSHI_APP_DIR = config.sushi_app_dir
54
56
  SCRATCH_DIR = config.scratch_dir
55
57
  MODULE_SOURCE = config.module_source
56
-
58
+ RAILS_HOST = config.rails_host
57
59
  unless File.exist?(GSTORE_DIR)
58
60
  FileUtils.mkdir_p GSTORE_DIR
59
61
  end
@@ -238,8 +240,6 @@ class SushiApp
238
240
  @params['cores'] = nil
239
241
  @params['ram'] = nil
240
242
  @params['scratch'] = nil
241
- @params['node'] = ''
242
- @params['queue'] = ''
243
243
  @params['partition'] = ''
244
244
  @params['process_mode'] = 'SAMPLE'
245
245
  @params['samples'] = ''
@@ -384,14 +384,23 @@ class SushiApp
384
384
  @result_dir = File.join(@project, @result_dir_base)
385
385
  @scratch_result_dir = File.join(SCRATCH_DIR, @result_dir_base)
386
386
  @job_script_dir = File.join(@scratch_result_dir, 'scripts')
387
+ @uploaded_files_dir = File.join(@scratch_result_dir, 'uploaded')
387
388
  @gstore_result_dir = File.join(@gstore_dir, @result_dir)
388
389
  @gstore_script_dir = File.join(@gstore_result_dir, 'scripts')
389
390
  @gstore_project_dir = File.join(@gstore_dir, @project)
391
+ @gstore_uploaded_dir = File.join(@gstore_result_dir, 'uploaded')
390
392
  set_file_paths
391
393
  end
392
394
  def prepare_result_dir
393
395
  FileUtils.mkdir_p(@scratch_result_dir)
394
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
395
404
  end
396
405
  def check_latest_modules_version(modules)
397
406
  command_out = %x[ bash -lc "source #{@module_source}; module whatis #{modules.join(" ")} 2>&1" | cut -f 1 -d " " | uniq ]
@@ -515,6 +524,7 @@ rm -rf #{@scratch_dir} || exit 1
515
524
  gsub_options << "-p #{@params['partition']}" unless @params['partition'].to_s.empty?
516
525
  gsub_options << "-r #{@params['ram']}" unless @params['ram'].to_s.empty?
517
526
  gsub_options << "-s #{@params['scratch']}" unless @params['scratch'].to_s.empty?
527
+ gsub_options << "-i #{@params['nice']}" unless @params['nice'].to_s.empty?
518
528
  command = "wfm_monitoring --server #{WORKFLOW_MANAGER} --user #{@user} --project #{@project.gsub(/p/,'')} --logdir #{@gstore_script_dir} #{job_script} #{gsub_options.join(' ')}"
519
529
  puts "submit: #{command}"
520
530
 
@@ -524,7 +534,7 @@ rm -rf #{@scratch_dir} || exit 1
524
534
  job_id = 0
525
535
  begin
526
536
  #job_id = @workflow_manager.start_monitoring(job_script, @user, 0, script_content, project_number, gsub_options.join(' '), @gstore_script_dir)
527
- job_id = @workflow_manager.start_monitoring3(job_script, script_content, @user, project_number, gsub_options.join(' '), @gstore_script_dir, @next_dataset_id)
537
+ job_id = @workflow_manager.start_monitoring3(job_script, script_content, @user, project_number, gsub_options.join(' '), @gstore_script_dir, @next_dataset_id, RAILS_HOST)
528
538
  rescue => e
529
539
  time = Time.now.strftime("[%Y.%m.%d %H:%M:%S]")
530
540
  @logger.error("*"*50)
@@ -576,7 +586,13 @@ rm -rf #{@scratch_dir} || exit 1
576
586
  CSV.open(file_path, 'w', :col_sep=>"\t") do |out|
577
587
  out << ["sushi_app", self.class.name]
578
588
  @output_params.each do |key, value|
579
- 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
+ else
594
+ out << [key, value]
595
+ end
580
596
  end
581
597
  end
582
598
  file_path
@@ -628,6 +644,18 @@ rm -rf #{@scratch_dir} || exit 1
628
644
  end
629
645
  com
630
646
  end
647
+ def copy_uploaded_files
648
+ if not @uploaded_files.empty?
649
+ @uploaded_files.each do |file|
650
+ FileUtils.cp(file, @uploaded_files_dir)
651
+ command = "cp #{file} #{@uploaded_files_dir}"
652
+ puts command
653
+ FileUtils.rm_r(File.dirname(file))
654
+ command = "rm -rf #{File.dirname(file)}"
655
+ puts command
656
+ end
657
+ end
658
+ end
631
659
  def copy_inputdataset_parameter_jobscripts
632
660
  org = @scratch_result_dir
633
661
  dest = @gstore_project_dir
@@ -840,6 +868,7 @@ rm -rf #{@scratch_dir} || exit 1
840
868
  end
841
869
  end
842
870
  end
871
+ copy_uploaded_files
843
872
  copy_inputdataset_parameter_jobscripts
844
873
 
845
874
  # job submittion
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.5"
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.1
4
+ version: 1.1.5
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-08-15 00:00:00.000000000 Z
11
+ date: 2021-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler