exopy.tasks.tasks.task_interface module¶
Definition of the base classes for interfaces in tasks.
-
exopy.tasks.tasks.task_interface.
DEP_TYPE
= 'exopy.tasks.interface'¶ Id used to identify dependencies type.
-
class
exopy.tasks.tasks.task_interface.
InterfaceableMixin
[source]¶ Bases:
atom.atom.Atom
Base class for mixin used to fabricate interfaceable task or interface.
This class should not be used directly, use one of its subclass.
-
interface
¶ A reference to the current interface for the task.
-
check
(*args, **kwargs)[source]¶ Check the interface.
This run the checks of the next parent class in the mro and check if a valid interface (real or default one) exists.
-
perform
(*args, **kwargs)[source]¶ Implementation of perform relying on interfaces.
This method will be considered as the true perform method of the task, it will either call the interface perform method or the special i_perform method if there is no interface. This is meant to provide an easy way to turn a non-interfaced task into an interfaced one : - add the mixin as the left most inherited class - rename the perform method to i_perform - create new interfaces but keep the default ‘standard’ behaviour.
NEVER OVERRIDE IT IN SUBCLASSES OTHERWISE YOU WILL BREAK THE INTERFACE SYSTEM.
-
classmethod
build_from_config
(config, dependencies)[source]¶ Create a new instance using the provided infos for initialisation.
- Parameters
config (
dict(str)
) – Dictionary holding the new values to give to the members in string format, or dictionnary like for instance with prefs.dependencies (
dict
) – Dictionary holding the necessary classes needed when rebuilding. This is assembled by the TaskManager.
- Returns
task – Newly built task.
- Return type
BaseTask
-
-
class
exopy.tasks.tasks.task_interface.
InterfaceableTaskMixin
[source]¶ Bases:
exopy.tasks.tasks.task_interface.InterfaceableMixin
Mixin class for defining a task using interfaces.
When defining a new interfaceable task this mixin should always be the letf most class when defining the inheritance. This is due to the Python Method Resolution Order (mro) and the fact that this mixin must override methods defined in tasks. ex : MyTaskI(InterfaceableTaskMixin, MyTask):
-
interface
¶ A Typed which delays resolving the type definition.
The first time the value is accessed or modified, the type will be resolved and the forward typed will behave identically to a normal typed.
-
-
class
exopy.tasks.tasks.task_interface.
InterfaceableInterfaceMixin
[source]¶ Bases:
exopy.tasks.tasks.task_interface.InterfaceableMixin
Mixin class for defining an interface using interfaces.
When defining a new interfaceable task this mixin should always be the letf most class when defining the inheritance. This is due to the Python Method Resolution Order (mro) and the fact that this mixin must override methods defined in tasks. ex : MyInterface(InterfaceableTaskMixin, Interface):
-
interface
¶ A Typed which delays resolving the type definition.
The first time the value is accessed or modified, the type will be resolved and the forward typed will behave identically to a normal typed.
-
-
class
exopy.tasks.tasks.task_interface.
BaseInterface
[source]¶ Bases:
exopy.utils.atom_util.HasPrefAtom
Base class to use for interfaces.
The interface should not re-use member names used by the task to avoid issue when walking.
This class should not be used directly, use one of its subclass.
-
dep_type
¶ Identifier for the build dependency collector
-
interface_id
¶ A value of type str.
Under Python 2 this is a byte string and behaves as Bytes with respect to promotion, under Python 3 it is a unicode string and behaves as Unicode with respect to promotion.
The use of this member is discouraged in Python 2/3 compatible codebase as Bytes and Unicode provide a more homogeneous behavior.
-
database_entries
¶ Dict of database entries added by the interface.
-
check
(*args, **kwargs)[source]¶ Check that everything is alright before starting a measurement.
By default tries to format all members tagged with ‘fmt’ and try to eval all members tagged with ‘feval’. If the tag value is ‘Warn’, the test will considered passed but a traceback entry will be filled.
-
prepare
()[source]¶ Prepare the interface to be performed.
This method is called once by the parent task before starting the execution.
-
-
class
exopy.tasks.tasks.task_interface.
TaskInterface
[source]¶ Bases:
exopy.tasks.tasks.task_interface.BaseInterface
Base class to use when writing a task interface.
The interface should not re-use member names used by the task to avoid issue when walking.
-
task
¶ A reference to the task to which this interface is linked.
-
-
class
exopy.tasks.tasks.task_interface.
IInterface
[source]¶ Bases:
exopy.tasks.tasks.task_interface.BaseInterface
Base class to use when writing an interface interface.
The interface should not re-use member names used by the task or parent interfaces to avoid issue when walking.
-
parent
¶ A reference to the parent interface to which this interface is linked.
-
task
¶ Direct access to the task, which acts as a root parent.
-