sushi_fabric 0.3.8 → 0.3.9

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
  SHA1:
3
- metadata.gz: 7dba2a7b1a709b27cf5807285f7a2b2167125e43
4
- data.tar.gz: 12fc6c25ca5698af3e1f01ef1355b168d9165a8f
3
+ metadata.gz: 48669658a0c5f3b680bc3aa8b444902e285b67ae
4
+ data.tar.gz: 20e0b60dba4ccb53b8859eb35026f2394b2639b9
5
5
  SHA512:
6
- metadata.gz: 4d195631aa4d5c951e349f057aefacbba1bda09a7f623146c18129ee557bc4072f93a5d8a88c54bad3904afd4790c2e4dcea5ee267344bc5dca7bc6671f4a0e0
7
- data.tar.gz: 0f6734a04b44a79c8b7469a498a3b20a1abf82dfe3b896e406357de5e2f2cb53230f308ca284aa347312ccc830a8655397616d3cfa4c554667791778aba8dc24
6
+ metadata.gz: f9e45953157f9306d4fdcece49aae97902a034e76f461422763273844f3540fab70ed6042968a64fbb610223f04c62a5e81eaa20fe157ee78e5d38a835b1cb53
7
+ data.tar.gz: 014e463dbcc6d7b6580f619cb309c45fa9b6ece3e3b6f971b0972fde54607b415a9a6c16835b019bd6595c8a43b58fd8cf27cbf2492ef1bcdaa1e1e3ea440eb5
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20150529-100405'
3
+ # Version = '20150604-164027'
4
4
 
5
5
  require 'csv'
6
6
  require 'fileutils'
@@ -541,6 +541,73 @@ rm -rf #{@scratch_dir} || exit 1
541
541
  end
542
542
  #=end
543
543
  end
544
+ def main
545
+ ## sushi writes creates the job scripts and builds the result data set that is to be generated
546
+ @result_dataset = []
547
+ @job_scripts = []
548
+ if @params['process_mode'] == 'SAMPLE'
549
+ sample_mode
550
+ elsif @params['process_mode'] == 'DATASET'
551
+ dataset_mode
552
+ else
553
+ #stop
554
+ warn "the process mode (#{@params['process_mode']}) is not defined"
555
+ raise "stop job submitting"
556
+ end
557
+ copy_inputdataset_parameter_jobscripts
558
+
559
+ # job submittion
560
+ @job_scripts.each_with_index do |job_script, i|
561
+ job_id = submit(job_script)
562
+ @job_ids << job_id
563
+ print "Submit job #{File.basename(job_script)} job_id=#{job_id}"
564
+ end
565
+
566
+ puts
567
+ print 'job scripts: '
568
+ p @job_scripts
569
+ print 'result dataset: '
570
+ p @result_dataset
571
+
572
+ # copy application data to gstore
573
+ @next_dataset_tsv_path = save_next_dataset_as_tsv
574
+
575
+ if !@job_ids.empty? and @dataset_sushi_id and dataset = DataSet.find_by_id(@dataset_sushi_id.to_i)
576
+ data_set_arr = []
577
+ headers = []
578
+ rows = []
579
+ next_dataset_name = if name = @next_dataset_name
580
+ name.to_s
581
+ else
582
+ "#{@analysis_category}_#{@name.gsub(/\s/,'').gsub(/_/,'')}_#{dataset.id}"
583
+ end
584
+ data_set_arr = {'DataSetName'=>next_dataset_name, 'ProjectNumber'=>@project.gsub(/p/,''), 'ParentID'=>@dataset_sushi_id, 'Comment'=>@next_dataset_comment.to_s}
585
+ csv = CSV.readlines(@next_dataset_tsv_path, :col_sep=>"\t")
586
+ csv.each do |row|
587
+ if headers.empty?
588
+ headers = row
589
+ else
590
+ rows << row
591
+ end
592
+ end
593
+ unless NO_ROR
594
+ #@next_dataset_id = save_data_set(data_set_arr.to_a.flatten, headers, rows, current_user)
595
+ @next_dataset_id = save_data_set(data_set_arr.to_a.flatten, headers, rows)
596
+
597
+ # save job and dataset relation in Sushi DB
598
+ job_ids.each do |job_id|
599
+ new_job = Job.new
600
+ new_job.submit_job_id = job_id.to_i
601
+ new_job.next_dataset_id = @next_dataset_id
602
+ new_job.save
603
+ new_job.data_set.jobs << new_job
604
+ new_job.data_set.save
605
+ end
606
+
607
+ end
608
+ end
609
+ copy_nextdataset
610
+ end
544
611
  def run
545
612
  test_run
546
613
 
@@ -551,83 +618,17 @@ rm -rf #{@scratch_dir} || exit 1
551
618
  save_parameters_as_tsv
552
619
  save_input_dataset_as_tsv
553
620
 
554
- # t = Thread.new do
555
- pid = Process.fork do
556
- Process.fork do
557
-
558
- ## sushi writes creates the job scripts and builds the result data set that is to be generated
559
- @result_dataset = []
560
- @job_scripts = []
561
- if @params['process_mode'] == 'SAMPLE'
562
- sample_mode
563
- elsif @params['process_mode'] == 'DATASET'
564
- dataset_mode
565
- else
566
- #stop
567
- warn "the process mode (#{@params['process_mode']}) is not defined"
568
- raise "stop job submitting"
569
- end
570
- copy_inputdataset_parameter_jobscripts
571
-
572
- # job submittion
573
- @job_scripts.each_with_index do |job_script, i|
574
- job_id = submit(job_script)
575
- @job_ids << job_id
576
- print "Submit job #{File.basename(job_script)} job_id=#{job_id}"
577
- end
578
-
579
- puts
580
- print 'job scripts: '
581
- p @job_scripts
582
- print 'result dataset: '
583
- p @result_dataset
584
-
585
- # copy application data to gstore
586
- @next_dataset_tsv_path = save_next_dataset_as_tsv
587
-
588
- if !@job_ids.empty? and @dataset_sushi_id and dataset = DataSet.find_by_id(@dataset_sushi_id.to_i)
589
- data_set_arr = []
590
- headers = []
591
- rows = []
592
- next_dataset_name = if name = @next_dataset_name
593
- name.to_s
594
- else
595
- "#{@analysis_category}_#{@name.gsub(/\s/,'').gsub(/_/,'')}_#{dataset.id}"
596
- end
597
- data_set_arr = {'DataSetName'=>next_dataset_name, 'ProjectNumber'=>@project.gsub(/p/,''), 'ParentID'=>@dataset_sushi_id, 'Comment'=>@next_dataset_comment.to_s}
598
- csv = CSV.readlines(@next_dataset_tsv_path, :col_sep=>"\t")
599
- csv.each do |row|
600
- if headers.empty?
601
- headers = row
602
- else
603
- rows << row
604
- end
605
- end
606
- unless NO_ROR
607
- #@next_dataset_id = save_data_set(data_set_arr.to_a.flatten, headers, rows, current_user)
608
- @next_dataset_id = save_data_set(data_set_arr.to_a.flatten, headers, rows)
609
-
610
- # save job and dataset relation in Sushi DB
611
- job_ids.each do |job_id|
612
- new_job = Job.new
613
- new_job.submit_job_id = job_id.to_i
614
- new_job.next_dataset_id = @next_dataset_id
615
- new_job.save
616
- new_job.data_set.jobs << new_job
617
- new_job.data_set.save
618
- end
619
-
620
- end
621
- end
622
- copy_nextdataset
623
- end # grand-child process
624
- end # child process
625
- Process.waitpid pid
626
- # if Thread.main == Thread.current # in case of running script directly on terminal
627
- # warn "copy next dataset..."
628
- # t.join
629
- # warn "copy finish."
630
- # end
621
+ if `hostname`.chomp =~ /fgcz-s-034/
622
+ # this causes sqlite3 IO error in Mac OSX (Yosemite)
623
+ pid = Process.fork do
624
+ Process.fork do
625
+ main
626
+ end # grand-child process
627
+ end # child process
628
+ Process.waitpid pid
629
+ else
630
+ main
631
+ end
631
632
  end
632
633
  def test_run
633
634
  set_input_dataset
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
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.3.8
4
+ version: 0.3.9
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: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler