Support Classes
illuminate.observation.observation.Observation
Bases: IObservation
Observation class, reads data from the source. Class must be inherited and method observe must be implemented in a child class.
Source code in illuminate/observation/observation.py
__hash__()
Observation object hash value.
RETURNS | DESCRIPTION |
---|---|
None |
RAISES | DESCRIPTION |
---|---|
BasicObservationException
|
__init__(url: Any, xcom: Optional[Any] = None)
Observation's init method.
PARAMETER | DESCRIPTION |
---|---|
url |
Data's URL
TYPE:
|
xcom |
Cross communication object
TYPE:
|
observe(*args, **kwargs)
async
Reads data from the source. Must be implemented in a child class.
RETURNS | DESCRIPTION |
---|---|
None |
RAISES | DESCRIPTION |
---|---|
BasicObservationException
|
Source code in illuminate/observation/observation.py
illuminate.observation.file.FileObservation
Bases: Observation
FileObservation class, reads file content asynchronously. Inherits Observation class and implements observe method.
Source code in illuminate/observation/file.py
__hash__() -> int
__init__(url: str, /, callback: Callable[[FileIOWrapperBase, tuple, dict], Result], xcom: Optional[Any] = None, *args, **kwargs)
FileObservation's init method.
PARAMETER | DESCRIPTION |
---|---|
url |
File path
TYPE:
|
callback |
Async function/method that manipulates FileIOWrapperBase object and returns Result
TYPE:
|
xcom |
Cross communication object
TYPE:
|
Source code in illuminate/observation/file.py
__repr__()
FileObservation's repr method.
RETURNS | DESCRIPTION |
---|---|
String representation of an instance |
observe(*args, **kwargs) -> AsyncIterator[Union[None, Result]]
async
Opens IO file stream asynchronously, pass stream object to a callback and returns None or Result as a context manager.
RETURNS | DESCRIPTION |
---|---|
AsyncIterator[Union[None, Result]]
|
AsyncIterator with None or Result |
Source code in illuminate/observation/file.py
illuminate.observation.http.HTTPObservation
Bases: Observation
HTTPObservation class, reads data from HTTP server asynchronously. Inherits Observation class and implements observe method.
Source code in illuminate/observation/http.py
__hash__() -> int
HTTPObservation object hash value.
RETURNS | DESCRIPTION |
---|---|
int
|
int |
__init__(url: str, /, allowed: Union[list[str], tuple[str]], callback: Callable[[HTTPResponse, tuple, dict], Result], xcom: Optional[Any] = None, *args, **kwargs)
HTTPObservation's init method.
PARAMETER | DESCRIPTION |
---|---|
url |
Data's HTTP URL
TYPE:
|
allowed |
Collection of strings evaluated against self.url to determent if URL is allowed
TYPE:
|
callback |
Async function/method that manipulates HTTPResponse object and returns Result.
TYPE:
|
xcom |
Cross communication object
TYPE:
|
Source code in illuminate/observation/http.py
__repr__()
HTTPObservation's repr method.
RETURNS | DESCRIPTION |
---|---|
String representation of an instance |
allowed() -> bool
property
Checks if HTTP URL is allowed to be requested.
RETURNS | DESCRIPTION |
---|---|
bool
|
bool |
observe(*args, **kwargs) -> Union[None, Result]
async
Requests data from HTTP server, passes response object to a callback and returns None or Result.
RETURNS | DESCRIPTION |
---|---|
Union[None, Result]
|
None or Result |
Source code in illuminate/observation/http.py
illuminate.observation.sql.SQLObservation
Bases: Observation
SQLObservation class, reads data from database asynchronously. Inherits Observation class and implements observe method.
Source code in illuminate/observation/sql.py
__hash__() -> int
__init__(query: Union[Select, TextClause], url: str, /, callback: Callable[[AlchemyResult, tuple, dict], Result], xcom: Optional[Any] = None, *args, **kwargs)
SQLObservation's init method.
PARAMETER | DESCRIPTION |
---|---|
query |
SQLAlchemy query object.
TYPE:
|
url |
Database name in project settings.
TYPE:
|
callback |
Async function/method that manipulates AlchemyResult object and returns Result.
TYPE:
|
xcom |
Cross communication object
TYPE:
|
Source code in illuminate/observation/sql.py
__repr__()
SQLObservation's repr method.
RETURNS | DESCRIPTION |
---|---|
String representation of an instance |
observe(session: Type[AsyncSession], *args, **kwargs) -> Union[None, Result]
async
Reads data from database, passes response object to a callback and returns None or Result.
RETURNS | DESCRIPTION |
---|---|
Union[None, Result]
|
None or Result |
Source code in illuminate/observation/sql.py
illuminate.observation.http.SplashObservation
Bases: HTTPObservation
SplashObservation class, reads data from HTTP server asynchronously. Inherits HTTPObservation class and implements observe method.
Constructor's kwargs are used to create Splash service URL. For full list of parameters visit https://splash.readthedocs.io/en/stable/api.html.
Note: URL is passed as positional argument. It will be used as param in Splash service URL.
Source code in illuminate/observation/http.py
__hash__() -> int
__repr__()
SplashObservation's repr method.
RETURNS | DESCRIPTION |
---|---|
String representation of an instance |
observe(configuration: dict, *args, **kwargs) -> Union[None, Result]
async
Requests data from HTTP server and renders response with Splash, passes response object to a callback and returns None or Result.
PARAMETER | DESCRIPTION |
---|---|
configuration |
HTTP configuration dict from settings.py
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[None, Result]
|
None or Result |
Source code in illuminate/observation/http.py
service()
property
Constructs URL of Splash service
RETURNS | DESCRIPTION |
---|---|
Splash URL string |
Source code in illuminate/observation/http.py
illuminate.observer.finding.Finding
illuminate.adapter.adapter.Adapter
Bases: IAdapter
Adapter class, generates Exporter and Observation objects using Finding instances with optional transformation. Class must be inherited and method adapt must be implemented in a child class.
Source code in illuminate/adapter/adapter.py
priority: int
class-attribute
Place in Adapter list. If two Adapters have the same Finding in subscriber tuple, one with the higher priority will call method adapt first on Finding object.
subscribers: tuple[Type[Finding]]
class-attribute
Tuple of Finding class children used to determent if Adapter object should call method adapt on Finding instance.
__init__(manager: Optional[Manager] = None)
Adapter's init method.
PARAMETER | DESCRIPTION |
---|---|
manager |
Manager object
TYPE:
|
adapt(finding: Finding, *args, **kwargs) -> AsyncGenerator[Union[Exporter, Observation], None]
async
Generates Exporter and Observation objects. Must be implemented in a child class.
It is meant to be a scope where additional transformation up on finding objects should be performed (like data enrichment from additional data source) before yielding Exporter or Observation instances.
PARAMETER | DESCRIPTION |
---|---|
finding |
Finding object
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
AsyncGenerator[Union[Exporter, Observation], None]
|
Async Exporter and Observation object generator |
RAISES | DESCRIPTION |
---|---|
BasicAdapterException
|
Source code in illuminate/adapter/adapter.py
illuminate.exporter.exporter.Exporter
Bases: IExporter
Exporter class, writes data to destination. Class must be inherited and method export must be implemented in a child class.
Source code in illuminate/exporter/exporter.py
export(*args, **kwargs)
async
Writes data to destination. Must be implemented in a child class.
RETURNS | DESCRIPTION |
---|---|
None |
RAISES | DESCRIPTION |
---|---|
BasicExporterException
|
Source code in illuminate/exporter/exporter.py
illuminate.exporter.influxdb.InfluxDBExporter
Bases: Exporter
InfluxDBExporter class, writes data to InfluxDB database asynchronously. Inherits Exporter class and implements export method.
Each InfluxDBExporter object is responsible for a single transaction with a single database. Attribute name is used to acquire database session object from Manager's sessions attribute.
Constructor kwargs will be passed to client write method. For more information on write method, visit: https://aioinflux.readthedocs.io/en/stable/api.html
Supported write data objects: - DataFrame with DatetimeIndex - Dict containing the keys: measurement, time, tags, fields - String (str or bytes) properly formatted in InfluxDB’s line protocol - An iterable of one of the above
Source code in illuminate/exporter/influxdb.py
name: str
class-attribute
InfluxDB database name selector used to get database session object from Manager.sessions attribute.
__init__(points: Union[Union[DataFrame, dict, str, bytes], Iterable[Union[DataFrame, dict, str, bytes]]], *args, **kwargs)
InfluxDBExporter's init method.
PARAMETER | DESCRIPTION |
---|---|
points |
Supported data objects
TYPE:
|
Source code in illuminate/exporter/influxdb.py
__repr__()
InfluxDBExporter's repr method.
RETURNS | DESCRIPTION |
---|---|
String representation of an instance |
export(session: InfluxDBClient, *args, **kwargs) -> None
async
Writes data to Influxdb asynchronously.
PARAMETER | DESCRIPTION |
---|---|
session |
InfluxDBClient object
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
None |
RAISES | DESCRIPTION |
---|---|
BasicExporterException
|
Source code in illuminate/exporter/influxdb.py
illuminate.exporter.sql.SQLExporter
Bases: Exporter
SQLExporter class, writes data to SQL database asynchronously. Inherits Exporter class and implements export method.
Each SQLExporter object is responsible for a single transaction with a single database. Attribute name is used to acquire database session object from Manager's sessions attribute.
Supported dialects: - Mysql - Postgres
Source code in illuminate/exporter/sql.py
name: str
class-attribute
SQL database name selector used to get database session object from Manager.sessions attribute.
__init__(models: Union[list[M], tuple[M]])
SQLExporter's init method.
PARAMETER | DESCRIPTION |
---|---|
models |
SQLAlchemy model objects collection
TYPE:
|
__repr__()
export(session: Type[AsyncSession], *args, **kwargs) -> None
async
Writes data to SQL database asynchronously.
PARAMETER | DESCRIPTION |
---|---|
session |
AsyncSession object
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
None |
RAISES | DESCRIPTION |
---|---|
BasicExporterException
|