aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2016-05-25 19:37:28 +0200
committerHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2016-05-25 19:44:38 +0200
commit428516e88d393145874343af508b831d1aa9c2f2 (patch)
tree4faf996add45f372540eae8d62723e69e8cd57b7 /lib
parent298359ea1705e18201ab171203d0dfa21ac43557 (diff)
downloadvipeval-428516e88d393145874343af508b831d1aa9c2f2.tar.gz
vipeval-428516e88d393145874343af508b831d1aa9c2f2.zip
Adjust resource fetching to redirected ECS URL.
Evaluationserver (ev) is now able to process resource URLs contained in an EvaluationJob which differ from the configured ECS-URL in appcfg.yml, i.e. the URL its a redirected one. Nonetheless ev communicates to the configured ECS directly further on.
Diffstat (limited to 'lib')
-rw-r--r--lib/job_event.rb10
-rw-r--r--lib/main_loop.rb2
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/job_event.rb b/lib/job_event.rb
index 85ebdbf..f07491d 100644
--- a/lib/job_event.rb
+++ b/lib/job_event.rb
@@ -34,7 +34,9 @@ class JobEvent
# Fetch an exercise from ECS.
def fetch_exercise(job)
# URI#path returns the path with leading "/"
- path= URI(job["EvaluationJob"]["resources"]["exercise"]).path[1..-1]
+ /#{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}"
exercise= @ecs.connection[path].delete
exercise = unpack(exercise.body) if packed?(exercise.body)
Rails.logger.info "***** JobEvent#fetch_exercise: #{path} = #{exercise}"
@@ -45,7 +47,8 @@ class JobEvent
# Fetch an evaluation from ECS.
def fetch_evaluation(job)
# URI#path returns the path with leading "/"
- path= URI(job["EvaluationJob"]["resources"]["evaluation"]).path[1..-1]
+ /#{APP_CONFIG["resources"]["evaluations"]["name"]}.*$/ =~ URI(job["EvaluationJob"]["resources"]["evaluation"]).path[1..-1]
+ path = $~.to_s
evaluation= @ecs.connection[path].delete
evaluation = unpack(evaluation.body) if packed?(evaluation.body)
Rails.logger.info "***** JobEvent#fetch_evaluation: #{path} = #{evaluation}"
@@ -56,7 +59,8 @@ class JobEvent
# Fetch a solution from ECS.
def fetch_solution(job)
# URI#path returns the path with leading "/"
- path= URI(job["EvaluationJob"]["resources"]["solution"]).path[1..-1]
+ /#{APP_CONFIG["resources"]["solutions"]["name"]}.*$/ =~ URI(job["EvaluationJob"]["resources"]["solution"]).path[1..-1]
+ path = $~.to_s
solution= @ecs.connection[path].delete
solution = unpack(solution.body) if packed?(solution.body)
Rails.logger.info "***** JobEvent#fetch_solution: #{path} = #{solution}"
diff --git a/lib/main_loop.rb b/lib/main_loop.rb
index b85d232..571e058 100644
--- a/lib/main_loop.rb
+++ b/lib/main_loop.rb
@@ -56,7 +56,7 @@ class MainLoop
end
def read_event
- @ecs.connection["sys/events/fifo"].post ""
+ @ecs.connection[APP_CONFIG["resources"]["sys_events"]["name"]+"/fifo"].post ""
end