Keeping service data between reloads

Services can keep data between reloads in several ways. Note than if a service is purged, its data is deleted (both from the data directory and the registry).

Keeping data in the node registry

Python SDK has no built-in methods to work with the registry, however the registry can be still accessed under the local bus with calls to eva.registry.

Available registry RPC methods are described at, section 3.3 (Mandatory methods).

The keys must be kept under eva/svc_data/<SVC_ID> only.

The following example contains a simple service which operates with data from the registry:


__version__ = '0.0.1'

import evaics.sdk as sdk
import busrt
from evaics.sdk import pack, unpack

def mark_set_up(svc_id, rpc):
    payload = dict(key=f'eva/svc_data/{svc_id}/setup',
                   value=dict(completed=True))'eva.registry', busrt.rpc.Request('key_set',

def run():
    info = sdk.ServiceInfo(author='Bohemia Automation',
                           description='Registry example',
    service = sdk.Service()

    # get registry "setup" key
    payload = dict(key=f'eva/svc_data/{}/setup')
        result = unpack(
        if result.get('completed') is not True:
            mark_set_up(, service.rpc)
    except busrt.rpc.RpcException as e:
        if e.rpc_error_code == sdk.ERR_CODE_NOT_FOUND:
            # there is no key yet, create it
            mark_set_up(, service.rpc)
    # increase service startup counter
    payload = dict(key=f'eva/svc_data/{}/counter')
    counter = unpack('eva.registry',
                             pack(payload))).wait_completed().get_payload())'The service has been started {counter} time(s)')


Keeping data in files

The field “data_path” of the “service” object contains path to a directory where the service can store its data.

service = sdk.Service()
data_path = service.data_path

If the data path is None, it means that the service is started under “nobody” user and can not use the data path.


To avoid permission problems, the service should always use its data path only after “service.drop_privileges()” method is called.