This module contains glue code that allows one to create and manage sessions and their filesystem presence. It allows SessionState to be de-coupled from SessionStorageRepository, SessionStorage, SessionSuspendHelper and SessionResumeHelper.
Bases: plainbox.impl.pod.POD
Manager class for coupling SessionStorage with SessionState.
This class allows application code to manage disk state of sessions. Using the checkpoint() method applications can create persistent snapshots of the SessionState associated with each SessionManager.
Add a device context to the session manager
Parameters: | context – The SessionDeviceContext to add. |
---|---|
Raises ValueError: | |
If the context is already in the session manager or the device represented by that context is already present in the session manager. |
This method fires the on_device_context_added() signal
Create and add a SessionDeviceContext that describes the local device.
The local device is always the device executing plainbox. Other devices may execute jobs or parts of plainbox but they don’t need to store or run the full plainbox code.
Return the data in this POD as a dictionary
Return the data in this POD as a tuple.
Order of elements in the tuple corresponds to the order of field declarations.
Create a checkpoint of the session.
After calling this method you can later reopen the same session with SessionManager.load_session().
Create an empty session manager.
This method creates an empty session manager. This is the most generic API that allows applications to freely work with any set of devices.
Typically applications will use the add_device_context() method to add additional context objects at a later time. This method creates and populates the session storage with all of the well known directories (using WellKnownDirsHelper.populate()).
Parameters: |
|
---|---|
Ptype repo: | |
Ptype legacy_mode: | |
bool |
|
Returns: | fresh SessionManager instance |
Create a session manager by wrapping existing session state.
This method populates the session storage with all of the well known directories (using WellKnownDirsHelper.populate())
Parameters: |
|
---|---|
Ptype repo: | |
Ptype legacy_mode: | |
bool |
|
Returns: | fresh SessionManager instance |
Create a session manager with a fresh session.
This method populates the session storage with all of the well known directories (using WellKnownDirsHelper.populate())
Parameters: |
|
---|---|
Ptype repo: | |
Ptype legacy_mode: | |
bool |
|
Returns: | fresh SessionManager instance |
The default (first) session device context if available
In single-device sessions this is the context that is used to execute every single job definition. Applications that use multiple devices must access and use the context list directly.
Destroy all of the filesystem artifacts of the session.
This basically calls remove()
A list of session device context objects
Note
You must not modify this field directly.
This is not enforced but please use the add_device_context() or remove_device_context() if you want to manipulate the list. Currently you cannot reorder the list of context objects.
Load a previously checkpointed session.
This method allows one to re-open a session that was previously created by SessionManager.checkpoint()
Parameters: |
|
---|---|
Ptype storage: | |
Raises: | Anything that can be raised by load_checkpoint() and resume() |
Returns: | Fresh instance of SessionManager |
alias of SessionManager
Basic signal that supports arbitrary listeners.
While this class can be used directly it is best used with the helper decorator Signal.define on a function or method. See the documentation for the plainbox.vendor.morris module for details.
Attr _name: | Name of the signal, typically accessed via name(). |
---|---|
Attr _listeners: | |
List of signal listeners. Each item is a tuple (listener, pass_signal) that encodes how to call the listener. |
Basic signal that supports arbitrary listeners.
While this class can be used directly it is best used with the helper decorator Signal.define on a function or method. See the documentation for the plainbox.vendor.morris module for details.
Attr _name: | Name of the signal, typically accessed via name(). |
---|---|
Attr _listeners: | |
List of signal listeners. Each item is a tuple (listener, pass_signal) that encodes how to call the listener. |
Basic signal that supports arbitrary listeners.
While this class can be used directly it is best used with the helper decorator Signal.define on a function or method. See the documentation for the plainbox.vendor.morris module for details.
Attr _name: | Name of the signal, typically accessed via name(). |
---|---|
Attr _listeners: | |
List of signal listeners. Each item is a tuple (listener, pass_signal) that encodes how to call the listener. |
Remove an device context from the session manager
Parameters: | unit – The SessionDeviceContext to remove. |
---|
This method fires the on_device_context_removed() signal
SessionState associated with this manager
A SesssionStorage instance
Test plans that this session is processing.
This field contains a tuple of test plans that are active in the session. Any changes here are propagated to each device context participating in the session. This in turn makes all of the overrides defined by those test plans effective.
Note
Currently there is no facitly that would allow to use this field to drive test execution. Such facility is likely to be added later.
Bases: plainbox.impl.pod.POD
Helper class that knows about well known directories for SessionStorage.
This class simply gets rid of various magic directory names that we associate with session storage. It also provides a convenience utility method populate() to create all of those directories, if needed.
Return the data in this POD as a dictionary
Return the data in this POD as a tuple.
Order of elements in the tuple corresponds to the order of field declarations.
alias of WellKnownDirsHelper
Create all of the well known directories that are expected to exist inside a freshly created session storage directory
SessionStorage associated with this helper