Script Usage

Before running the XTrace SDK, ensure that you have set up the environment correctly.

Initialize Environment

Use init.py to set up the environment for the XTrace SDK:

python xtrace_sdk/scripts/init.py aSuperSafeAESKey paillier data/exec_context

This command initializes the environment with a secure AES key, sets up the Paillier encryption, and specifies the directory for execution context data.

The aSuperSafeAESKey should be replaced with your actual AES key, and data/exec_context is the directory where execution context data will be stored.

The paillier argument specifies the type of homomorphic encryption to use, which in this case is Paillier encryption.

Ensure that the directory data/exec_context exists or is created by the script. Execution context contains sensitive cryptographic keys and should be kept secure.

Use Execution Context

Once the environment is initialized, you can use the execution context with your instance of data loaders and retrievers.

For example, suppose you have set up execution context at ~/data/exec_context and you want to use it with a data loader that loads data to XTrace:

from xtrace_sdk.data_loaders.base import DataLoaderBase
from xtrace_sdk.integrations.xtrace import XTraceStorage

data_loader = DataLoaderBase._from_path('data/exec_context', XTraceStorage(api_key='your_api_key'))

You can also use the execution context to construct a retriever:

from xtrace_sdk.retrievers import SimpleRetriever

retriever = SimpleRetriever._from_path('data/exec_context', XTraceStorage(api_key='your_api_key'))

Note that execution context should be consistent across your data loaders and retrievers to ensure secure and efficient data processing.