aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2016-04-22 23:03:05 +0200
committerHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2016-04-22 23:06:44 +0200
commit298359ea1705e18201ab171203d0dfa21ac43557 (patch)
tree04e6f4e5b292303e84b0546881021dabc1f78780
parente684a40ba22b13ae2693e912e137219191113b0a (diff)
downloadvipeval-298359ea1705e18201ab171203d0dfa21ac43557.tar.gz
vipeval-298359ea1705e18201ab171203d0dfa21ac43557.zip
Evaluate routing element in exercises.
Dynamic routing by evaluating routing element in exercises, e.g. "routing": { "solutionQueue": "cpp_solutions" }
-rw-r--r--config/appcfg.yml1
-rw-r--r--lib/job_event.rb8
2 files changed, 8 insertions, 1 deletions
diff --git a/config/appcfg.yml b/config/appcfg.yml
index 3085205..c5fd263 100644
--- a/config/appcfg.yml
+++ b/config/appcfg.yml
@@ -11,6 +11,7 @@ defaults: &DEFAULTS
debug_level: debug
resources:
+ servicename: numlab
evaluationjobs:
pretty_print: false
name: numlab/evaluation_jobs
diff --git a/lib/job_event.rb b/lib/job_event.rb
index 086e13e..85ebdbf 100644
--- a/lib/job_event.rb
+++ b/lib/job_event.rb
@@ -90,7 +90,13 @@ class JobEvent
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"]}"
- @ecs.connection[APP_CONFIG["resources"]["solutions"]["name"]].post solution.to_json, {"X-EcsReceiverMemberships" => mid} do |response, request, result|
+ 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}"
+ @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}"
end
end