aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2017-06-15 18:34:35 +0200
committerHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2017-06-15 19:39:15 +0200
commit6626a7daa074b430c334b6a32e4d24de00e60942 (patch)
tree010172618b2eb4fa29a9e36caacdfb9da41a3e72
parentccb9924adb7b1fc76d5707b0d401aa159ecc0ffe (diff)
downloadvipeval-6626a7daa074b430c334b6a32e4d24de00e60942.tar.gz
vipeval-6626a7daa074b430c334b6a32e4d24de00e60942.zip
Logging changes from info to debug.
-rw-r--r--lib/job_event.rb22
-rw-r--r--lib/result_event.rb8
-rw-r--r--lib/vip_pack.rb6
3 files changed, 18 insertions, 18 deletions
diff --git a/lib/job_event.rb b/lib/job_event.rb
index f07491d..f274122 100644
--- a/lib/job_event.rb
+++ b/lib/job_event.rb
@@ -12,13 +12,13 @@ class JobEvent
# Process a *sys/events* job event.
# This is the entrypoint of job event processing.
def process(jobevbody)
- Rails.logger.info "***** JobEvent#process: eventbody=#{jobevbody}"
+ Rails.logger.debug "***** JobEvent#process: eventbody=#{jobevbody}"
case jobevbody[0]['status']
when "created","updated"
jobr= @ecs.connection[jobevbody[0]['ressource']].delete
job_headers= jobr.headers
job=JSON.parse(jobr)
- Rails.logger.info "***** JobEvent#process: EvaluationJob: #{JSON.pretty_generate(job)}"
+ Rails.logger.debug "***** JobEvent#process: EvaluationJob: #{JSON.pretty_generate(job)}"
exercise = JSON.parse fetch_exercise(job)
evaluation = JSON.parse fetch_evaluation(job)
solution = JSON.parse fetch_solution(job)
@@ -36,10 +36,10 @@ class JobEvent
# URI#path returns the path with leading "/"
/#{APP_CONFIG["resources"]["exercises"]["name"]}.*$/ =~ URI(job["EvaluationJob"]["resources"]["exercise"]).path[1..-1]
path = $~.to_s
- Rails.logger.info "***** JobEvent#fetch_exercise: exercise path #{path}"
+ Rails.logger.debug "***** JobEvent#fetch_exercise: exercise path #{path}"
exercise= @ecs.connection[path].delete
exercise = unpack(exercise.body) if packed?(exercise.body)
- Rails.logger.info "***** JobEvent#fetch_exercise: #{path} = #{exercise}"
+ Rails.logger.debug "***** JobEvent#fetch_exercise: #{path} = #{exercise}"
exercise
end
@@ -51,7 +51,7 @@ class JobEvent
path = $~.to_s
evaluation= @ecs.connection[path].delete
evaluation = unpack(evaluation.body) if packed?(evaluation.body)
- Rails.logger.info "***** JobEvent#fetch_evaluation: #{path} = #{evaluation}"
+ Rails.logger.debug "***** JobEvent#fetch_evaluation: #{path} = #{evaluation}"
evaluation
end
@@ -63,7 +63,7 @@ class JobEvent
path = $~.to_s
solution= @ecs.connection[path].delete
solution = unpack(solution.body) if packed?(solution.body)
- Rails.logger.info "***** JobEvent#fetch_solution: #{path} = #{solution}"
+ Rails.logger.debug "***** JobEvent#fetch_solution: #{path} = #{solution}"
solution
end
@@ -83,8 +83,8 @@ class JobEvent
end
end
solution["Solution"]["evaluationService"]= { :jobID => jobid, :jobSender => job_sender }
- Rails.logger.info "***** JobEvent#merge exercise: #{exercise.to_json}"
- Rails.logger.info "***** JobEvent#merge solution: #{solution.to_json}"
+ Rails.logger.debug "***** JobEvent#merge exercise: #{exercise.to_json}"
+ Rails.logger.debug "***** JobEvent#merge solution: #{solution.to_json}"
return exercise, solution
end
@@ -93,15 +93,15 @@ class JobEvent
def compute(exercise, solution, mid)
response= @ecs.connection[APP_CONFIG["resources"]["exercises"]["name"]].post exercise.to_json, {"X-EcsReceiverMemberships" => mid}
solution["Solution"]["exercise"]= response.headers[:location]
- Rails.logger.info "***** JobEvent#compute substitute exersice URL in solution to: #{solution["Solution"]["exercise"]}"
+ Rails.logger.debug "***** JobEvent#compute substitute exersice URL in solution to: #{solution["Solution"]["exercise"]}"
if exercise["Exercise"]["routing"]
routing_path = APP_CONFIG["resources"]["servicename"]+"/"+exercise["Exercise"]["routing"]["solutionQueue"]
else
routing_path = APP_CONFIG["resources"]["solutions"]["name"]
end
- Rails.logger.info "***** JobEvent#compute routing path for solution: #{routing_path}"
+ Rails.logger.debug "***** JobEvent#compute routing path for solution: #{routing_path}"
@ecs.connection[routing_path].post solution.to_json, {"X-EcsReceiverMemberships" => mid} do |response, request, result|
- Rails.logger.info "***** JobEvent#compute solution post response: #{response.headers}"
+ Rails.logger.debug "***** JobEvent#compute solution post response: #{response.headers}"
end
end
diff --git a/lib/result_event.rb b/lib/result_event.rb
index 31c807d..a5978c6 100644
--- a/lib/result_event.rb
+++ b/lib/result_event.rb
@@ -7,14 +7,14 @@ class ResultEvent
path= evbody[0]['ressource']
resultr= @ecs.connection[path].delete
result= JSON::parse(resultr)
- Rails.logger.info "***** ResultEvent#process: #{path} = #{result}"
+ Rails.logger.debug "***** ResultEvent#process: #{path} = #{result}"
# remove exercise referenced through solution embedded in result
path= URI(result["Result"]["Solution"]["exercise"]).path[1..-1]
@ecs.connection[path].delete do |response, request, result, &block|
case response.code
when 404
- Rails.logger.info "***** ResultEvent#process: garbage collect: resource = #{path} not found (404)"
+ Rails.logger.warn "***** ResultEvent#process: garbage collect: resource = #{path} not found (404)"
else
response.return!(request, result, &block)
end
@@ -36,9 +36,9 @@ class ResultEvent
p[:identifier]= result["Result"]["Solution"]["evaluationService"]["jobID"]
receiver= result["Result"]["Solution"]["evaluationService"]["jobSender"]
body= "{\"Points\": #{p.to_json} }"
- Rails.logger.info "***** ResultEvent#process points body = #{body}, points receiver mid = #{receiver}"
+ Rails.logger.debug "***** ResultEvent#process points body = #{body}, points receiver mid = #{receiver}"
response= @ecs.connection[APP_CONFIG["resources"]["points"]["name"]].post body, {"X-EcsReceiverMemberships" => receiver} do |response, request, result|
- Rails.logger.info "***** ResultEvent#process post response headers: #{response.headers}"
+ Rails.logger.debug "***** ResultEvent#process post response headers: #{response.headers}"
end
end
end
diff --git a/lib/vip_pack.rb b/lib/vip_pack.rb
index a4162bf..9a93210 100644
--- a/lib/vip_pack.rb
+++ b/lib/vip_pack.rb
@@ -5,16 +5,16 @@ module VipPack
def unpack(data)
if packed?(data)
- Rails.logger.info "***** JobEvent#unpack: data is zipped."
+ Rails.logger.debug "***** JobEvent#unpack: data is zipped."
data = data.sub(/^ZIP:/,'')
data = Base64.decode64(data)
data = Zip::InputStream.open(StringIO.new(data)) do |io|
io.get_next_entry
io.read
end
- Rails.logger.info "***** JobEvent#unpack: unzipped data = #{data}"
+ Rails.logger.debug "***** JobEvent#unpack: unzipped data = #{data}"
else
- Rails.logger.info "***** JobEvent#unpack: data is not packed."
+ Rails.logger.debug "***** JobEvent#unpack: data is not packed."
end
data
end