From 11872a9610b03f80442e0ee3e6d5041dc72c7812 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 26 Aug 2015 19:21:45 +0200 Subject: Use /destroy_all to abort and destroy pengines Poorly documented, but works better than abort & destroy. --- prolog/engine.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'prolog') diff --git a/prolog/engine.py b/prolog/engine.py index ef54833..11185b0 100644 --- a/prolog/engine.py +++ b/prolog/engine.py @@ -27,16 +27,6 @@ def create(code='', query='', timeout=10): reply = reply['answer']['data'] return reply, output -def abort(engine): - params = urllib.parse.urlencode({ - 'id': engine, - 'format': 'json-html'}) - try: - # We don't care about the answer here, so don't wait for it. - request('GET', '/pengine/abort?' + params, timeout=0.01) - except: - pass - def ask(engine, query, timeout=10): return send(engine, 'ask(({}),[])'.format(query), timeout=timeout) @@ -47,9 +37,9 @@ def stop(engine, timeout=10): return send(engine, 'stop', timeout=timeout) def destroy(engine): + params = urllib.parse.urlencode({'ids': engine}) try: - # We don't care about the answer here, so don't wait for it. - send(engine, 'destroy([force(true)])', timeout=0.01) + request('GET', '/pengine/destroy_all?' + params, timeout=0.01) except: pass @@ -196,7 +186,6 @@ def run(code, query, timeout): messages.append(error) except socket.timeout as ex: result.append('timed out') - abort(engine) finally: if engine: destroy(engine) -- cgit v1.2.1