epicsarchiver.statistics.models.stat_responses

Data structures for the statistics endpoints from the archiver.

Attributes

_DATE_FORMAT_OFFSET

_DATE_FORMAT_TIMEZONE

UNKNOWN_IOC

Classes

DroppedReason

List of reasons why a PV could be dropping events.

BaseStatResponse

Base class for responses from the archiver statistical endpoints.

DroppedPVResponse

Response from the endpoints in DroppedReason.

DisconnectedPVsResponse

Response from getCurrentlyDisconnectedPVs.

SilentPVsResponse

Return a list of PVs sorted by the timestamp of the last event received.

ConnectionStatus

Connection status enum.

LostConnectionsResponse

Return a list of PVs sorted by the no. of connection drops.

StorageRatesResponse

Return a list of PVs sorted by the no. of connection drops.

BothArchiversResponse

Response of pvs archived in two archivers.

PausedPVResponse

Response of pvs paused.

ConfiguredStatus

Represents if a pv is configured in gitlab, channelfinder or archived only.

NoConfigResponse

Response of pvs archived but not in configuration files.

Ioc

Minimal info on an Ioc.

NameCheckResponse

Response of pvs paused.

Functions

parse_archiver_datetime(→ datetime.datetime | None)

Calculate a datetime.datetime from the possible input strings of the archiver.

Module Contents

class epicsarchiver.statistics.models.stat_responses.DroppedReason[source]

Bases: str, enum.Enum

List of reasons why a PV could be dropping events.

Includes the endpoints in the archiver corresponding to the reason.

IncorrectTimestamp = '/getPVsByDroppedEventsTimestamp'[source]
BufferOverflow = '/getPVsByDroppedEventsBuffer'[source]
TypeChange = '/getPVsByDroppedEventsTypeChange'[source]
SlowChanging = '/getSlowChangingPVsWithDroppedEvents'[source]
class epicsarchiver.statistics.models.stat_responses.BaseStatResponse[source]

Base class for responses from the archiver statistical endpoints.

pv_name: str[source]
class epicsarchiver.statistics.models.stat_responses.DroppedPVResponse[source]

Bases: BaseStatResponse

Response from the endpoints in DroppedReason.

events_dropped: int[source]
dropped_reason: DroppedReason[source]
classmethod from_json(json: dict[str, str], dropped_reason: DroppedReason) DroppedPVResponse[source]

Convert to DroppedPVResponse from dictionary generated from json.

Parameters:
Returns:

The corresponding DroppedPVResponse

Return type:

DroppedPVResponse

__str__() str[source]

Generate a display string for the response.

Returns:

“Dropped {events} by {reason}”

Return type:

str

epicsarchiver.statistics.models.stat_responses._DATE_FORMAT_OFFSET = '%b/%d/%Y %H:%M:%S %z'[source]
epicsarchiver.statistics.models.stat_responses._DATE_FORMAT_TIMEZONE = '%b/%d/%Y %H:%M:%S %Z'[source]
epicsarchiver.statistics.models.stat_responses.parse_archiver_datetime(datetime_str: str) datetime.datetime | None[source]

Calculate a datetime.datetime from the possible input strings of the archiver.

Parameters:

datetime_str (str) – Either “%b/%d/%Y %H:%M:%S %z”, “Never”, “” or “%b/%d/%Y %H:%M:%S %Z”

Returns:

Datetime representation

Return type:

datetime.datetime | None

class epicsarchiver.statistics.models.stat_responses.DisconnectedPVsResponse[source]

Bases: BaseStatResponse

Response from getCurrentlyDisconnectedPVs.

Example:

{
    "hostName": "N/A",
    "connectionLostAt": "Sep/14/2023 16:00:18 +02:00",
    "pvName": "HCB-ACH:ODH-O2iM-1:O2Level",
    "instance": "sw-vm-11",
    "commandThreadID": "6",
    "noConnectionAsOfEpochSecs": "1694700018",
    "lastKnownEvent": "Aug/25/2023 15:38:17 +02:00"
}
host_name: str[source]
connection_lost_at: datetime.datetime | None[source]
instance: str[source]
command_thread_id: int[source]
no_connection_as_of_epoch: int[source]
last_known_event: datetime.datetime | None[source]
classmethod from_json(json: dict[str, str]) DisconnectedPVsResponse[source]

Response from the endpoint in getCurrentlyDisconnectedPVs.

Parameters:

json (dict[str, str]) – Input json

Returns:

Output dataclass

Return type:

DisconnectedPVsResponse

__str__() str[source]

Generate a display string for the response.

Returns:

“Disconnected {time_difference} ago. Last event at {last_known_event}”

Return type:

str

class epicsarchiver.statistics.models.stat_responses.SilentPVsResponse[source]

Bases: BaseStatResponse

Return a list of PVs sorted by the timestamp of the last event received.

Example:

{"pvName":"DTL-030:SC-IOC-002:CA_CLNT_CNT","instance":"archiver-linac-01","lastKnownEvent":"Never"}
instance: str[source]
last_known_event: datetime.datetime | None[source]
classmethod from_json(json: dict[str, str]) SilentPVsResponse[source]

Response from the endpoint in getSilentPVsReport.

Parameters:

json (dict[str, str]) – Input json

Returns:

Output dataclass

Return type:

SilentPVsResponse

__str__() str[source]

Generate a display string for the response.

Returns:

“No events stored. Last invalid event recieved at {last_known_event}”

Return type:

str

class epicsarchiver.statistics.models.stat_responses.ConnectionStatus(*args, **kwds)[source]

Bases: enum.Enum

Connection status enum.

Parameters:

enum (int) – Placement of enum.

CurrentlyConnected[source]
NotCurrentlyConnected[source]
class epicsarchiver.statistics.models.stat_responses.LostConnectionsResponse[source]

Bases: BaseStatResponse

Return a list of PVs sorted by the no. of connection drops.

Example:

{
    "currentlyConnected": "Yes",
    "pvName": "MBL-010LWU:Vac-VPN-10000:IonCurR",
    "instance": "archiver-linac-01",
    "lostConnections": "2586"
}
currently_connected: ConnectionStatus[source]
instance: str[source]
lost_connections: int[source]
classmethod from_json(json: dict[str, str]) LostConnectionsResponse[source]

Response from the endpoint in getLostConnectionsReport.

Parameters:

json (dict[str, str]) – Input json

Returns:

Output dataclass

Return type:

LostConnectionsResponse

__str__() str[source]

Generate a display string for the response.

Returns:

“Lost connections: {lost_connections}. Connected: {connected}”

Return type:

str

class epicsarchiver.statistics.models.stat_responses.StorageRatesResponse[source]

Bases: BaseStatResponse

Return a list of PVs sorted by the no. of connection drops.

Example:

{
    "pvName": "TS2-010CRM:EMR-XRS-001:mca1",
    "storageRate_MBperDay": "1099.2894956029622",
    "storageRate_KBperHour": "46903.01847905972",
    "storageRate_GBperYear": "391.8365877881653"
}
mb_per_day: float[source]
kb_per_hour: float | None[source]
gb_per_year: float | None[source]
classmethod from_json(json: dict[str, str]) StorageRatesResponse[source]

Response from the endpoint in getStorageRateReport.

Parameters:

json (dict[str, str]) – _description_

Returns:

_description_

Return type:

StorageRatesResponse

__str__() str[source]

Generate a display string for the response.

Returns:

“Storing {self.mb_per_day} MB per day.”

Return type:

str

class epicsarchiver.statistics.models.stat_responses.BothArchiversResponse[source]

Bases: BaseStatResponse

Response of pvs archived in two archivers.

hostname: str[source]
other_hostname: str[source]
__str__() str[source]

Generate a display string for the response.

Returns:

“In both {hostname} and {other_hostname}”

Return type:

str

class epicsarchiver.statistics.models.stat_responses.PausedPVResponse[source]

Bases: BaseStatResponse

Response of pvs paused.

instance: str[source]
modification_time: str[source]
classmethod from_json(json: dict[str, str]) PausedPVResponse[source]

Response from the endpoint in getPausedPVsReport.

Parameters:

json (dict[str, str]) – Input json format

Returns:

Output dataclass

Return type:

PausedPVResponse

__str__() str[source]

Generate a display string for the response.

Returns:

“{pv} is paused”

Return type:

str

class epicsarchiver.statistics.models.stat_responses.ConfiguredStatus[source]

Bases: str, enum.Enum

Represents if a pv is configured in gitlab, channelfinder or archived only.

Archived = 'Archived but not in config.'[source]
ConfiguredGitlab = 'Configured in Gitlab but not in archiver.'[source]
ConfiguredChannelFinder = 'Configured in ChannelFinder but not in archiver.'[source]
class epicsarchiver.statistics.models.stat_responses.NoConfigResponse[source]

Bases: BaseStatResponse

Response of pvs archived but not in configuration files.

configured_status: ConfiguredStatus[source]
alias: list[str][source]
alias_archived: list[str][source]
__str__() str[source]

Generate a display string for the response.

Returns:

f”Archived but not in config.”

Return type:

str

__hash__() int[source]

Hash method for NoConfigResponse.

Returns:

returns the has of the string representation.

Return type:

int

class epicsarchiver.statistics.models.stat_responses.Ioc[source]

Minimal info on an Ioc.

hostname: str[source]
name: str[source]
classmethod from_channel(channel: epicsarchiver.statistics.services.channelfinder.Channel) Ioc[source]

Gets IOC info from a channel.

Parameters:

channel (Channel) – Input channel

Returns:

The Ioc matched to the channel

Return type:

Ioc

epicsarchiver.statistics.models.stat_responses.UNKNOWN_IOC: Ioc[source]
class epicsarchiver.statistics.models.stat_responses.NameCheckResponse[source]

Bases: BaseStatResponse

Response of pvs paused.

suffix: str | None[source]
internal: bool[source]
__str__() str[source]

Generate a display string for the response.

Returns:

“{pv} has a name discouraged to be archived,

as {it ends with {suffix}} {it contains #}”

Return type:

str