MCPcopy
hub / github.com/saltstack/salt / insert_runner

Function insert_runner

salt/runners/queue.py:238–273  ·  view source on GitHub ↗

Insert a reference to a runner into the queue so that it can be run later. fun The runner function that is going to be run args list or comma-separated string of args to send to fun kwargs dictionary of keyword arguments to send to fun queue q

(fun, args=None, kwargs=None, queue=None, backend=None)

Source from the content-addressed store, hash-verified

236
237
238def insert_runner(fun, args=None, kwargs=None, queue=None, backend=None):
239 """
240 Insert a reference to a runner into the queue so that it can be run later.
241
242 fun
243 The runner function that is going to be run
244
245 args
246 list or comma-separated string of args to send to fun
247
248 kwargs
249 dictionary of keyword arguments to send to fun
250
251 queue
252 queue to insert the runner reference into
253
254 backend
255 backend that to use for the queue
256
257 CLI Example:
258
259 .. code-block:: bash
260
261 salt-run queue.insert_runner test.stdout_print
262 salt-run queue.insert_runner event.send test_insert_runner kwargs='{"data": {"foo": "bar"}}'
263
264 """
265 if args is None:
266 args = []
267 elif isinstance(args, str):
268 args = args.split(",")
269 if kwargs is None:
270 kwargs = {}
271 queue_kwargs = __get_queue_opts(queue=queue, backend=backend)
272 data = {"fun": fun, "args": args, "kwargs": kwargs}
273 return insert(items=data, **queue_kwargs)
274
275
276def process_runner(quantity=1, queue=None, backend=None):

Callers

nothing calls this directly

Calls 2

__get_queue_optsFunction · 0.85
insertFunction · 0.70

Tested by

no test coverage detected