mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Add get_jids_filter method to pgjsonb
This commit is contained in:
parent
51af49495b
commit
553aaad105
@ -382,6 +382,30 @@ def get_jids():
|
||||
return ret
|
||||
|
||||
|
||||
def get_jids_filter(count, filter_find_job=True):
|
||||
'''
|
||||
Return a list of all job ids
|
||||
:param int count: show not more than the count of most recent jobs
|
||||
:param bool filter_find_jobs: filter out 'saltutil.find_job' jobs
|
||||
'''
|
||||
with _get_serv(ret=None, commit=True) as cur:
|
||||
|
||||
sql = '''SELECT * FROM (
|
||||
SELECT DISTINCT jid ,load FROM jids
|
||||
{0}
|
||||
ORDER BY jid DESC limit {1}
|
||||
) tmp
|
||||
ORDER BY jid;'''
|
||||
where = '''WHERE 'load' NOT LIKE '%"fun": "saltutil.find_job"%' '''
|
||||
|
||||
cur.execute(sql.format(where if filter_find_job else '', count))
|
||||
data = cur.fetchall()
|
||||
ret = []
|
||||
for jid, load in data:
|
||||
ret.append(salt.utils.jid.format_jid_instance_ext(jid,load))
|
||||
return ret
|
||||
|
||||
|
||||
def get_minions():
|
||||
'''
|
||||
Return a list of minions
|
||||
|
Loading…
Reference in New Issue
Block a user