devctrl.task.tasks.DebugTask#
- class DebugTask(msg: str = 'None', raise_exception_start: bool = False, raise_exception_update: bool = False, raise_exception_stop: bool = False)[source]#
Bases:
TaskDebug Task, prints a log message and raises sxceptions.
Can be configured to raise an exception at the start of the task, during the update function and during the stop function.
Methods
Convenience wrapper for dataclasses.asdict(self)
Recursively construct a
SettingsClassfrom a dictionary.Get the icon name of the task.
Get formatted task name with settings
Return relevant settings as a formatted string for GUI display
Return the human-readable name of the task.
Attributes
- __abstractmethods__ = frozenset({})#
- __annotations__ = {'msg': <class 'str'>, 'raise_exception_start': <class 'bool'>, 'raise_exception_stop': <class 'bool'>, 'raise_exception_update': <class 'bool'>}#
- __dataclass_fields__ = {'msg': Field(name='msg',type=<class 'str'>,default='None',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'raise_exception_start': Field(name='raise_exception_start',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'raise_exception_stop': Field(name='raise_exception_stop',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'raise_exception_update': Field(name='raise_exception_update',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}#
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False)#
- __dict__ = mappingproxy({'__module__': 'devctrl.task.tasks', '__firstlineno__': 14, '__annotations__': {'msg': <class 'str'>, 'raise_exception_start': <class 'bool'>, 'raise_exception_update': <class 'bool'>, 'raise_exception_stop': <class 'bool'>}, '__doc__': 'Debug Task, prints a log message and raises sxceptions.\n\nCan be configured to raise an exception at the start of the task, during the update function and during the stop function.\n', 'msg': 'None', 'raise_exception_start': False, 'raise_exception_update': False, 'raise_exception_stop': False, 'get_settings_name': <function DebugTask.get_settings_name>, 'get_icon_name': <function DebugTask.get_icon_name>, '__static_attributes__': (), '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__dataclass_params__': _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False), '__dataclass_fields__': {'msg': Field(name='msg',type=<class 'str'>,default='None',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'raise_exception_start': Field(name='raise_exception_start',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'raise_exception_update': Field(name='raise_exception_update',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'raise_exception_stop': Field(name='raise_exception_stop',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function DebugTask.__init__>, '__repr__': <function DebugTask.__repr__>, '__eq__': <function DebugTask.__eq__>, '__match_args__': ('msg', 'raise_exception_start', 'raise_exception_update', 'raise_exception_stop')})#
- __eq__(other)#
Return self==value.
- __firstlineno__ = 14#
- __hash__ = None#
- __init__(msg: str = 'None', raise_exception_start: bool = False, raise_exception_update: bool = False, raise_exception_stop: bool = False) None#
- __match_args__ = ('msg', 'raise_exception_start', 'raise_exception_update', 'raise_exception_stop')#
- __module__ = 'devctrl.task.tasks'#
- __or__(other)#
Merge with another settings class or a dictionary.
- __replace__(**changes)#
- __repr__()#
Get formatted task name with settings
- Returns:
Formatted string as ‘typename (settings_name)’
- __slots__ = ()#
- __static_attributes__ = ()#
- __weakref__#
list of weak references to the object
- _abc_impl = <_abc._abc_data object>#
- _children: Dict[str, Type[Task]] = {'DebugTask': <class 'devctrl.task.tasks.DebugTask'>, 'DeviceActionTask': <class 'devctrl.task.tasks.DeviceActionTask'>, 'MeasurementTask': <class 'prsctrl_gui.task.tasks.measurement.MeasurementTask'>, 'SendEmailTask': <class 'devctrl.task.tasks.SendEmailTask'>, 'UserConfirmTask': <class 'devctrl.task.tasks.UserConfirmTask'>, 'WaitTask': <class 'devctrl.task.tasks.WaitTask'>}#
- as_dict() dict#
Convenience wrapper for dataclasses.asdict(self)
- estimate_runtime_s() int#
- classmethod from_dict(data: dict)#
Recursively construct a
SettingsClassfrom a dictionary.If the value of a field is another SettingsClass,
from_dict()will be called for that field as well. Handled are:SettingsClass
list[SettingsClass]
dict[<any>, SettingsClass]
all of the above as Optional (Union with
None)a Union with any handled types
- get_icon_name() str[source]#
Get the icon name of the task. Defaults to “square”.”
- Returns:
Icon name.
- get_name() str#
Get formatted task name with settings
- Returns:
Formatted task name including settings
- get_settings_name() str[source]#
Return relevant settings as a formatted string for GUI display
Iterates through task fields and returns a string representation of non-default values that can be used for displaying the task in the GUI.
- Returns:
Formatted string of settings, or empty string if no settings differ from defaults
- classmethod get_type_name() str#
Return the human-readable name of the task.
- classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
- msg: str = 'None'#
- raise_exception_start: bool = False#
- raise_exception_stop: bool = False#
- raise_exception_update: bool = False#
- save_yaml(yaml_path: str)#