|
|
|
@ -90,7 +90,7 @@ class MyshixunsController < ApplicationController
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
begin
|
|
|
|
|
t1 = Time.now
|
|
|
|
|
Rails.logger.info("@@@222222#{params[:jsonTestDetails]}")
|
|
|
|
|
uid_logger_dubug("@@@222222#{params[:jsonTestDetails]}")
|
|
|
|
|
jsonTestDetails = JSON.parse(params[:jsonTestDetails])
|
|
|
|
|
timeCost = JSON.parse(params[:timeCost])
|
|
|
|
|
brige_end_time = Time.parse(timeCost['evaluateEnd']) if timeCost['evaluateEnd'].present?
|
|
|
|
@ -99,7 +99,7 @@ class MyshixunsController < ApplicationController
|
|
|
|
|
game_id = jsonTestDetails['buildID']
|
|
|
|
|
sec_key = jsonTestDetails['sec_key']
|
|
|
|
|
|
|
|
|
|
logger.info("training_task_status start#1**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
|
|
|
|
|
uid_logger_dubug("training_task_status start-#{game_id}-1#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
|
|
|
|
|
resubmit = jsonTestDetails['resubmit']
|
|
|
|
|
outPut = tran_base64_decode64(jsonTestDetails['outPut'])
|
|
|
|
|
|
|
|
|
@ -116,17 +116,14 @@ class MyshixunsController < ApplicationController
|
|
|
|
|
pics = params[:tpiRepoPath]
|
|
|
|
|
game.update_column(:picture_path, pics)
|
|
|
|
|
end
|
|
|
|
|
logger.info("training_task_status start#2**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
|
|
|
|
|
max_query_index = game.outputs ? (game.outputs.first.try(:query_index).to_i + 1) : 1
|
|
|
|
|
test_set_score = 0
|
|
|
|
|
unless jenkins_testsets.blank?
|
|
|
|
|
jenkins_testsets.each_with_index do |j_test_set, i|
|
|
|
|
|
logger.info("j_test_set: ############## #{j_test_set}")
|
|
|
|
|
actual_output = tran_base64_decode64(j_test_set['output'])
|
|
|
|
|
#ts_time += j_test_set['testSetTime'].to_i
|
|
|
|
|
|
|
|
|
|
# is_public = test_sets.where(:position => j_test_set['caseId']).first.try(:is_public)
|
|
|
|
|
logger.info "actual_output:################################################# #{actual_output}"
|
|
|
|
|
ts_time = format("%.2f", j_test_set['testSetTime'].to_f/1000000000).to_f if j_test_set['testSetTime']
|
|
|
|
|
ts_mem = format("%.2f", j_test_set['testSetMem'].to_f/1024/1024).to_f if j_test_set['testSetMem']
|
|
|
|
|
|
|
|
|
@ -139,15 +136,12 @@ class MyshixunsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
uid_logger("#############status: #{status}")
|
|
|
|
|
record = EvaluateRecord.where(:identifier => sec_key).first
|
|
|
|
|
logger.info("training_task_status start#3**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
|
|
|
|
|
answer_deduction_percentage = (100 - game.answer_deduction) / 100.to_f # 查看答案后剩余分数的百分比.
|
|
|
|
|
# answer_deduction是查看答案的扣分比例
|
|
|
|
|
# status:0表示评测成功
|
|
|
|
|
if status == "0"
|
|
|
|
|
if resubmit.present?
|
|
|
|
|
uid_logger("#############resubmitdaiao: #{resubmit}")
|
|
|
|
|
game.update_attributes!(:retry_status => 2, :resubmit_identifier => resubmit)
|
|
|
|
|
challenge.path.split(";").each do |path|
|
|
|
|
|
game_passed_code(path.try(:strip), myshixun, game_id)
|
|
|
|
@ -205,7 +199,6 @@ class MyshixunsController < ApplicationController
|
|
|
|
|
:pod_execute => timeCost['execute'], :test_cases => test_cases_time,
|
|
|
|
|
:brige => timeCost['evaluateAllTime'], :return_back => return_back_time)
|
|
|
|
|
end
|
|
|
|
|
uid_logger("training_task_status start#4**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
|
|
|
|
|
sucess_status
|
|
|
|
|
# rescue Exception => e
|
|
|
|
|
# tip_exception(e.message)
|
|
|
|
@ -265,7 +258,7 @@ class MyshixunsController < ApplicationController
|
|
|
|
|
@sec_key = generate_identifier(EvaluateRecord, 12)
|
|
|
|
|
record = EvaluateRecord.create!(:user_id => current_user.id, :shixun_id => @myshixun.shixun_id, :game_id => game_id,
|
|
|
|
|
:identifier => @sec_key, :exec_time => exec_time)
|
|
|
|
|
uid_logger("-- game build: file update #{@sec_key}, record id is #{record.id}, time is **** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
|
|
|
|
|
uid_logger_dubug("-- game build: file update #{@sec_key}, record id is #{record.id}, time is **** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
|
|
|
|
|
end
|
|
|
|
|
# 隐藏代码文件 和 VNC的都不需要走版本库
|
|
|
|
|
unless @hide_code || @myshixun.shixun&.vnc_evaluate
|
|
|
|
@ -276,8 +269,8 @@ class MyshixunsController < ApplicationController
|
|
|
|
|
else
|
|
|
|
|
params[:content]
|
|
|
|
|
end
|
|
|
|
|
Rails.logger.info("###11222333####{content}")
|
|
|
|
|
Rails.logger.info("###222333####{last_content}")
|
|
|
|
|
uid_logger_dubug("###11222333####{content}")
|
|
|
|
|
uid_logger_dubug("###222333####{last_content}")
|
|
|
|
|
|
|
|
|
|
if content != last_content
|
|
|
|
|
@content_modified = 1
|
|
|
|
@ -285,8 +278,8 @@ class MyshixunsController < ApplicationController
|
|
|
|
|
author_name = current_user.real_name
|
|
|
|
|
author_email = current_user.git_mail
|
|
|
|
|
message = params[:evaluate] == 0 ? "System automatically submitted" : "User submitted"
|
|
|
|
|
uid_logger("112233#{author_name}")
|
|
|
|
|
uid_logger("112233#{author_email}")
|
|
|
|
|
uid_logger_dubug("112233#{author_name}")
|
|
|
|
|
uid_logger_dubug("112233#{author_email}")
|
|
|
|
|
@content = GitService.update_file(repo_path: @repo_path,
|
|
|
|
|
file_path: path,
|
|
|
|
|
message: message,
|
|
|
|
|