Skip to content

Commit

Permalink
add XML MAT as valid downloadable Report types
Browse files Browse the repository at this point in the history
add test for creating an report_xml.xml and checking XML report
  • Loading branch information
brianlball committed Sep 29, 2023
1 parent 1c058ce commit 94038a8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
6 changes: 3 additions & 3 deletions server/app/jobs/dj_jobs/run_simulate_data_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ def perform
# Post the reports back to the server
uploads_successful = []
if @data_point.analysis.download_reports
@sim_logger.info 'downloading reports/*.{html,json,csv}'
Dir["#{simulation_dir}/reports/*.{html,json,csv}"].each { |rep| uploads_successful << upload_file(rep, 'Report') }
@sim_logger.info 'downloading reports/*.{html,json,csv,xml,mat}'
Dir["#{simulation_dir}/reports/*.{html,json,csv,xml,mat}"].each { |rep| uploads_successful << upload_file(rep, 'Report') }
else
@sim_logger.info "NOT downloading /reports/*.{html,json,csv} since download_reports value is: #{@data_point.analysis.download_reports}"
@sim_logger.info "NOT downloading /reports/*.{html,json,csv,xml,mat} since download_reports value is: #{@data_point.analysis.download_reports}"
end
report_file = "#{run_dir}/objectives.json"
uploads_successful << upload_file(report_file, 'Report', 'objectives', 'application/json') if File.exist?(report_file)
Expand Down
20 changes: 17 additions & 3 deletions server/spec/features/docker_stack_algo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1383,11 +1383,25 @@

compare = single_run_bad.include?(sim)
expect(compare).to be false

a = RestClient.get "http://#{@host}/data_points/#{data_point[:_id]}/download_result_file?filename=calibration_reports_enhanced_20_report_xml_file.xml"
expect(a).not_to be_empty
#expect(a.size).to be >(1000)
#expect(a.size).to be <(2000)
expect(a.headers[:status]).to eq("200 OK")
expect(a.headers[:content_type]).to eq("application/xml")
expect(a.headers[:content_disposition]).to include("calibration_reports_enhanced_20_report_xml_file.xml")
end
rescue RestClient::ExceptionWithResponse => e
puts "rescue: #{e} get_count: #{get_count}"
sleep Random.new.rand(1.0..10.0)
retry if get_count <= get_count_max
if e.http_code == 422
# Handle the 422 Unprocessable Entity error here if .xml file not found
fail("Received a 422 error: calibration_reports_enhanced_20_report_xml_file.xml not avail for download")
else
puts "rescue: #{e} get_count: #{get_count}"
sleep Random.new.rand(1.0..10.0)
get_count = get_count + 1
retry if get_count <= get_count_max
end
end

puts 'check logs for mongo index errors'
Expand Down
Binary file modified server/spec/files/SEB_calibration_NSGA_2013.zip
Binary file not shown.

0 comments on commit 94038a8

Please sign in to comment.