minos.networks.scheduling.requests module¶
- class minos.networks.scheduling.requests.ScheduledRequest(scheduled_at, *args, **kwargs)[source]¶
Bases:
minos.networks.requests.abc.Request
Scheduling Request class.
- async content(**kwargs)¶
Get the request content.
- Parameters
kwargs – Additional named arguments.
- Return type
typing.Any
- Returns
The request content.
- property has_content: bool¶
Check if the request has content.
- Return type
bool
- Returns
True
if it has content orFalse
otherwise.
- property has_params: bool¶
Check if the request has params.
- Return type
bool
- Returns
True
if it has params orFalse
otherwise.
- async params(**kwargs)¶
Get the request params.
- Parameters
kwargs – Additional named arguments.
- Return type
dict
[str
,typing.Any
]- Returns
The request params.
- property user: Optional[uuid.UUID]¶
The user of the request.
- Return type
typing.Optional
[uuid.UUID
]- Returns
Always return
None
as scheduled request are launched by the system.
- class minos.networks.scheduling.requests.ScheduledRequestContent(*args, **kwargs)[source]¶
Bases:
minos.common.model.declarative.DeclarativeModel
Scheduling Request Content class.
- __init__(*args, **kwargs)¶
Class constructor.
- Parameters
kwargs – Named arguments to be set as model attributes.
- property avro_bytes: bytes¶
Generate bytes representation of the current instance.
- Return type
bytes
- Returns
A bytes object.
- property avro_data: dict[str, typing.Any]¶
Compute the avro data of the model.
- Return type
dict
[str
,typing.Any
]- Returns
A dictionary object.
- avro_schema = [{'name': 'ScheduledRequestContent', 'namespace': 'minos.networks.scheduling.requests.4a171b4d-b72a-4330-bb51-4b9452e988a8', 'type': 'record', 'fields': [{'name': 'scheduled_at', 'type': {'type': 'long', 'logicalType': 'timestamp-micros'}}]}]¶
- property avro_str: str¶
Generate bytes representation of the current instance.
- Return type
str
- Returns
A bytes object.
- classname = 'minos.networks.scheduling.requests.ScheduledRequestContent'¶
- property fields: dict[str, minos.common.model.fields.Field]¶
Fields getter
- Return type
dict
[str
,minos.common.model.fields.Field
]
- classmethod from_avro(schema, data)¶
Build a new instance from the
avro
schema and data.- Parameters
schema (
typing.Union
[dict
[str
,typing.Any
],list
[dict
[str
,typing.Any
]]]) – The avro schema of the model.data (
dict
[str
,typing.Any
]) – The avro data of the model.
- Return type
~T
- Returns
A new
DynamicModel
instance.
- classmethod from_avro_bytes(raw, **kwargs)¶
Build a single instance or a sequence of instances from bytes
- Parameters
raw (
bytes
) – A bytes data.- Return type
typing.Union
[~T,list
[~T]]- Returns
A single instance or a sequence of instances.
- classmethod from_avro_str(raw, **kwargs)¶
Build a single instance or a sequence of instances from bytes
- Parameters
raw (
str
) – A bytes data.- Return type
typing.Union
[~T,list
[~T]]- Returns
A single instance or a sequence of instances.
- classmethod from_model_type(model_type, *args, **kwargs)¶
Build a
DeclarativeModel
from aModelType
.- Parameters
model_type (
minos.common.model.types.model_types.ModelType
) –ModelType
object containing the model structure.args – Positional arguments to be passed to the model constructor.
kwargs – Named arguments to be passed to the model constructor.
- Return type
~T
- Returns
A new
DeclarativeModel
instance.
- classmethod from_typed_dict(typed_dict, *args, **kwargs)¶
Build a
Model
from aTypeDict
anddata
.- Parameters
typed_dict (
typing.TypedDict
) –TypeDict
object containing the DTO’s structureargs – Positional arguments to be passed to the model constructor.
kwargs – Named arguments to be passed to the model constructor.
- Return type
~T
- Returns
A new
DataTransferObject
instance.
- get(k[, d]) D[k] if k in D, else d. d defaults to None. ¶
- items() a set-like object providing a view on D's items ¶
- keys() a set-like object providing a view on D's keys ¶
- scheduled_at: datetime¶
- classmethod to_avro_bytes(models)¶
Create a bytes representation of the given object instances.
- Parameters
models (
list
[~T]) – A sequence of minos models.- Return type
bytes
- Returns
A bytes object.
- classmethod to_avro_str(models)¶
Create a bytes representation of the given object instances.
- Parameters
models (
list
[~T]) – A sequence of minos models.- Return type
str
- Returns
A bytes object.
- type_hints¶
- type_hints_parameters = ()¶
- values() an object providing a view on D's values ¶
- exception minos.networks.scheduling.requests.ScheduledResponseException(error_message)[source]¶
Bases:
minos.networks.requests.abc.ResponseException
Scheduled Response Exception class.
- __init__(error_message)¶
- args¶
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.