Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/backend.py
Show First 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | def search_tasks(self, task_id=None, task_type=None, status=None, | ||||
args.append(policy) | args.append(policy) | ||||
if before: | if before: | ||||
where.append('next_run <= %s') | where.append('next_run <= %s') | ||||
args.append(before) | args.append(before) | ||||
if after: | if after: | ||||
where.append('next_run >= %s') | where.append('next_run >= %s') | ||||
args.append(after) | args.append(after) | ||||
query = 'select * from task where ' + ' and '.join(where) | query = 'select * from task' | ||||
if where: | |||||
query += ' where ' + ' and '.join(where) | |||||
if limit: | if limit: | ||||
query += ' limit %s :: bigint' | query += ' limit %s :: bigint' | ||||
args.append(limit) | args.append(limit) | ||||
cur.execute(query, args) | cur.execute(query, args) | ||||
return cur.fetchall() | return cur.fetchall() | ||||
@db_transaction() | @db_transaction() | ||||
def get_tasks(self, task_ids, db=None, cur=None): | def get_tasks(self, task_ids, db=None, cur=None): | ||||
▲ Show 20 Lines • Show All 244 Lines • Show Last 20 Lines |