diff options
author | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-26 19:21:45 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-26 19:21:45 +0200 |
commit | 11872a9610b03f80442e0ee3e6d5041dc72c7812 (patch) | |
tree | f87d1582356784156b20a0bddd22c0c907fdfe96 | |
parent | 5821c5a0a3f59e1de66465ebf3b1158eec47ca4e (diff) |
Use /destroy_all to abort and destroy pengines
Poorly documented, but works better than abort & destroy.
-rw-r--r-- | prolog/engine.py | 15 |
1 files changed, 2 insertions, 13 deletions
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) |