dev_forum
jingquan huang 6 years ago
parent 3c5f0385a3
commit 409c51bd91

@ -105,9 +105,11 @@ class MyshixunsController < ApplicationController
resubmit = jsonTestDetails['resubmit']
outPut = tran_base64_decode64(jsonTestDetails['outPut'])
# 资源消耗
uid_logger("##########!!!!!!#{jsonTestDetails['resUsage']}")
max_mem = tran_base64_decode64(jsonTestDetails['resUsage']) if jsonTestDetails['resUsage'].present?
uid_logger("##########!!!!!!#{max_mem}")
if jsonTestDetails['resUsage'].present?
max_mem = tran_base64_decode64(jsonTestDetails['resUsage']).to_f
max_mem = format("%.3f", max_mem/1024/1024).to_f
end
jenkins_testsets = jsonTestDetails['msg']
compile_success = jsonTestDetails['compileSuccess']
# message = Base64.decode64(params[:msg]) unless params[:msg].blank?
@ -132,10 +134,11 @@ class MyshixunsController < ApplicationController
# is_public = test_sets.where(:position => j_test_set['caseId']).first.try(:is_public)
logger.info "actual_output:################################################# #{actual_output}"
ts_time = format("%.3f", j_test_set['testSetTime'].to_i).to_f
ts_time = format("%.2f", j_test_set['testSetTime'].to_f/1000000000).to_f
Output.create!(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => max_query_index,
:compile_success => compile_success.to_i, :sec_key => sec_key, :ts_time => j_test_set['testSetTime'])
:compile_success => compile_success.to_i, :sec_key => sec_key, :ts_time => ts_time)
# 如果设置了按测试集给分,则需要统计测试集的分值
if challenge.test_set_score && j_test_set['passed'].to_i == 1
test_set_score += challenge.test_sets.where(:position => j_test_set['caseId']).pluck(:score).first
@ -203,7 +206,7 @@ class MyshixunsController < ApplicationController
test_cases_time = format("%.3f", (Time.now.to_f - t1.to_f)).to_f
if record.present?
consume_time = format("%.3f", (Time.now - record.created_at)).to_f
uid_logger("11122233334444#{max_mem}, #{sec_key}")
record.update_attributes!(:consume_time => consume_time, :git_pull => timeCost['pull'] , :create_pod => timeCost['createPod'],
:pod_execute => timeCost['execute'], :test_cases => test_cases_time, :max_mem => max_mem,
:brige => timeCost['evaluateAllTime'], :return_back => return_back_time)

Loading…
Cancel
Save