mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Save an entire minion cache traversal on each master pub
We were doing an extra and unecessary full traversal of the minion cache. This refactors all returners and the master to reduce this to a single call. More work will be forthcoming to reduce this even further, especially in the context of auth lookups.
This commit is contained in:
parent
e1beac55c5
commit
98f3a482ac
@ -39,6 +39,13 @@ Beacons Changes
|
||||
- The ``loadavg`` beacon now outputs averages as integers instead of strings.
|
||||
(Via :issuse:`31124`.)
|
||||
|
||||
Returner Changes
|
||||
================
|
||||
|
||||
- Any returner which implements a `save_load` function is now required to
|
||||
accept a `minions` keyword argument. All returners which ship with Salt
|
||||
have been modified to do so.
|
||||
|
||||
External Module Packaging
|
||||
=========================
|
||||
|
||||
|
@ -2266,7 +2266,7 @@ class ClearFuncs(object):
|
||||
if self.opts['ext_job_cache']:
|
||||
try:
|
||||
fstr = '{0}.save_load'.format(self.opts['ext_job_cache'])
|
||||
self.mminion.returners[fstr](clear_load['jid'], clear_load)
|
||||
self.mminion.returners[fstr](clear_load['jid'], clear_load, minions=minions)
|
||||
except KeyError:
|
||||
log.critical(
|
||||
'The specified returner used for the external job cache '
|
||||
|
@ -236,7 +236,7 @@ def event_return(events):
|
||||
raise
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid id
|
||||
'''
|
||||
|
@ -184,7 +184,7 @@ def returner(load):
|
||||
return False
|
||||
|
||||
|
||||
def save_load(jid, clear_load):
|
||||
def save_load(jid, clear_load, minion=None):
|
||||
'''
|
||||
Save the load to the specified jid
|
||||
'''
|
||||
|
@ -65,7 +65,7 @@ def returner(ret):
|
||||
'which responded with {1}'.format(signal[0], signal[1]))
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid
|
||||
'''
|
||||
|
@ -164,7 +164,7 @@ def prep_jid(nocache=False, passed_jid=None): # pylint: disable=unused-argument
|
||||
return passed_jid if passed_jid is not None else salt.utils.jid.gen_jid()
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid id
|
||||
|
||||
|
@ -133,7 +133,7 @@ def returner(ret):
|
||||
client.set(dest, json.dumps(ret[field]), ttl=ttl)
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid
|
||||
'''
|
||||
|
@ -189,7 +189,7 @@ def returner(ret):
|
||||
log.critical('Failed to store return with InfluxDB returner: {0}'.format(ex))
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid
|
||||
'''
|
||||
|
@ -154,7 +154,7 @@ def returner(ret):
|
||||
_append_list(serv, 'jids', jid)
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid
|
||||
'''
|
||||
|
@ -199,7 +199,7 @@ def returner(ret):
|
||||
mdb.saltReturns.insert(sdata.copy())
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load for a given job id
|
||||
'''
|
||||
|
@ -61,7 +61,7 @@ def returner(load):
|
||||
_mminion().returners['{0}.returner'.format(returner_)](load)
|
||||
|
||||
|
||||
def save_load(jid, clear_load):
|
||||
def save_load(jid, clear_load, minions=None):
|
||||
'''
|
||||
Write load to all returners in multi_returner
|
||||
'''
|
||||
|
@ -287,7 +287,7 @@ def event_return(events):
|
||||
cur.execute(sql, (tag, json.dumps(data), __opts__['id']))
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid id
|
||||
'''
|
||||
|
@ -214,7 +214,7 @@ def returner(ret):
|
||||
_close_conn(conn)
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid id
|
||||
'''
|
||||
|
@ -272,7 +272,7 @@ def event_return(events):
|
||||
__opts__['id'], time.strftime('%Y-%m-%d %H:%M:%S %z', time.localtime())))
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid id
|
||||
'''
|
||||
|
@ -189,7 +189,7 @@ def returner(ret):
|
||||
_close_conn(conn)
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid id
|
||||
'''
|
||||
|
@ -264,7 +264,7 @@ def event_return(events):
|
||||
_close_conn(conn)
|
||||
|
||||
|
||||
def save_load(jid, clear_load):
|
||||
def save_load(jid, clear_load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid id
|
||||
'''
|
||||
|
@ -128,7 +128,7 @@ def returner(ret):
|
||||
pipeline.execute()
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid
|
||||
'''
|
||||
|
@ -178,7 +178,7 @@ def returner(ret):
|
||||
_close_conn(conn)
|
||||
|
||||
|
||||
def save_load(jid, load):
|
||||
def save_load(jid, load, minions=None):
|
||||
'''
|
||||
Save the load to the specified jid
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user