coderunner 0.11.23 → 0.12.0
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.
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0. | 
| 1 | 
            +
            0.12.0
         | 
    
        data/coderunner.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = "coderunner"
         | 
| 8 | 
            -
              s.version = "0. | 
| 8 | 
            +
              s.version = "0.12.0"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Edmund Highcock"]
         | 
| 12 | 
            -
              s.date = "2013-03- | 
| 12 | 
            +
              s.date = "2013-03-08"
         | 
| 13 13 | 
             
              s.description = "CodeRunner is a framework for the automated running and analysis of simulations. It automatically generates any necessary input files, organises the output data and analyses it. Because it is a modular system, it can easily be customised to work with any system and any simulation code. One of its greatest strengths is that it is independent of any one simulation code; thus it can easily plot and compare the data from different codes."
         | 
| 14 14 | 
             
              s.email = "edmundhighcock@sourceforge.net"
         | 
| 15 15 | 
             
              s.executables = ["coderunner"]
         | 
    
        data/lib/coderunner.rb
    CHANGED
    
    | @@ -203,6 +203,7 @@ EOF | |
| 203 203 | 
             
            		["code_runner_execute", "crex",  1, 'Run (within the CodeRunner class) the fragment of Ruby code given.', ['Ruby fragment'], []],	
         | 
| 204 204 | 
             
            		["delete", "del", 0, 'Permanently erase all filtered runs.', [], [:j, :F, :U, :N]],
         | 
| 205 205 | 
             
            		["directory", "dir", 1, 'Print out the directory for the given run.', ['id'], []],
         | 
| 206 | 
            +
            		['dumb_film', "dfm", 0, 'Create a film of the specified graphkits using gnuplot "dumb" ASCII terminal.', [], [:F, :G, :g, :U, :N, :j, :f]],
         | 
| 206 207 | 
             
            		["execute", "ex",  1, 'Run (at the top level) the fragment of Ruby code given.', ['Ruby fragment'], []],	
         | 
| 207 208 | 
             
            		['film', "fm", 0, 'Create a film of the specified graphkits.', [], [:F, :G, :g, :U, :N, :j, :f]],
         | 
| 208 209 | 
             
            		["generate_modlet_from_input_file", "gm", 1, 'Deprecated', [], []],
         | 
| @@ -77,6 +77,28 @@ class CodeRunner | |
| 77 77 | 
             
            		runner.destroy
         | 
| 78 78 | 
             
            	end
         | 
| 79 79 |  | 
| 80 | 
            +
            	def self.dumb_film(copts = {})
         | 
| 81 | 
            +
            # 		process_copts(copts)
         | 
| 82 | 
            +
            		#old_term = GraphKit::GNUPLOT_DEFAULT_TERM
         | 
| 83 | 
            +
            		size = Terminal.terminal_size
         | 
| 84 | 
            +
            		size[0] -= 2
         | 
| 85 | 
            +
            		term = "dumb #{size.reverse.join(' ')}"
         | 
| 86 | 
            +
            		string = "\n" * size[0]
         | 
| 87 | 
            +
             | 
| 88 | 
            +
            		runner = fetch_runner(copts)
         | 
| 89 | 
            +
            		string_to_eval = copts[:w]
         | 
| 90 | 
            +
            		frame_array = copts[:F][:frame_array] || copts[:F][:fa]
         | 
| 91 | 
            +
            		index_name = copts[:F][:index_name] || copts[:F][:in]
         | 
| 92 | 
            +
            		#options = (options and options =~ /\S/) ? eval(options): {}
         | 
| 93 | 
            +
            		puts string
         | 
| 94 | 
            +
            		for index in frame_array[0]..frame_array[1]
         | 
| 95 | 
            +
            			string.true_lines.times{print "\033[A"}
         | 
| 96 | 
            +
            			kit = runner.graphkit_from_lists(copts[:G], copts[:g], index_name => index)
         | 
| 97 | 
            +
                  kit.gp.term =  term
         | 
| 98 | 
            +
            			kit.gnuplot(eval: string_to_eval)
         | 
| 99 | 
            +
            			sleep(copts[:F][:fr] ? 1.0/copts[:F][:fr] :  0.1)
         | 
| 100 | 
            +
            		end 
         | 
| 101 | 
            +
            	end
         | 
| 80 102 | 
             
            # 	def self.executable_name # :nodoc:
         | 
| 81 103 | 
             
            # 		""
         | 
| 82 104 | 
             
            # 	end
         | 
| @@ -205,13 +227,17 @@ EOF | |
| 205 227 |  | 
| 206 228 | 
             
            	end
         | 
| 207 229 |  | 
| 230 | 
            +
            	def self.launcher_directory
         | 
| 231 | 
            +
            		ENV['HOME'] + "/.coderunner/to_launch/#{ENV['CODE_RUNNER_LAUNCHER']}"
         | 
| 232 | 
            +
            	end
         | 
| 208 233 | 
             
              def self.start_launcher(refresh, max_queue, copts={})
         | 
| 209 234 | 
             
            		raise "Raise refresh is #{refresh}: it must be >= 1" if refresh.to_i < 1
         | 
| 210 235 | 
             
            		raise "Raise max_queue is #{max_queue}: it must be >= 5" if max_queue.to_i < 5
         | 
| 211 236 | 
             
                #raise "Launcher already running" if %x[ps -e -o cmd].split("\n").grep(/coderunner\s+launch/).size > 0
         | 
| 212 237 | 
             
                require 'thread'
         | 
| 213 | 
            -
                tl =  | 
| 214 | 
            -
            		exit unless Feedback.get_boolean( "Launch directory #{tl} already exists: it is suggested that you change the prefix by changing the environment variable CODE_RUNNER_LAUNCHER. Do you wish to continue (don't select yes unless you know what you are doing)?") if FileTest.exist? tl
         | 
| 238 | 
            +
                tl = launcher_directory #SCRIPT_FOLDER + '/to_launch'
         | 
| 239 | 
            +
            		#exit unless Feedback.get_boolean( "Launch directory #{tl} already exists: it is suggested that you change the prefix by changing the environment variable CODE_RUNNER_LAUNCHER. Do you wish to continue (don't select yes unless you know what you are doing)?") if FileTest.exist? tl
         | 
| 240 | 
            +
            		raise "Launch directory #{tl} already exists: it is suggested that you change the prefix by changing the environment variable CODE_RUNNER_LAUNCHER. Do you wish to continue (don't select yes unless you know what you are doing)?" if FileTest.exist? tl
         | 
| 215 241 | 
             
            #     FileUtils.rm_r tl if FileTest.exist? tl
         | 
| 216 242 | 
             
                eputs "Starting launcher\n"
         | 
| 217 243 | 
             
            		at_exit{FileUtils.rm_r tl}
         | 
| @@ -240,17 +240,25 @@ class CodeRunner | |
| 240 240 |  | 
| 241 241 | 
             
            	def read_folder_defaults
         | 
| 242 242 | 
             
            # 		p @root_folder + '/.code_runner_script_defaults.rb'
         | 
| 243 | 
            -
            		 | 
| 244 | 
            -
             | 
| 243 | 
            +
            		if ENV['CODE_RUNNER_READONLY_DEFAULTS']
         | 
| 244 | 
            +
            			hash = eval(File.read(@root_folder + '/.code_runner_script_defaults.rb'))
         | 
| 245 245 | 
             
            			FOLDER_DEFAULTS.each do |var|
         | 
| 246 | 
            -
             | 
| 247 | 
            -
             | 
| 248 | 
            -
             | 
| 249 | 
            -
             | 
| 246 | 
            +
            				set(var, hash[var]) if hash[var]
         | 
| 247 | 
            +
            			end
         | 
| 248 | 
            +
            		else
         | 
| 249 | 
            +
             | 
| 250 | 
            +
            			Hash.phoenix(@root_folder + '/.code_runner_script_defaults.rb') do |hash|
         | 
| 251 | 
            +
            	# 			ep hash
         | 
| 252 | 
            +
            				FOLDER_DEFAULTS.each do |var|
         | 
| 253 | 
            +
            	# 				p send(var), hash[var]
         | 
| 254 | 
            +
            					hash[var] = (send(var) or hash[var])
         | 
| 255 | 
            +
            					hash[:code_runner_version] ||= CodeRunner::CODE_RUNNER_VERSION.to_s
         | 
| 256 | 
            +
            					set(var, hash[var])
         | 
| 257 | 
            +
            				end
         | 
| 258 | 
            +
            				@start_id = hash[:start_id] if hash[:start_id]
         | 
| 259 | 
            +
            	# 			ep "start_id: #@start_id"
         | 
| 260 | 
            +
            				hash
         | 
| 250 261 | 
             
            			end
         | 
| 251 | 
            -
            			@start_id = hash[:start_id] if hash[:start_id]
         | 
| 252 | 
            -
            # 			ep "start_id: #@start_id"
         | 
| 253 | 
            -
            			hash
         | 
| 254 262 | 
             
            		end
         | 
| 255 263 |  | 
| 256 264 | 
             
            		raise "No default information exists for this folder. If you are running CodeRunner from the commmand line please run again with the -C <code> and -X <executable> (and -m <modlet>, if required) flag (you only need to specify these flags once in each folder). Else, please specify :code and :executable (and :modlet if required) as options in CodeRunner.new(folder, options)" unless @code and @executable
         | 
| @@ -41,7 +41,7 @@ def execute | |
| 41 41 | 
             
            # 	pid = spawn("trap '' 2 && trap '' 0 && " + run_command + " & ")
         | 
| 42 42 | 
             
              if prefix = ENV['CODE_RUNNER_LAUNCHER']
         | 
| 43 43 | 
             
                launch_id = "#{Time.now.to_i}#{$$}"
         | 
| 44 | 
            -
                fname =  | 
| 44 | 
            +
                fname = CodeRunner.launcher_directory + "/#{launch_id}"
         | 
| 45 45 | 
             
                File.open(fname + '.start', 'w'){|file| file.puts "cd #{Dir.pwd};#{run_command}"}
         | 
| 46 46 | 
             
                sleep 1 until FileTest.exist? fname + '.pid'
         | 
| 47 47 | 
             
                pid = File.read(fname + '.pid').to_i
         | 
| @@ -14,8 +14,8 @@ EOF | |
| 14 14 |  | 
| 15 15 | 
             
            	def queue_status
         | 
| 16 16 | 
             
            		if ((prefix = ENV['CODE_RUNNER_LAUNCHER']).size > 0 rescue false)
         | 
| 17 | 
            -
            			%x[cat #{ | 
| 18 | 
            -
            			%x[cat #{ | 
| 17 | 
            +
            			%x[cat #{CodeRunner.launcher_directory}/queue_status.txt | grep sh]  +
         | 
| 18 | 
            +
            			%x[cat #{CodeRunner.launcher_directory}/queue_status2.txt | grep sh] 
         | 
| 19 19 | 
             
            		else
         | 
| 20 20 | 
             
            			%x[qstat | grep $USER]
         | 
| 21 21 | 
             
            		end
         | 
| @@ -48,7 +48,7 @@ EOF | |
| 48 48 | 
             
            	def execute
         | 
| 49 49 | 
             
            		if ((prefix = ENV['CODE_RUNNER_LAUNCHER']).size > 0 rescue false)
         | 
| 50 50 | 
             
            			launch_id = "#{Time.now.to_i}#{$$}"
         | 
| 51 | 
            -
            			fname =  | 
| 51 | 
            +
            			fname = "#{CodeRunner.launcher_directory}/#{launch_id}"
         | 
| 52 52 | 
             
            			File.open(fname + '.start', 'w'){|file| file.print "cd #{Dir.pwd};", run_command, "\n"}
         | 
| 53 53 | 
             
            			sleep 2 until FileTest.exist? fname + '.pid'
         | 
| 54 54 | 
             
            			pid = File.read(fname + '.pid').to_i
         | 
| @@ -107,7 +107,7 @@ EOF | |
| 107 107 |  | 
| 108 108 | 
             
            	def cancel_job
         | 
| 109 109 | 
             
            		if ((prefix = ENV['CODE_RUNNER_LAUNCHER']).size > 0 rescue false)
         | 
| 110 | 
            -
            			 fname =  | 
| 110 | 
            +
            			 fname = CodeRunner.launcher_directory + "/#{$$}.stop"
         | 
| 111 111 | 
             
            			 File.open(fname, 'w'){|file| file.puts "\n"}
         | 
| 112 112 | 
             
            		else
         | 
| 113 113 | 
             
            			`qdel #{@job_no}`
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: coderunner
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.12.0
         | 
| 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: 2013-03- | 
| 12 | 
            +
            date: 2013-03-08 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: graphkit
         |