sushi_fabric 1.1.0 → 1.1.4

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
2
  SHA256:
3
- metadata.gz: 4e8c7afdc3db914867cb23a1274fe257e8d16f60904c867e84ada16b3faeec5b
4
- data.tar.gz: 9e0db5e3421c31767b1c089652831dee04fd536e557969ad17519dbd1f681d0a
3
+ metadata.gz: b34ce73bf64c4447679ec3fa06820fccf59857ea739a9b16e9a91907051c1894
4
+ data.tar.gz: 5d7f45f91531ecb9c7014b6b3694622694b6257845b607cec8819256cbff9a2f
5
5
  SHA512:
6
- metadata.gz: ff6aa500c3ce2f3bdf1a33d3829b1aed9031c949fc894f69d23b9cbb7e47b4fbdb5c4477d3cb916e139c944521eeae0b619e7f1cc1df1991054d1b94cf7dd528
7
- data.tar.gz: a491d23bef554e292253aa28f08677b940bf8f2fd6a6d798a7423a1a62fba439bb378321ceb99464fd68a044f6031a3e25c578387406951a1c2f5b18e797196f
6
+ metadata.gz: 190e59e9c16c3e1031fdc929e6c4a3627cd63d0e1b6ecaf95aeba88158a08af587a398c9903efbcaf3efdc2cafafd39f015a3714365e4b7ed45adcdb18b83a66
7
+ data.tar.gz: 5ee4d5c6a57b06fedb6cecdf0cc396376846e1fe1ed41d431f3104ab140e0bfd0dbb34cb4df144e0cd08390315355498e09228509ded24ab976466d155358c80
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20210730-151826'
3
+ # Version = '20211207-151042'
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)
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,12 @@ 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(@gstore_uploaded_dir, File.basename(value))
591
+ out << [key, uploaded_file_path]
592
+ else
593
+ out << [key, value]
594
+ end
580
595
  end
581
596
  end
582
597
  file_path
@@ -628,6 +643,18 @@ rm -rf #{@scratch_dir} || exit 1
628
643
  end
629
644
  com
630
645
  end
646
+ def copy_uploaded_files
647
+ if not @uploaded_files.empty?
648
+ @uploaded_files.each do |file|
649
+ FileUtils.cp(file, @uploaded_files_dir)
650
+ command = "cp #{file} #{@uploaded_files_dir}"
651
+ puts command
652
+ FileUtils.rm_r(File.dirname(file))
653
+ command = "rm -rf #{File.dirname(file)}"
654
+ puts command
655
+ end
656
+ end
657
+ end
631
658
  def copy_inputdataset_parameter_jobscripts
632
659
  org = @scratch_result_dir
633
660
  dest = @gstore_project_dir
@@ -840,6 +867,7 @@ rm -rf #{@scratch_dir} || exit 1
840
867
  end
841
868
  end
842
869
  end
870
+ copy_uploaded_files
843
871
  copy_inputdataset_parameter_jobscripts
844
872
 
845
873
  # job submittion
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.4"
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.0
4
+ version: 1.1.4
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-07-30 00:00:00.000000000 Z
11
+ date: 2021-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler