laboneq.workflow.opts
¶
OptionBuilder(base)
¶
A class to build options for a workflow.
base: WorkflowOptions
property
¶
Return the base options.
TaskOptions
¶
Bases: BaseOptions
Base class for task options.
WorkflowOptions
¶
Bases: BaseOptions
Base options for a workflow.
Attributes:
Name | Type | Description |
---|---|---|
logstore |
list[LogbookStore] | LogbookStore | None
|
The logstore to use for the particular workflow.
If left as This field is not serialized/deserialized. |
_task_options |
dict[str, BaseOptions]
|
A mapping of sub-task and sub-workflow options. A task can have only one unique set of options per workflow. |
logstore: list[LogbookStore] | LogbookStore | None = option_field(None, description='The logstores to use.', exclude=True, repr=False, converter=_logstore_converter)
class-attribute
instance-attribute
¶
get_and_validate_param_type(fn, type_check, parameter='options')
¶
Get the type of the parameter for a function-like object.
The function-like object must have an parameter
with a type hint,
following any of the following patterns:
* `Union[type, None]`
* `type | None`
* `Optional[type]`.
Returns:
Type | Description |
---|---|
type[T] | None
|
Type of the parameter if it exists and satisfies the above |
type[T] | None
|
conditions, otherwise |
Raises:
Type | Description |
---|---|
ValueError
|
When the type hint contains a subclass of |
option_field(default=attr.NOTHING, *, factory=None, validators=None, description=None, exclude=False, eq=False, alias=None, converter=None, repr=True)
¶
Create a field for an options class.
Attributes:
Name | Type | Description |
---|---|---|
default |
The default value of the field. |
|
factory |
The factory to use for the field. |
|
validators |
The validators to use for the field. When provided, only the custom validators are used. When not provided or None, a basic validator is used that performs type checking for the following types: - Non-generic types: int, str, float, etc. - Union, Optional - Generic types: List, Dict, Tuple, Set, Callable, etc. Only the origin is checked. - User-defined classes |
|
description |
The description of the field. |
|
exclude |
Whether to exclude the field from serialization. |
|
eq |
Whether to include the field in the equality check. |
|
alias |
The alias of the field. |
|
converter |
The converter to use for the field. |
|
repr |
Whether to include the field in the representation. |
options(cls)
¶
Decorator to make a class an options class.
show_fields(opt)
¶
Print the overview of the option fields.