Class: CodeRunner::Cubecalc

Inherits:
Run show all
Defined in:
lib/cubecalccrmod.rb,
lib/cubecalccrmod/empty.rb,
lib/cubecalccrmod/sleep.rb

Direct Known Subclasses

Empty, Sleep

Defined Under Namespace

Classes: Empty, Sleep

Instance Attribute Summary

Attributes inherited from Run

#code, #code_runner_version, #executable_name, #max_complete, #maxes, #naming_pars, #nprocs, #real_id, #run_test_flags, #runner, #sys, #version

Instance Method Summary collapse

Methods inherited from Run

#analyse_input_file_text, #cache, check_and_update, #code_run_environment, #comment_line, #create_phantom, #data_string, #defaults_file_name, #defaults_location, #dup, #error, #evaluate_defaults_file, #execute_submission, finish_setting_up_class, #generate_combined_ids, #generate_run_name, #gets, gets, #hard_cache, #info_file, #initialize, #inspect, #is_complete, #job_identifier, #learn_from, load, #logiv, #max, #min, modify_job_script, #p, #prepare_submission, #pretty_print, #print, #process_directory, #puts, #rcp, rcp, #read_info, #read_results, #recheck, #results_file, #run_heuristic_analysis, #save, set_modlet, #smax, #smin, #try_by_system, #try_to_find_job_output_ends, #try_to_get_error_file, #try_to_get_job_number, #try_to_get_output_file, #update_in_queue, update_status, #update_submission_parameters, #warning, #write_info, #write_results

Constructor Details

This class inherits a constructor from CodeRunner::Run

Instance Method Details

#executable_locationObject



72
73
74
# File 'lib/cubecalccrmod.rb', line 72

def executable_location
	@runner.script_folder + '/test_suite'
end

#generate_input_fileObject



61
62
63
64
65
66
67
# File 'lib/cubecalccrmod.rb', line 61

def generate_input_file
	File.open('edges.txt', 'w') do |file|
		file.puts @width
		file.puts @height
		file.puts @depth
	end
end

#generate_phantom_runsObject



77
78
79
80
81
82
83
84
85
# File 'lib/cubecalccrmod.rb', line 77

def generate_phantom_runs
	return unless @sides
	@sides.each do |area|
# 		puts 'creating phantom: ' + @run_name
		phantom = create_phantom
		phantom.area = area
		phantom.phantom_run_description = :area
	end
end

#graphkit(name, options) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/cubecalccrmod.rb', line 87

def graphkit(name, options)
	case name
	when /sides/
# 		x = AxisKit.autocreate({data: ["'width'", "'depth'", "'height'"], name: 'Properties'})
		x = GraphKit::AxisKit.autocreate({data: sides, title: "Areas of the Sides:  #@run_name"})
# 		x.range = [0, x.data.max]
		kit = GraphKit.autocreate({x: x})
		kit.style = 'data histograms'
		kit.file_name = 'inputs'
# 		kit.with = 'histogram clustered'
		return kit
	else
		raise 'Unknown graph'
	end
end

#parameter_stringObject



57
58
59
# File 'lib/cubecalccrmod.rb', line 57

def parameter_string
	return sprintf("%d %s", @calculate_sides, 'edges.txt')
end

#parameter_transition(run) ⇒ Object



69
70
# File 'lib/cubecalccrmod.rb', line 69

def parameter_transition(run)
end


45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cubecalccrmod.rb', line 45

def print_out_line
	if @is_phantom
		if @phantom_run_description == :area
			return sprintf("%d:%d %30s %10s %f %s", @id, @job_no, @run_name, @status, (@volume or 0.0), @area.to_s)
		else
			raise 'there is only one phantom_run_description at the moment'
		end
	else
		return sprintf("%d:%d %30s %10s %f %s", @id, @job_no, @run_name, @status, (@volume or 0.0), @sides.to_s)
	end
end

#process_directory_code_specificObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cubecalccrmod.rb', line 28

def process_directory_code_specific
	if @running
		@status = :Incomplete
	else
		if FileTest.exist? 'results.txt'
			@status = :Complete
			@volume = File.readlines('results.txt')[0].scan(LongRegexen::FLOAT)[0][0].to_f
		else
			@status = :Failed
		end
		@sides = []
		if FileTest.exist? 'sides.txt'
			File.read('sides.txt').scan(Regexp.new("is\\s*" + LongRegexen::FLOAT.verbatim + "$")){@sides.push $~[:float].to_f}
		end
	end
end