Skip to content

Commit

Permalink
Merge pull request #426 from NREL/datapoint_init
Browse files Browse the repository at this point in the history
run data_point initialize scripts only once: at the end of initialize…
  • Loading branch information
anyaelena committed Nov 6, 2018
2 parents 5c6d853 + 13dcb53 commit dded490
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions server/app/jobs/dj_jobs/run_simulate_data_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ def perform

# Logger for the simulate datapoint
@sim_logger = Logger.new("#{simulation_dir}/#{@data_point.id}.log")

# Run data point initialize script if present
run_script_with_args 'initialize'


# Error if @datapoint doesn't exist
if @data_point.nil?
@sim_logger = 'Could not find datapoint; @datapoint was nil'
Expand Down Expand Up @@ -426,10 +423,7 @@ def initialize_worker
end

# Run the server data_point initialization script with defined arguments, if it exists.
Timeout.timeout(600) do
@sim_logger.debug "Running datapoint initialization file if present."
run_script_with_args "initialize"
end
run_script_with_args "initialize"
end

@sim_logger.info 'Finished worker initialization'
Expand Down Expand Up @@ -532,7 +526,6 @@ def run_script_with_args script_name

@sim_logger.info "Checking for presence of script file at #{script_path}"
if File.file? script_path
# TODO how long do we want to set timeout?
Utility::Oss.run_script(script_path, 4.hours, {'SCRIPT_ANALYSIS_ID' => @data_point.analysis.id, 'SCRIPT_DATA_POINT_ID' => @data_point.id}, args, @sim_logger,log_path)
end
rescue => e
Expand Down

0 comments on commit dded490

Please sign in to comment.