dp3.common.task ¶
Task ¶
Bases: BaseModel
, ABC
A generic task type class.
An abstraction for the task queue classes to depend upon.
DataPointTask ¶
Bases: Task
DataPointTask
Contains single task to be pushed to TaskQueue and processed. Attributes: etype: Entity type eid: Entity id / key data_points: List of DataPoints to process tags: List of tags ttl_tokens: Dictionary of TTL tokens. delete: If True, delete entity
Set the model_spec
context variable and initialize the Task.
See https://docs.pydantic.dev/latest/concepts/validators/#validation-context
Source code in dp3/common/task.py
Snapshot ¶
Bases: Task
Snapshot
Contains a list of entities, the meaning of which depends on the type
.
If type
is "task", then the list contains linked entities for which a snapshot
should be created. Otherwise type
is "linked_entities", indicating which entities
must be skipped in a parallelized creation of unlinked entities.
Attributes:
HASH ¶
Hash function used to distribute tasks to worker processes. Args: key: to be hashed Returns: last 4 bytes of MD5
task_context ¶
Context manager for setting the model_spec
context variable.
Source code in dp3/common/task.py
parse_eids_from_cache ¶
Parses entity IDs from the "Link" cache.
Parameters:
Returns:
Source code in dp3/common/task.py
parse_eid_tuples_from_cache ¶
parse_eid_tuples_from_cache(model_spec: ModelSpec, link_entity_entries: list[str]) -> list[tuple[str, AnyEidT]]
Parses entity IDs from the "Link" cache.
Parameters:
Returns: