Commit 5b94ba5b authored by ale's avatar ale

fixes for sqlalchemy 0.5beta

parent c459aaef
......@@ -116,8 +116,8 @@ class Job(object):
retries = 10
while retries > 0:
next = cls.query.filter(
(cls.c.group_name == node.group_name)
& (cls.c.status == cls.STATUS_NEW)).first()
(cls.group_name == node.group_name)
& (cls.status == cls.STATUS_NEW)).first()
if next is None:
return None
lock = Lock(next.id)
......@@ -139,9 +139,9 @@ class Job(object):
def detect_dropped_jobs(cls):
"""Detect jobs sent to dead nodes and reset them."""
session = Session()
dropped = cls.query.filter((cls.c.status == cls.STATUS_ASSIGNED)
& (cls.c.assigned_to_id == Node.c.id)
& (Node.c.enabled == False))
dropped = cls.query.filter((cls.status == cls.STATUS_ASSIGNED)
& (cls.assigned_to_id == Node.id)
& (Node.enabled == False))
for j in dropped:
logging.warning("Clearing stale job %s assigned to dead node %s/%s"
% (j.id, j.assigned_to.name, j.assigned_to.group_name))
......@@ -154,7 +154,7 @@ class Job(object):
Session.mapper(Worklog, worklog_table)
Session.mapper(Job, jobs_table, properties=dict(
assigned_to=relation(Node, backref=backref('jobs')),
worklogs=relation(Worklog, order_by=asc(Worklog.c.id)),
worklogs=relation(Worklog, order_by=asc(Worklog.id)),
))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment