class CodeRunner::Cronos

Public Instance Methods

cronos() click to toggle source
# File lib/cronoscrmod/cronos.rb, line 199
def cronos
        set_cronos_path
        rcp.engine_handler.cronos
end
generate_input_file() click to toggle source

This is a hook which gets called just before submitting a simulation. It sets up the folder and generates any necessary input files.

# File lib/cronoscrmod/cronos.rb, line 150
def generate_input_file
        #FileUtils.touch("#@run_name.mat")
        #cronos.new_file
        #eputs "Make sure you save the file as #@run_name.mat... overwrite the existing empty place holder. When you have saved the file press enter."
        if @duplicate_id
                old = @runner.run_list[@duplicate_id]
                system "cp #{old.directory}/#{old.run_name}.mat #@directory/#@run_name.mat"
                load
        elsif @restart_id
                old = @runner.run_list[@restart_id]
                system "cp #{old.directory}/#{old.run_name}_resultat.mat #@directory/#@run_name.mat"
                load
        else
                sz = Terminal.terminal_size[1]
                eputs((str = "When you have created the file press enter. Don't save it (CodeRunner will automatically save it in the right place. You can edit parameters later as well. CodeRunner will not submit the file... submit it manually using a batch or interactive run."; ["-"*sz, str, "-"*sz]))
                cronos.puts("zuicreate")
                STDIN.gets
        end
        cronos.puts("param.gene.origine = '#@directory/#@run_name.mat'")
        cronos.puts("param.gene.file = '#@directory/#{@run_name}_resultat.mat'")
        cronos.puts("param.gene.rapsauve = '#@directory/#{@run_name}_resultat'")
        cronos.puts("param.edit.currentfile= '#@directory/#@run_name.mat'")
        cronos.puts("param.from.creation.com = '#@comment'")
        cronos.puts("zuisavedata('force')")
        #cronos.eval("zuicreate")
        refresh_gui
        
end
get_status() click to toggle source
# File lib/cronoscrmod/cronos.rb, line 228
def get_status
        Dir.chdir(@directory) do
                if FileTest.exist? results_file_name
                        @status = :Complete
                        @percent_complete = 100.0
                elsif temps = Dir.entries.grep(/resultat_\d+/) and temps.size > 1
                        @status = :Incomplete
                        @completed_timesteps = temps.map{|f| f.scan(/resultat_(\d+)/)[0][0].to_i}.max
                else 
                        @status = :Unknown
                        @percent_complete = 0
                end
        end
end
load() click to toggle source
# File lib/cronoscrmod/cronos.rb, line 189
def load
        cronos.puts("zuiload('#@directory/#@run_name.mat')")
        refresh_gui
end
load_result() click to toggle source
# File lib/cronoscrmod/cronos.rb, line 194
def load_result
        cronos.puts("zuiload('#@directory/#{@run_name}_resultat.mat')")
        refresh_gui
end
parameter_string() click to toggle source

Parameters which follow the Trinity executable, in this case just the input file.

# File lib/cronoscrmod/cronos.rb, line 207
def parameter_string
end
parameter_transition() click to toggle source
# File lib/cronoscrmod/cronos.rb, line 210
def parameter_transition
end
print_out_line() click to toggle source

A hook which gets called when printing the standard run information to the screen using the status command.

process_directory_code_specific() click to toggle source

This method, as its name suggests, is called whenever CodeRunner is asked to analyse a run directory. This happens if the run status is not :Complete, or if the user has specified recalc_all(-A on the command line) or reprocess_all (-a on the command line).

# File lib/cronoscrmod/cronos.rb, line 218
def process_directory_code_specific
        get_status
        #p ['fusionQ is ', fusionQ]
        #@percent_complete = completed_timesteps.to_f / ntstep.to_f * 100.0
end
refresh_gui() click to toggle source
# File lib/cronoscrmod/cronos.rb, line 179
def refresh_gui
        cronos.puts(["[hfig,h] = zuiformhandle('direct');",
                                                   "if ishandle(hfig)
                                                         set(h.text_loadfile, 'string', param.gene.origine)
                                                         set(h.text_nom_machine, 'string', param.from.machine)
                                                         set(h.text_numchoc, 'string', sprintf('%d', param.from.shot.num))

                                                        end"]) 
end
results_file_name() click to toggle source
# File lib/cronoscrmod/cronos.rb, line 224
def results_file_name
        "#{@run_name}_resultat.mat"
end
run_command() click to toggle source
# File lib/cronoscrmod/cronos.rb, line 33
def run_command
        "echo 'manual run'"
end
set_cronos_path() click to toggle source
# File lib/cronoscrmod/cronos.rb, line 92
def set_cronos_path
        rcp.engine_handler.start_cronos(@runner.executable.sub(/cronos$/, ""))
end