A => pyproject.toml +2 -0
@@ 0,0 1,2 @@
+[tool.pytype]
+inputs = ['rework']
No newline at end of file
M rework/helper.py +1 -1
@@ 322,7 322,7 @@ class PGLogWriter:
for part in message.splitlines():
self.handler.emit(
logging.LogRecord(
- self.stream, self.level, '', -1, part, (), ()
+ self.stream, self.level, '', -1, part, (), None
)
)
M rework/task.py +2 -5
@@ 89,9 89,6 @@ class Task:
with engine.begin() as cn:
sql = "select operation from rework.task where id = %(tid)s"
operation = cn.execute(sql, tid=tid).scalar()
- if operation is None:
- return None
-
return cls(engine, tid, operation)
def save_output(self, data, raw=False):
@@ 145,8 142,8 @@ class Task:
yield
finally:
if std:
- sys.stdout.flush(force=True)
- sys.stderr.flush(force=True)
+ sys.stdout.flush()
+ sys.stderr.flush()
if pghdlr in root.handlers:
root.handlers.remove(pghdlr)
pghdlr.flush()
M tests/test_monitor.py +1 -1
@@ 73,7 73,7 @@ def test_basic_task_operations(engine, c
assert (t2.tid, t2.operation) == (t.tid, t.operation)
t3 = Task.byid(engine, 42000)
- assert t3 is None
+ assert (t3.tid, t3.operation) == (42000, None)
with pytest.raises(Exception) as err:
api.schedule(engine, 'no_such_task')