lisa.wlgen.rta.PropertyBase#
- class lisa.wlgen.rta.PropertyBase[source]#
Bases:
SimpleHash
Base class of all properties.
Classes
Metaclass for properties.
Attributes
Subclasses can override this attribute so that
PropertyBase.from_key()
knows that it can call their_from_key()
method for that key.Properties
Methods
Combine two instances of the same property together.
Find which subclass can handle
key
.Alternative constructor that is available with the same signature for all properties.
HASH_COERCE()
inheritedUsed to coerce the values of
self.__dict__
to hashable values.
Classes#
- PropertyBase.__class__#
alias of
PropertyMeta
Attributes#
- PropertyBase.KEY = None#
Subclasses can override this attribute so that
PropertyBase.from_key()
knows that it can call their_from_key()
method for that key.Note
This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get
None
.
Properties#
- property PropertyBase.key[source]#
Key of the instance.
This property will default to getting the value of the
KEY
class attribute of the first of its ancestor defining it. This way,_from_key()
can be shared in a base class between multiple subclasses if needed.
- abstract property PropertyBase.val[source]#
Value “payload” of the property.
Ideally, it should be a valid value that can be given to
from_key()
, but it’s not mandatory. For complex properties that are not isomorphic to a Python basic type (int, tuple etc.),self
should be returned.
Methods#
- abstract PropertyBase.__and__(other)[source]#
Combine two instances of the same property together.
This is used to combine properties at the various levels of the
RTAPhaseTree
tree, on each path from the root to the leaves. It is guaranteed that the instance closer to the root will beself
and the one closer to the leaves will beother
.If the property is a constraint, a good implementation should combine two instances by applying the strongest constraint. For example, CPU affinity are combined by taking the intersection of allowed CPUs.
If the property is some sort of “dummy” structure, it can make sense to allow the instance closer to the root of the tree to override the set members in the instance closer to the leaves.
Otherwise, it’s probably best to just bail with
ValueError
with a message explaining that there is a conflict.
- classmethod PropertyBase.find_cls(key)[source]#
Find which subclass can handle
key
.It is best called on
PropertyBase
in order to allow any property to be built.
- classmethod PropertyBase.from_key(key, val)[source]#
Alternative constructor that is available with the same signature for all properties.
- PropertyBase.HASH_COERCE(x, coerce)#
Inherited method, see
lisa.utils.SimpleHash.HASH_COERCE()
Used to coerce the values of
self.__dict__
to hashable values.