Skip to content

Custom component Python-API reference

This section provides the API specifications for custom component development in the Python language. See below for the custom component development procedures.

Python Custom Component Creation

speedbeesynapse.component.base#

Hive Componentbased Module

This is a module to import when implementing SpeeDBee Synapse components in Python.

HiveComponentBase Objects#

class HiveComponentBase()

Base Class for Components

All components must inherit this class in their definitions.

Attributes:

  • in_portX HiveInPort - Instance variable representing the IN Port no. X. Practically, where X is a number such as in_port1 and in_port2.
  • out_portX HiveOutPort - Instance variable representing the OUT Port no. X. Practically, where X is a number such as out_port1 and out_port2.

premain#

def premain(param: str | dict) -> typing.Optional[ErrorInfoBase]

Function Called Immediately before Component Main Processing Called when the component starts, immediately before main processing. Read parameters here to perform processing such as column creation or custom initialization.

Note, however, that the processing with this function is under exclusive control in all components, and so if the processing takes a long time, premain of other components cannot operate during that time. Instead, creating the column here is faster than creating it in the main process.

If the processing such as initialization ends normally, this method should exit without returning anything. The main method is then called.

If the component cannot continue to run for some reason, return an instance of the class that inherits ErrorInfoBase. The content of the error then appears on the screen and the component stops (without calling the main or postmain method).

The definition of this method is not required.

Arguments:

  • param str | dict - Parameters to the component

Returns:

  • None - Normal end
  • ErrorInfoBase - Error object inheriting ErrorInfoBase returned if the component cannot start for some reason

main#

def main(param: str | dict)

Component Main Processing Function

This is a method to implement the main processing of the component.

For classes that inherit HiveComponentBase, this method must be overridden and implemented.

The end of this function means that the component has finished processing. In normal end, no return is required.

If terminated with an error, it should return an instance of a class that inherits ErrorInfoBase. The returned instance information is displayed as the stop reason on the screen.

If an exception is raised outside this method, the component stops with an unknown error. If that behavior is undesirable, catch the exception and continue the processing, or return an instance of a class that inherits ErrorInfoBase and exit this method.

Arguments:

  • param str | dict - Parameters to the component

Returns:

  • None - Normal end
  • ErrorInfoBase - Error object inheriting ErrorInfoBase returned if the component cannot start for some reason

postmain#

def postmain(param: str | dict)

Function Called Immediately after Component Main Processing Called immediately after the main processing function finishes, such as when the component stops.
This is always called even when the main processing ends due to an error or the like. Therefore, it is assumed that, for example, used resources are released.
The definition of this method is not required.

Arguments:

  • param str | dict - Parameters to the component

is_runnable#

def is_runnable()

Component Sustainability Determination

This determines whether the main processing of this component is to continue. The component must call this function periodically (at least within 5 seconds) to confirm that it can continue with the main processing. When this function returns True, the main processing is continuable; when it returns False, the main process must end as soon as possible.

Returns:

  • True if continuable, False if a request to stop the component issued

get_timestamp#

def get_timestamp() -> int

Current Time Acquisition

This gets the current time expressed in Unix time in nanoseconds.

Returns:

  • Data timestamp.

notify_stop#

def notify_stop()

Component Stop Request

Called when this component receives a stop request from the system.
For classes that inherit HiveComponentBase, this method must be overridden according to need.
When the method is called, the main processing of the component must be stopped immediately.

If is_runnable() is periodically called in the main process to check whether it can continue, the implementation of this function is not required.

register_status#

def register_status(status: RunningStatus)

Status Information Registration

Registers the status with error information added

Arguments:

  • status - Status object with error information registered

Status#

def Status()

Status Information Generation

This generates a status object to register error information.

interval_iteration#

def interval_iteration(interval, base_time=0)

Iterator for Periodic Processing

This is an iterator to perform some processing on the component at fixed time intervals.
It yields values from the iterator starting at the specified base time and at the specified periodic interval. However, the actual timing of the start of processing does not exactly coincide with the scheduled time and is affected by the OS, device load, and clock accuracy.

In addition, if user-implemented periodic processing takes longer time than the periodic interval, the next periodic processing may be skipped. There, the number of times the periodic processing is skipped is taken as the second element of yield.

On receipt of a component stop request, this function ends the iteration.

Arguments:

  • interval - Periodic processing interval (in nanoseconds)
  • base_time - Unix time representing the iteration start reference time (in nanoseconds)

Yields:

  • [0] - Unix time representing the time for the scheduled iteration execution at that time (in nanoseconds)
  • [1] - Number of previous iterations skipped

Examples:

This is usable as an iterator in a for statement as follows.

for [ts, skip] in self.interval_iteration(1000000000):
    #
    # Processing to be executed periodically
    #
In this example, the portion of "processing to be executed periodically" is executed every one second.

save_running_info#

def save_running_info(key: str, data: bytes)

Saving Arbitrary Information

This records an arbitrary sequence of bytes into the system.
The saved data is referable with load_running_info() on the same component even after the system is restarted. The data is saved as different data depending on the specified key. Therefore, to save multiple data sets, use different keys.

Arguments:

  • key str - Key to identify the information to be saved
  • data bytes - Information of bytes type to be saved

Raises:

  • HiveApiError - Various errors in the Hive framework

load_running_info#

def load_running_info(key: str) -> typing.Optional[bytes]

Loading Arbitrary Information

Arguments:

  • key str - Key to identify the information to be loaded

Returns:

  • data - Data of byte type loaded
  • None - No data

Raises:

  • HiveApiError - Various errors in the Hive framework

get_common_variable#

def get_common_variable(varname: str) -> typing.Optional[str]

Getting Component Default Variable

Arguments:

  • varname str - Name of the common variable to get

Returns:

  • Value of the specified common variable
  • None - Specified variable not found

Raises:

  • HiveApiError - Various errors in the Hive framework

create_lock#

def create_lock(key: typing.Union[str, bytes],
                interbase: bool = False,
                timeout: typing.Optional[float] = None,
                auto_unlock_at_stop: bool = True,
                unlock_by_any_threads: bool = False) -> SynapseLock

Lock acquiring method for mutual exclusion inter-component.

This method acquires a mutex lock for a resource identifed by key. Only one thread can get a lock of a `key.

This method acquires a lock for exclusive control of the resource identified by the string or byte string specified by the key argument. A lock with the same key can only be acquired by one thread. The acquired lock can be released with the unlock() method of the returned lock object. Alternatively, if this method is used in a with statement, the lock will be released when the scope is exited. The lock will also be automatically released if the component instance signel while the lock is still acquired.

If the argument interbase is true, mutual exclusion is possible between different component bases by using the same key. In this case, mutual exclusion with custom components using the C-API hive_lock() is also available. If it is false, mutual exclusion is possible only within the same component base.

If an external component instance has already acquired the lock when this method is called, execution will be blocked within the method. The maximum blocking time can be specified in seconds using the timeout argument. If the lock cannot be acquired after the timeout period has elapsed, a HiveTimeoutError exception will be thrown. If a value less than or equal to 0 is specified for timeout, execution will not be blocked and an immediate timeout will occur if the lock cannot be acquired. If None is specified for timeout, the method will continue to wait until the lock is acquired without timing out.

If a running component instance receives a stop request while waiting to acquire a lock, it will throw a HiveLockCanceled exception regardless of the timeout period.

Even if it is the same thread, it cannot lock the same key twice. In that case, it will continue to block until it times out or receives a stop request.

When using from within the main function, you should generally specify the default values for auto_unlock_at_stop and unlock_by_any_threads. When using from a component method, the component may not be running, so you must set auto_unlock_at_stop to False.

Arguments:

  • key str|bytes - String or byte sequence for identifying lock context.
  • interbase bool - Set True if the mutual exclusion affects over different component-base.
  • timeout float|None - timeout for waiting other component or thread to lock.
  • auto_unlock_at_stop bool - Set True to automatically release the lock when the component stops.
  • unlock_by_any_threads bool - Set True to allow lock release from different threads within the same instance.

Returns:

SynapseLock object.

Raises:

  • HiveTimeoutError - Could not take lock in a specified timeout.
  • HiveLockCanceled - Stop request received before to take a lock.
  • HiveApiError - Hive errors.

Examples:

Use with statement like following.

while self.is_runnable();
    try:
        with self.create_lock('lock-serial-device', False, 10.0):
            # 
            # Procedure which is need mutual exclusion.
            # 
    except HiveTimeoutError as exc:
        self.log.debug('wait lock')
        continue
    except HiveLockCanceled:
        return

DataType Objects#

class DataType(IntEnum)

Data type Definition Enum Class

This is an Enum class that indicates the data type. Use this attribute as the data type to be specified at the time of column creation.

Attributes:

  • NONE(0) - Undefined type not matching any type
  • BOOLEAN(1) - Boolean type
  • INT8(2) - 8-bit signed integer type
  • INT16(3) - 16-bit signed integer type
  • INT32(4) - 32-bit signed integer type
  • INT64(5) - 64-bit signed integer type
  • UINT8(6) - 8-bit unsigned integer type
  • UINT16(7) - 16-bit unsigned integer type
  • UINT32(8) - 32-bit unsigned integer type
  • UINT64(9) - 64-bit unsigned integer type
  • FLOAT(10) - 32-bit floating-point number type
  • DOUBLE(11) - 64-bit floating-point number type
  • STRING(13) - String
  • BINARY(14) - Binary
  • FILE(16) - File

ColumnOption Objects#

class ColumnOption()

Column Options

Optional configuration for OUT Port columns

Attributes:

  • column_type ColumnType - Column type (LOW, MIDDLE, HIGH)
  • samplingrate float - Sampling rate
  • compression_unit int - Compression unit
  • fixedsize_binary int - Column data size
  • max_binarysize int - Maximum length of LO variable-length type data

FileTypeMetaInfo Objects#

class FileTypeMetaInfo(typing.TypedDict)

File Type Data Meta Information

This class contains the meta information of the file to be registered in a file type column. All members are optional.

Attributes:

  • media_type ColumnType - Media type (e.g., application/json and text/csv are settable)
  • filename float - File name hint (this file name is used if connected to a file emitter)
  • begin_timestamp int - Leading time in the time range of the data contained in this file (Unix time in nanoseconds)
  • end_timestamp int - Last time in the time range of the data contained in this file (Unix time in nanoseconds)

OutColumn Objects#

class OutColumn()

OUT Port Column

For example, data registration for an OUT Port column is done through an instance of this class.

Attributes:

  • name str - Column name specified at creation time
    Note: For information about characters that cannot be used, please refer to "About Column Names That Cannot Be Used" below
  • data_type DataType - Data type of the column specified at creation time
  • data_array int - Number of elements in the column specified at creation time: 0 for the scalar type
  • options ColumnOption - Column option specified at creation time

About Column Names That Cannot Be Used: The following characters cannot be used in column names

  • \ - backslash
  • / - slash
  • * - asterisk
  • ? - question mark
  • " - double quote
  • < > - angle brackets
  • | - pipe
  • ' - single quote
  • - space

insert#

def insert(*args) -> None

Value Registration in Column

This registers the timestamp ts value specified for this column.
If the timestamp is omitted, the current time is assumed.
For data, pass the data that matches the data type at the time of column creation. If mismatching, the passed data will be converted when it is implicitly convertible, but otherwise an error is raised.

Arguments:

  • data - Value to register
  • ts - Timestamp to register this value

Raises:

  • TypeError - Incorrect data not matching the data type of this column passed
  • InvalidTimestamp - Timestamp is too far from the current time or is in the past of a previously registered timestamp

open_file#

@contextmanager
def open_file()

New File Creation

This opens a new file to be registered with a column created as a file type and returns its file object.

Returns:

  • FileObject - Opened file object

Raises:

  • TypeError - This method called for a non-FILE type column
  • HiveApiError - Various errors in the Hive framework
  • OSError - Various errors related to file open

Examples:

This is usable in a with clause as follows.

file_column = self.out_port1.Column("clmfile", DataType.FILE)
with file_column.open_file() as fo:
    fo.write("filedata - line 1\n".encode('utf-8))
    fo.write("filedata - line 2\n".encode('utf-8))
    fo.write("filedata - line 3\n".encode('utf-8))

    file_column.insert_file(fo, ts)

insert_file#

def insert_file(fo: typing.IO[typing.AnyStr],
                ts: int = 0,
                meta: typing.Optional[FileTypeMetaInfo] = None) -> None

File DB Registration

This registers a file in the file type column.

Arguments:

  • file - Opened file object
  • ts - Timestamp to register this value
  • meta - Meta information of the file to be registered

Raises:

  • ValueError - File targeted for registration already closed
  • HiveApiError - Various errors in the Hive framework
  • OSError - Various errors related to file operations

insert_file_move#

def insert_file_move(pathlike,
                     ts: int = 0,
                     meta: typing.Optional[FileTypeMetaInfo] = None) -> None

Existing File DB Registration (Move)

This registers a file already created in the file type column. The specified file is moved to the DB management directory. Note that no file remains in the path specified as an argument. This cannot register a directory.

Arguments:

  • pathlike - Object representing the path of the file to be registered
  • ts - Timestamp to register this value
  • meta - Meta information of the file to be registered

Raises:

  • ValueError - Specified path
  • HiveApiError - Various errors in the Hive framework
  • OSError - Various errors related to file operations

insert_file_copy#

def insert_file_copy(pathlike,
                     ts: int = 0,
                     meta: typing.Optional[FileTypeMetaInfo] = None) -> None

Existing File DB Registration (Copy)

This registers a file already created in the file type column. The specified file is copied to the DB's managed directory, and the copy destination file is registered in the column. No further reference is made to the original file path specified as an argument. This cannot register a directory.

Arguments:

  • pathlike - Object representing the path of the file to be registered
  • ts - Timestamp to register this value
  • meta - Meta information of the file to be registered

Raises:

  • ValueError - Specified path
  • HiveApiError - Various errors in the Hive framework
  • OSError - Various errors related to file operations

insert_file_ref#

def insert_file_ref(pathlike,
                    ts: int = 0,
                    meta: typing.Optional[FileTypeMetaInfo] = None) -> None

Existing File DB Registration (Reference)

This registers a file already created in the file type column. The specified file is registered with its path in the column. Therefore, if the file is deleted, the information in this column will no longer be referable from other components. This cannot register a directory.

Arguments:

  • pathlike - Object representing the path of the file to be registered
  • ts - Timestamp to register this value
  • meta - Meta information of the file to be registered

Raises:

  • ValueError - Specified path
  • HiveApiError - Various errors in the Hive framework
  • OSError - Various errors related to file operations

AggregationType Objects#

class AggregationType(IntEnum)

Aggregation Type Definition Enum Class

Represents the aggregation type of the column data retrieved from the IN Port

Attributes:

  • NONE(0) - None
  • OLDER(1) - Older
  • NEWER(2) - Newer
  • COUNT(3) - Count
  • SUM(4) - Sum
  • SUMSQ(5) - Sum of squares
  • SUMSQD(6) - Sum of squared deviation
  • MIN(7) - Minimum
  • MAX(8) - Maximum
  • RANGE(9) - Range
  • MEAN(10) - Arithmetic mean value
  • VAR(11) - Variance
  • STDEV(12) - Standard deviation
  • UVAR(13) - Unbiased variance
  • USTDEV(14) - Sample unbiased standard deviation
  • STDER(15) - Standard error
  • CV(16) - Coefficient of variation
  • MEDIAN(17) - Median
  • QUARTMIN(18) - Quartile
  • QUART1(19) - Quartile
  • QUART2(20) - Quartile
  • QUART3(21) - Quartile
  • QUARTMAX(22) - Quartile
  • MODE(23) - Mode value
  • MODECOUNT(24) - Mode value count
  • MDEV(25) - Mean deviation
  • HMEAN(26) - Harmonic mean
  • GMEAN(27) - Geometric mean
  • KURT(28) - Kurtosis
  • SKEW(29) - Skewness

AggregationTypeSet Objects#

class AggregationTypeSet()

A set of flags indicating which statistics information is enabled when getting data from IN Port columns.

Pass the AggregationType attribute to the test() method to confirm that this statistic information is enabled. It is also possible to get a list of enabled statistics information by using an iterator.

Examples:

Pass the AggregationType attribute to the test() method to confirm that this statistic information is enabled.

if a_type_set.test(AggregationType.MAX):
  pring(max: ON")
else:
  pring(max: OFF")

It is also possible to get a list of enabled statistics information by using an iterator.

for a_type in aggregation_type_set:
    print(a_type.name)

InColumn Objects#

class InColumn()

IN Port Column

This class supports only information acquisition. Operations such as data registration with columns are not supported.

Attributes:

  • source_name str - Name of the component that generated the column
  • data_name str - Name of the column
  • data_type DataType - Column type information
  • array_size int - Number of array elements in the column (0 for the scalar type)
  • raw_data bool - Boolean indicating whether to include raw data when getting data from the column
  • stat_type_set AggregationTypeSet - Set of flags indicating which statistics information is enabled when getting data from the column
  • output_name str - Output name of the column. None by default

get_latest_value#

def get_latest_value(use_storage: bool = False) -> (int, typing.Any)

Latest Column Value Acquisition

This reads the latest data registered in the column and returns its timestamp and a tuple of values.

Arguments:

  • use_storage bool - Note: Not supported at this time
    Specify True to perform the reading from data persisted to storage.
    If False, it reads data from memory only, and may return No data available even if persisted data is present.
    Even if True, it does not access storage if the latest data is present in memory.

Returns:

  • (0, None): No value readable from the column
  • (>0, !=None): Read timestamp and values

Raises:

  • HiveApiError - Various errors in the Hive framework

InPortReader Objects#

class InPortReader()

IN Port Reader

This class reads data from the IN Port column.
Do not directly instantiate this class; instead, use the self.in_portX.ContinuousReader() or self.in_portX.TimeRangeReader() function.

read#

def read() -> typing.Optional[HiveWindowData]

Reading Column Data

This reads column data from the IN Port.

Returns:

  • HiveWindowData - Read window data returned.
  • None - None returned if data is not readable at the time.

Raises:

  • HiveApiError - Various errors in the Hive framework

HiveOutPort Objects#

class HiveOutPort()

Class Representing the OUT Port

For example, column creation for the OUT Port is done through an instance of this class.
It is not possible to instantiate this class directly. Use the attribute self.out_port1, which is accessible from the beginning when the component starts.

Column#

def Column(name: str,
           data_type: DataType,
           data_array: int = 0,
           opt: typing.Optional[ColumnOption] = None) -> OutColumn

Column Creation

This creates a column with the specified name in this OUT Port.

Arguments:

  • name - Created column name
  • data_type - Data type of the column to create
  • data_array - Number of elements in the column to create (0 for the scalar type)
  • opt - Column options

Returns:

  • OutColumn

Raises:

  • HiveApiError - Various errors in the Hive framework

register_confirmed_time#

def register_confirmed_time(ts: int = 0) -> None

Confirmed Time Registration with OUT Port

This notifies that data registration with the column of this OUT Port has been confirmed up to the specified time ts. This registration allows another component connected through a flowlink to know that data before the specified time ts can be read.

  • Note - Calling this API is not required.

Arguments:

  • ts - Time at which data registration with the column of the OUT Port has been confirmed Current time by default

HiveInPort Objects#

class HiveInPort()

Class Representing IN Port

Processing such as data acquisition from the IN Port is done through an instance of this class.

get_columns#

def get_columns() -> list[InColumn]

Column List Acquisition

Gets information in all columns connected to this IN Port

Returns:

  • list[InColumn]

ContinuousReader#

def ContinuousReader(start: int) -> InPortReader

Continuous Column Reader Generation

Generates a ContinuousReader that continuously reads data from the columns connected to this IN Port

Arguments:

  • start - Time to start reading from the IN Port (Unix time in nanoseconds)

Returns:

  • ContinuousReader

Examples:

Get and use a reader in a with clause as follows.

with self.in_port1.ContinuousReader(start=self.get_timestamp()) as reader:
    while self.is_runnable():
        window_data = reader.read()
        if not window_data:
            continue
            :

TimeRangeReader#

def TimeRangeReader(start: int, end: int) -> InPortReader

Time Range Data Reader Generation

Generates a TimeRangeReader that reads data in the specified time range from the specified column or from all columns connected to the IN Port

Arguments:

  • start - Time to start reading from the IN Port (Unix time in nanoseconds)
  • end - Time to end reading from the IN Port (Unix time in nanoseconds)
  • column - Column from which to get data (or all columns of the IN Port by default)

Returns:

  • data

Examples:

Get and use a reader in a with clause as follows.

with self.in_port1.ContinuousReader(start=self.get_timestamp()) as reader:
    for window_data in reader:
        :

RunningStatus Objects#

class RunningStatus()

add_error#

def add_error(err: ErrorInfoBase)

Error Information Registration

This registers error information with a status object. Simply registering the information with this object does not result in saving it. Finally, call HiveComponentBase.register_status to register it with the system.

Arguments:

  • err - Error information

ErrorType#

def ErrorType(error_id: str, *param_names: str)

Error Information Class Generation

This generate a class to manage error information. For the actual error information, generate an instance from the class generated by this function.

Arguments:

  • error_id - String identifying error information
  • param_names - Names of error information parameters

ErrorInfoBase Objects#

class ErrorInfoBase(Exception)

Error Information for Registration in Status

This is a class to hold the types and details of component errors.
Do not directly instantiate or inherit from this class; instead, instantiate a class generated with the ErrorType function.

Attributes:

  • errorTypeIndex int - Type of error parameters
  • params list[ErrorParam] - Error parameters

HiveLogLevel Objects#

class HiveLogLevel(IntEnum)

Log Level Type Definition Enum Class

This is an Enum class that indicates the log level type.

Attributes:

  • ERROR(0) - Error log
  • WARNING(1) - Warning log
  • INFO(2) - Normal information log
  • DEBUG(3) - Debugging log
  • TRACE(4) - Trace log

HiveLog Objects#

class HiveLog()

Log output class

get_current_level#

def get_current_level()

Log Level Acquisition

Returns:

  • HiveLogLevel - Current log level Enum

error#

def error(*msg)

Error Log Output

Arguments:

  • msg - String for log output

warning#

def warning(*msg)

Warning Log Output

Arguments:

  • msg - String for log output

info#

def info(*msg)

Normal Information Log Output

Arguments:

  • msg - String for log output

debug#

def debug(*msg)

Debugging Log Output

Arguments:

  • msg - String for log output

trace#

def trace(*msg)

Trace Log Output

Arguments:

  • msg - String for log output

exception#

def exception(exc: Exception)

Exception Dedicated Error Log Output

Arguments:

  • exc - Exception for log output

HiveWindowData Objects#

class HiveWindowData()

Window Data Class

This is a collection of data grouped into specific time units when getting column data from the IN Port. The time unit varies depending on the IN Port configuration.

Attributes:

  • time_range tuple[int:2] - Two-element tuple representing the time range for this window. The first element represents the start time and the second element represents the end time. Both are in nanoseconds.
  • window_id int - Numerical value identifying the window. Note that a different value is acquired for each window, but the number is not always incremented by one.
  • event_id int - Numerical value identifying the event range. Fixed to 0 when the event has not been defined or lies outside the event range. A value of 1 or greater is inserted during the event.
  • records list[HiveRecord] - List of records in this window
  • columns list[InColumn] - List of columns connected to the source IN Port. Same as that acquired with HiveInPort.get_columns().
  • event HiveInPortEventSetting - Event information set for the IN Port

HiveRecordType Objects#

class HiveRecordType(IntEnum)

Record Type Enum Class

This is an Enum class that indicates the record type.

Attributes:

  • RAW_DATA(0) - Raw data
  • STATISTICS(1) - Aggregate data

HiveRecord Objects#

class HiveRecord()

Record Class

This is a collection of data from the same time of day grouped when getting column data from the IN Port.
If there are data pieces in different columns with the same time, all of them will be collected into one instance. Two types of records, which are raw data and aggregate data, are identifiable with record_type.

Attributes:

  • record_type HiveRecordType - List of records in this window
  • timestamp int - Timestamp of the data contained in this record. Unix time (in nanoseconds)
  • data list[HiveRecordData] - List of data for this record

HiveRecordData Objects#

class HiveRecordData()

Record Data Class

Data of each column in a record.

Attributes:

  • value any - Actual data. A format that depends on the type of column, such as a numerical value, string, or array.
  • column InColumn - Object indicating the column of interest
  • stat_type AggregationType - Aggregation type for this data

HiveCompError Objects#

class HiveCompError()

Component Error Information Class

Component running or error information at the time of stop due to an error

Attributes:

  • error_type str - String indicating the type of error in the component
  • parameters list[any] - Additional error information

HiveCompStatus Objects#

class HiveCompStatus()

Component Status Class

Component status and error information

Attributes:

  • status str - String representing the execution status of the component
  • errors list[HiveCompError] - Component running or error information at the time of stop due to an error

HiveInPortEventSetting Objects#

class HiveInPortEventSetting()

IN Port Event Configuration Information Class

Class to hold the event information set for the IN Port Changing the attribute values of this class does not affect the actual Inport setting

Attributes:

  • source_name str - Component name that is subject to event determination
  • data_name str - Column name that is subject to event determination
  • pre_time int - Extended time range ahead of the event interval
  • post_time int - Extended time range behind the event interval

SynapseLock Objects#

class SynapseLock()

Lock object for mutual exclusion for inter-components.

The object is returned from HiveComponentBase.create_lock() method. Normally, no need to use this object. Like usage example of the create_lock() method, the lock is automatically released when the runtime exit the with statement scope. Use acquire() and release() methods of this class, in the case of not to use with statement.

acquire#

def acquire() -> None

acquire a lock.

This method returns nothing in the case of lock acquiring succeeded.

Raises:

  • HiveTimeoutError - Failed to acquire the lock within the specified timeout period.
  • HiveLockCanceled - Received a stop request for the component before acquiring the lock.
  • HiveApiError - Various errors from the Hive framework.

release#

def release() -> None

unlock.

Release lock context in the object, then make another component or thread can take lock.

HiveTimeoutError Objects#

class HiveTimeoutError(Exception)

Exception class of timeout in the case of using blocking API.

HiveLockCanceled Objects#

class HiveLockCanceled(Exception)

Exception class of cancel of lock acquiring when the component received stop request.