diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-09 20:25:58 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-09 20:25:58 +0100 |
| commit | 8a18e44d9bccbe1f85d940af886edc04b9936392 (patch) | |
| tree | e4fd469458675fb8b9b7bf5bc2c779ab4157dcad | |
| parent | 5e51ef8d10c9665b02aec49c152512c60fe8671e (diff) | |
| download | compiler-8a18e44d9bccbe1f85d940af886edc04b9936392.tar.gz compiler-8a18e44d9bccbe1f85d940af886edc04b9936392.zip | |
catch deadlocks
| -rw-r--r-- | api.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -72,11 +72,13 @@ class Compiler(joblib.worker.Worker): return logging.debug("%s: compiling '%s' from '%s'", jobid, object_id, table) - tasks = [] for query in self._queries[table]: - tasks.append(asyncio.ensure_future( - self._con.execute(query, object_id))) - await asyncio.gather(*tasks) + try: + await self._con.execute(query, object_id) + except asyncpg.exceptions.DeadlockDetectedError: + logging.error("%s: deadlocked!", jobid) + raise joblib.worker.JobFailed("deadlock", + True) # critical async def startup(): |
