databay.link¶
Contents:
Data structure representing one Link transfer. When converted to string returns |
|
Link in the relationship graph. Use this class to define relationships between inlets and outlets. |
-
class
databay.link.
Update
(tags: List[str], transfer_number: int)[source]¶ databay.link.Update
Data structure representing one Link transfer. When converted to string returns
{tags}.{transfer_number}
-
class
databay.link.
Link
(inlets: Union[Inlet, List[Inlet]], outlets: Union[Outlet, List[Outlet]], interval: Union[datetime.timedelta, int, float], tags: Union[str, List[str]] = None, copy_records: bool = True, ignore_exceptions: bool = False, catch_exceptions: bool = None, inlet_concurrency: int = 9999, immediate_transfer: bool = True, processors: Union[callable, List[callable]] = None, groupers: Union[callable, List[callable]] = None, name=None)[source]¶ databay.link.Link
Link in the relationship graph. Use this class to define relationships between inlets and outlets.
- Parameters
outlets (
Outlet
or list[Outlet
]) – outlets to add to this link.interval (Union[datetime.timedelta, int, float]) – Expects
datetime.timedelta
. Alternatively, you can provideint
orfloat
which will be coerced explicitly todatetime.timedelta.seconds
.tags (Union[str, List[str]]) – List of tags of this link.
Default:[]
copy_records (bool) – Whether to copy records before passing them to outlets.
Default:True
ignore_exceptions (bool) – Whether exceptions in inlets and outlets should be logged and ignored, or raised.
Default:True
inlet_concurrency (int) – How many inlets are allowed to execute concurrently.
Default:9999
immediate_transfer (bool) – Whether governing planners that have
BasePlanner.immediate_transfer
set toTrue
should execute this link’s transfer once immediately upon starting.Default:True
processors (
callable
or list[callable
]) – Processors of this link.Default:None
groupers (
callable
or list[callable
]) – groupers of this link.Default:None
-
add_inlets
(self, inlets: Union[Inlet, List[Inlet]])[source]¶ Add inlets to this link. Inlets must be of type Inlet and not currently added to this link.
- Parameters
- Raises
InvalidNodeError
if this link already contains any of the inlets being added.
-
remove_inlets
(self, inlets: Union[Inlet, List[Inlet]])[source]¶ Remove inlets from this link.
- Parameters
inlets (
Inlet
or list[Inlet
]) – inlets to remove from this link- Raises
InvalidNodeError
if this link doesn’t contain any of the inlets being removed.
-
add_outlets
(self, outlets: Union[Outlet, List[Outlet]])[source]¶ Add outlets to this link. Outlets must be of type Outlet and not currently added to this link.
- Parameters
outlets (
Outlet
or list[Outlet
]) – outlets to add to this link- Raises
InvalidNodeError
if this link already contains any of the outlets being added.
-
remove_outlets
(self, outlets: Union[Outlet, List[Outlet]])[source]¶ Remove outlets from this link.
- Parameters
outlets (
Outlet
or list[Outlet
]) – outlets to remove from this link- Raises
InvalidNodeError
if this link doesn’t contain any of the outlets being removed.
-
interval
(self) → datetime.timedelta[source]¶ property
Frequency at which this link should transfer.
- Returns
interval object
- Return type
-
job
(self) → Any[source]¶ property
The job this link is executed with. Job should persist between link transfers.
Default:None
- Returns
Job this link is executed with.
-
name
(self) → str[source]¶ property
Deprecated in 0.2.0, will be removed in 1.0. Use
Link.tags
instead.Name of this Link, equivalent to first tag of this link.
- Returns
Name of this link
- Return type
property
The tags of this link.
Default:[]
- Returns
Tags of this link
- Return type
List[str]
-
transfer
(self)[source]¶ Execute one transfer on this link. This will run through all inlets querying them for data, then pass that data to all outlets.
See Link transfer to learn more about the transfer.
-
on_start
(self)[source]¶ Called when the governing planner is about to start. Calls
try_start
on all inlets and outlets of this link.If an inlet or outlet is present in multiple links its on_start will only be called once by whichever link executes first.
-
on_shutdown
(self)[source]¶ Called just after the governing planner has shutdown. Calls
try_shutdown
on all inlets and outlets of this link.If an inlet or outlet is present in multiple links its on_shutdown will only be called once by whichever link executes first.