diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-03-10 17:45:30 +0100 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-03-10 17:45:30 +0100 |
commit | 00e2f9f227c28242ce97cfc7f86a953b84062d3f (patch) | |
tree | 271ab699e780d8e2f2140647a72eef2e0203ee3b | |
parent | 51f2a52da9804e503d828781d3e1af538623f987 (diff) |
enable to ignore zombies
-rw-r--r-- | cfg.rb | 5 | ||||
-rwxr-xr-x | lampion.rb | 8 |
2 files changed, 8 insertions, 5 deletions
@@ -2,6 +2,11 @@ SMT_SEMPARSE = 'python /workspace/grounded/smt-semparse-cp/decode_sentence.py /workspace/grounded/smt-semparse-cp/working/full_dataset' # this is the 'fixed' version of eval.pl EVAL_PL = '/workspace/grounded/wasp-1.0/data/geo-funql/eval/eval.pl' +# set to true to ignore zombie eval.pl procs +ACCEPT_ZOMBIES = true +TIMEOUT=60 # cdec binary CDEC_BIN = '/toolbox/cdec-dtrain/decoder/cdec' +# memcached has to be running +$cache = Memcached.new('localhost:11211') @@ -6,9 +6,6 @@ require 'tempfile' require 'memcached' require_relative './hopefear' -# memcached has to be running -$cache = Memcached.new('localhost:11211') - def exec natural_language_string, reference_output, no_output=false mrl = output = feedback = nil @@ -20,9 +17,10 @@ def exec natural_language_string, reference_output, no_output=false output = $cache.get key_prefix+'__OUTPUT' feedback = $cache.get key_prefix+'__FEEDBACK' rescue Memcached::NotFound + mrl_cmd = "#{SMT_SEMPARSE} \"#{natural_language_string}\"" # beware: EVAL_PL sometimes hangs and can't be killed! - mrl = spawn_with_timeout("#{SMT_SEMPARSE} \"#{natural_language_string}\" ", 60).strip - output = spawn_with_timeout("echo \"execute_funql_query(#{mrl}, X).\" | swipl -s #{EVAL_PL} 2>&1 | grep \"X =\"", 60).strip.split('X = ')[1] + mrl = spawn_with_timeout(mrl_cmd, TIMEOUT, ACCEPT_ZOMBIES).strip + output = spawn_with_timeout("echo \"execute_funql_query(#{mrl}, X).\" | swipl -s #{EVAL_PL} 2>&1 | grep \"X =\"", TIMEOUT).strip.split('X = ')[1] feedback = output==reference_output begin $cache.set key_prefix+'__MRL', mrl |