pyats.kleenex package

Subpackages

Submodules

class pyats.kleenex.engine.KleenexEngine(reporter, debug_=False, **clean_mappings)

Bases: object

KleenexEngine effectively allows users to clean multiple devices at the same time, using various clean implementations for each device, without having to worry about about forks, processes & etc.

Internally this class is just about the same as async_.pcall, however, as clean definitions are designed to be mostly reused, there are some overlaps in code…

clean(devices, timeout=None, task=None, lcl_logger=<Logger pyats.kleenex.engine (WARNING)>)

Clean one or more sets of devices. Devices within each set are cleaned in parallel (if not running in debug mode).

Each set is cleaned sequentially.

clean_testbed(testbed, *, timeout=None, task=None, lcl_logger=<Logger pyats.kleenex.engine (WARNING)>)

Performs best-attempt cleaning of the testbed, assuming there is clean definition for each device in this testbed. If none is found - that device is skipped

classmethod from_cleandefs(*cleandefs, reporter, debug_=False)
has_cleandef(device)

Test whether KleenexEngine has clean definitions for a given device.

Parameters

device (device object or device name string) –

Returns

Return type

True or False

static update_testbed(testbed, **cleaninfo)
exception pyats.kleenex.exceptions.CleanException(tb)

Bases: Exception

class pyats.kleenex.exceptions.CleanExceptionWithTraceback(exc, device_name)

Bases: pyats.clean.exceptions.ExceptionWithTraceback

exception pyats.kleenex.exceptions.CleanWorkerException

Bases: Exception

class pyats.kleenex.worker.KleenexSteps(parent=None)

Bases: pyats.aetest.steps.implementation.Steps

built-in __init__

instantiates the Steps class by creating an internal list that houses number of steps currently taken.

Note

step index is the same as the list index of current step.

start()

Creates a new Step instance and return it to the user scope. This is the main API called within the user realm to create and start new steps within the current scope.

Offset is used primarily with parallel call implementation. If specifying manually, ensure offset is large enough to enable additional steps per chid process.

Parameters
  • (int) (offset) –

  • args (all arguments to this api propagates directly to Step) –

  • kwargs (all arguments to this api propagates directly to Step) –

Returns

Return type

new Step() instance.

class pyats.kleenex.worker.KleenexWorker(cleaner, device, reporter, logfile, queue, timeout, debug_=False)

Bases: multiprocessing.context.ForkProcess

property result
run()

Method to be run in sub-process; can be overridden in sub-class