Exscript.util.start module

Quickstart methods for the Exscript queue.

Exscript.util.start.quickrun(hosts, func, **kwargs)[source]

A wrapper around run() that creates the account by asking the user for entering his login information.

Parameters:
  • hosts (Host|list[Host]) – A list of Host objects.
  • func (function) – The callback function.
  • kwargs (dict) – Passed to the Exscript.Queue constructor.
Exscript.util.start.quickstart(hosts, func, only_authenticate=False, **kwargs)[source]

Like quickrun(), but automatically logs into the host before passing the connection to the callback function.

Parameters:
  • hosts (Host|list[Host]) – A list of Host objects.
  • func (function) – The callback function.
  • only_authenticate (bool) – don’t authorize, just authenticate?
  • kwargs (dict) – Passed to the Exscript.Queue constructor.
Exscript.util.start.run(users, hosts, func, **kwargs)[source]

Convenience function that creates an Exscript.Queue instance, adds the given accounts, and calls Queue.run() with the given hosts and function as an argument.

If you also want to pass arguments to the given function, you may use util.decorator.bind() like this:

def my_callback(job, host, conn, my_arg, **kwargs):
    print(my_arg, kwargs.get('foo'))

run(account,
    host,
    bind(my_callback, 'hello', foo = 'world'),
    max_threads = 10)
Parameters:
  • users (Account|list[Account]) – The account(s) to use for logging in.
  • hosts (Host|list[Host]) – A list of Host objects.
  • func (function) – The callback function.
  • kwargs (dict) – Passed to the Exscript.Queue constructor.
Exscript.util.start.start(users, hosts, func, only_authenticate=False, **kwargs)[source]

Like run(), but automatically logs into the host before passing the host to the callback function.

Parameters:
  • users (Account|list[Account]) – The account(s) to use for logging in.
  • hosts (Host|list[Host]) – A list of Host objects.
  • func (function) – The callback function.
  • only_authenticate (bool) – don’t authorize, just authenticate?
  • kwargs (dict) – Passed to the Exscript.Queue constructor.