sushi_fabric 0.2.1 → 0.2.2

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20140523-144630'
3
+ # Version = '20140612-161952'
4
4
 
5
5
  require 'csv'
6
6
  require 'fileutils'
@@ -580,12 +580,16 @@ rm -rf #{@scratch_dir} || exit 1
580
580
  set_user_parameters
581
581
 
582
582
  failures = 0
583
+ err_msgs = []
583
584
  print 'check project name: '
584
585
  unless @project
585
- puts "\e[31mFAILURE\e[0m: project number is required but not found. you should set it in usecase."
586
- puts "\tex.)"
587
- puts "\tapp = #{self.class}.new"
588
- puts "\tapp.project = 'p1001'"
586
+ err_msg = []
587
+ err_msg << "\e[31mFAILURE\e[0m: project number is required but not found. you should set it in usecase."
588
+ err_msg << "\tex.)"
589
+ err_msg << "\tapp = #{self.class}.new"
590
+ err_msg << "\tapp.project = 'p1001'"
591
+ puts err_msg.join("\n")
592
+ err_msgs.concat(err_msg)
589
593
  failures += 1
590
594
  else
591
595
  puts "\e[32mPASSED\e[0m:\n\t@project=#{@project}"
@@ -593,23 +597,29 @@ rm -rf #{@scratch_dir} || exit 1
593
597
 
594
598
  print 'check user name: '
595
599
  unless @user
596
- puts "\e[31mWARNING\e[0m: user number is ought to be added but not found. you should set it in usecase. Default will be 'sushi lover'"
597
- puts "\tex.)"
598
- puts "\tapp = #{self.class}.new"
599
- puts "\tapp.user = 'masa'"
600
+ err_msg = []
601
+ err_msg << "\e[31mWARNING\e[0m: user number is ought to be added but not found. you should set it in usecase. Default will be 'sushi lover'"
602
+ err_msg << "\tex.)"
603
+ err_msg << "\tapp = #{self.class}.new"
604
+ err_msg << "\tapp.user = 'masa'"
605
+ puts err_msg.join("\n")
606
+ err_msgs.concat(err_msg)
600
607
  else
601
608
  puts "\e[32mPASSED\e[0m:\n\t@user=#{@user}"
602
609
  end
603
610
 
604
611
  print 'check application name: '
605
612
  if @name.to_s.empty?
606
- puts "\e[31mFAILURE\e[0m: application name is required but not found. you should set it in application class."
607
- puts "\tex.)"
608
- puts "\tclass #{self.class}"
609
- puts "\t def initialize"
610
- puts "\t @name = '#{self.class}'"
611
- puts "\t end"
612
- puts "\tend"
613
+ err_msg = []
614
+ err_msg << "\e[31mFAILURE\e[0m: application name is required but not found. you should set it in application class."
615
+ err_msg << "\tex.)"
616
+ err_msg << "\tclass #{self.class}"
617
+ err_msg << "\t def initialize"
618
+ err_msg << "\t @name = '#{self.class}'"
619
+ err_msg << "\t end"
620
+ err_msg << "\tend"
621
+ puts err_msg.join("\n")
622
+ err_msgs.concat(err_msg)
613
623
  failures += 1
614
624
  else
615
625
  puts "\e[32mPASSED\e[0m:\n\t@name=#{@name}"
@@ -617,13 +627,16 @@ rm -rf #{@scratch_dir} || exit 1
617
627
 
618
628
  print 'check analysis_category: '
619
629
  if @analysis_category.to_s.empty?
620
- puts "\e[31mFAILURE\e[0m: analysis_category is required but not found. you should set it in application class."
621
- puts "\tex.)"
622
- puts "\tclass #{self.class}"
623
- puts "\t def initialize"
624
- puts "\t @analysis_category = 'Mapping'"
625
- puts "\t end"
626
- puts "\tend"
630
+ err_msg = []
631
+ err_msg << "\e[31mFAILURE\e[0m: analysis_category is required but not found. you should set it in application class."
632
+ err_msg << "\tex.)"
633
+ err_msg << "\tclass #{self.class}"
634
+ err_msg << "\t def initialize"
635
+ err_msg << "\t @analysis_category = 'Mapping'"
636
+ err_msg << "\t end"
637
+ err_msg << "\tend"
638
+ puts err_msg.join("\n")
639
+ err_msgs.concat(err_msg)
627
640
  failures += 1
628
641
  else
629
642
  puts "\e[32mPASSED\e[0m:\n\t@analysis_category=#{@analysis_category}"
@@ -631,10 +644,13 @@ rm -rf #{@scratch_dir} || exit 1
631
644
 
632
645
  print 'check dataset: '
633
646
  if !@dataset_hash or @dataset_hash.empty?
634
- puts "\e[31mFAILURE\e[0m: dataset is not found. you should set it by using #{self.class}#dataset_sushi_id or #{self.class}#dataset_tsv_file properties"
635
- puts "\tex.)"
636
- puts "\tusecase = #{self.class}.new"
637
- puts "\tusecase.dataset_tsv_file = \"dataset.tsv\""
647
+ err_msg = []
648
+ err_msg << "\e[31mFAILURE\e[0m: dataset is not found. you should set it by using #{self.class}#dataset_sushi_id or #{self.class}#dataset_tsv_file properties"
649
+ err_msg << "\tex.)"
650
+ err_msg << "\tusecase = #{self.class}.new"
651
+ err_msg << "\tusecase.dataset_tsv_file = \"dataset.tsv\""
652
+ puts err_msg.join("\n")
653
+ err_msgs.concat(err_msg)
638
654
  failures += 1
639
655
  else
640
656
  puts "\e[32mPASSED\e[0m:\n\t@dataset_hash.length = #{@dataset_hash.length}"
@@ -642,11 +658,13 @@ rm -rf #{@scratch_dir} || exit 1
642
658
 
643
659
  print 'check required columns: '
644
660
  unless check_required_columns
645
- puts "\e[31mFAILURE\e[0m: required_column(s) is not found in dataset. you should set it in application class."
646
- puts "\tex.)"
647
- puts "\tdef initialize"
648
- puts "\t @required_columns = ['Name', 'Read1']"
649
- puts
661
+ err_msg = []
662
+ err_msg << "\e[31mFAILURE\e[0m: required_column(s) is not found in dataset. you should set it in application class."
663
+ err_msg << "\tex.)"
664
+ err_msg << "\tdef initialize"
665
+ err_msg << "\t @required_columns = ['Name', 'Read1']"
666
+ puts err_msg.join("\n")
667
+ err_msgs.concat(err_msg)
650
668
  failures += 1
651
669
  else
652
670
  puts "\e[32mPASSED\e[0m:"
@@ -656,16 +674,18 @@ rm -rf #{@scratch_dir} || exit 1
656
674
 
657
675
  print 'check required parameters: '
658
676
  unless check_application_parameters
659
- puts "\e[31mFAILURE\e[0m: required_param(s) is not set yet. you should set it in usecase"
660
- puts "\tmissing params: #{@required_params-@params.keys}" if @required_params
661
- puts "\tex.)"
662
- puts "\tusecase = #{self.class}.new"
677
+ err_msg = []
678
+ err_msg << "\e[31mFAILURE\e[0m: required_param(s) is not set yet. you should set it in usecase"
679
+ err_msg << "\tmissing params: #{@required_params-@params.keys}" if @required_params
680
+ err_msg << "\tex.)"
681
+ err_msg << "\tusecase = #{self.class}.new"
663
682
  if @required_params
664
- puts "\tusecase.params['#{(@required_params-@params.keys)[0]}'] = parameter"
683
+ err_msg << "\tusecase.params['#{(@required_params-@params.keys)[0]}'] = parameter"
665
684
  else
666
- puts "\tusecase.params['parameter name'] = default_parameter"
685
+ err_msg << "\tusecase.params['parameter name'] = default_parameter"
667
686
  end
668
- puts
687
+ puts err_msg.join("\n")
688
+ err_msgs.concat(err_msg)
669
689
  failures += 1
670
690
  else
671
691
  puts "\e[32mPASSED\e[0m:"
@@ -676,8 +696,11 @@ rm -rf #{@scratch_dir} || exit 1
676
696
  print 'check next dataset: '
677
697
  @dataset={}
678
698
  unless self.next_dataset
679
- puts "\e[31mFAILURE\e[0m: next dataset is not set yet. you should overwrite SushiApp#next_dataset method in #{self.class}"
680
- puts "\tnote: the return value should be Hash (key: column title, value: value in a tsv table)"
699
+ err_msg = []
700
+ err_msg << "\e[31mFAILURE\e[0m: next dataset is not set yet. you should overwrite SushiApp#next_dataset method in #{self.class}"
701
+ err_msg << "\tnote: the return value should be Hash (key: column title, value: value in a tsv table)"
702
+ puts err_msg.join("\n")
703
+ err_msgs.concat(err_msg)
681
704
  failures += 1
682
705
  else
683
706
  puts "\e[32mPASSED\e[0m:"
@@ -685,10 +708,13 @@ rm -rf #{@scratch_dir} || exit 1
685
708
 
686
709
  print 'check output files: '
687
710
  if !@output_files or @output_files.empty?
688
- puts "\e[31mWARNING\e[0m: no output files. you will not get any output files after the job running. you can set @output_files (array) in #{self.class}"
689
- puts "\tnote: usually it should be define in initialize method"
690
- puts "\t the elements of @output_files should be chosen from #{self.class}#next_dataset.keys"
691
- puts "\t #{self.class}#next_dataset.keys: #{self.next_dataset.keys}" if self.next_dataset
711
+ err_msg = []
712
+ err_msg << "\e[31mWARNING\e[0m: no output files. you will not get any output files after the job running. you can set @output_files (array) in #{self.class}"
713
+ err_msg << "\tnote: usually it should be define in initialize method"
714
+ err_msg << "\t the elements of @output_files should be chosen from #{self.class}#next_dataset.keys"
715
+ err_msg << "\t #{self.class}#next_dataset.keys: #{self.next_dataset.keys}" if self.next_dataset
716
+ puts err_msg.join("\n")
717
+ err_msgs.concat(err_msg)
692
718
  else
693
719
  puts "\e[32mPASSED\e[0m:"
694
720
  end
@@ -698,8 +724,11 @@ rm -rf #{@scratch_dir} || exit 1
698
724
  @dataset_hash.each do |row|
699
725
  @dataset = Hash[*row.map{|key,value| [key.gsub(/\[.+\]/,'').strip, value]}.flatten]
700
726
  unless com = commands
701
- puts "\e[31mFAILURE\e[0m: any commands is not defined yet. you should overwrite SushiApp#commands method in #{self.class}"
702
- puts "\tnote: the return value should be String (this will be in the main body of submitted job script)"
727
+ err_msg = []
728
+ err_msg << "\e[31mFAILURE\e[0m: any commands is not defined yet. you should overwrite SushiApp#commands method in #{self.class}"
729
+ err_msg << "\tnote: the return value should be String (this will be in the main body of submitted job script)"
730
+ puts err_msg.join("\n")
731
+ err_msgs.concat(err_msg)
703
732
  failures += 1
704
733
  else
705
734
  puts "\e[32mPASSED\e[0m:"
@@ -709,8 +738,11 @@ rm -rf #{@scratch_dir} || exit 1
709
738
  end
710
739
  elsif @params['process_mode'] == 'DATASET'
711
740
  unless com = commands
712
- puts "\e[31mFAILURE\e[0m: any commands is not defined yet. you should overwrite SushiApp#commands method in #{self.class}"
713
- puts "\tnote: the return value should be String (this will be in the main body of submitted job script)"
741
+ err_msg = []
742
+ err_msg << "\e[31mFAILURE\e[0m: any commands is not defined yet. you should overwrite SushiApp#commands method in #{self.class}"
743
+ err_msg << "\tnote: the return value should be String (this will be in the main body of submitted job script)"
744
+ puts err_msg.join("\n")
745
+ err_msgs.concat(err_msg)
714
746
  failures += 1
715
747
  else
716
748
  puts "\e[32mPASSED\e[0m:"
@@ -725,7 +757,9 @@ rm -rf #{@scratch_dir} || exit 1
725
757
  rescue
726
758
  end
727
759
  unless hello =~ /hello/
728
- puts "\e[31mFAILURE\e[0m: workflow_manager does not reply. check if workflow_manager is working"
760
+ err_msg = "\e[31mFAILURE\e[0m: workflow_manager does not reply. check if workflow_manager is working"
761
+ puts err_msg
762
+ err_msgs.concat([err_msg])
729
763
  failures += 1
730
764
  else
731
765
  puts "\e[32mPASSED\e[0m:"
@@ -733,8 +767,10 @@ rm -rf #{@scratch_dir} || exit 1
733
767
 
734
768
  if failures > 0
735
769
  puts
736
- puts "\e[31mFailures (#{failures})\e[0m: All failures should be solved"
737
- raise "test run fails"
770
+ err_msg = "\e[31mFailures (#{failures})\e[0m: All failures should be solved"
771
+ puts err_msg
772
+ err_msgs.unshift(err_msg)
773
+ raise "\n"+err_msgs.join("\n")+"\n\n"
738
774
  else
739
775
  puts "All checks \e[32mPASSED\e[0m"
740
776
  end
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sushi_fabric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-26 00:00:00.000000000 Z
12
+ date: 2014-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler