yr.Config

Contents

yr.Config#

class yr.Config(function_id: str = '', cpp_function_id: str = '', cpp_auto_function_name: str = '', function_name: str = '', server_address: str = '', ds_address: str = '', is_driver: bool = True, log_level: str | int = '', invoke_timeout: int = 900, local_mode: bool = False, code_dir: str = '', connection_nums: int = 100, recycle_time: int = 2, in_cluster: bool | None = None, job_id: str = '', tls_config: ~yr.config.UserTLSConfig | None = None, auto: bool = False, deployment_config: ~yr.config.DeploymentConfig | None = None, rt_server_address: str = '', log_dir: str = './', env_file: str = '', log_file_size_max: int = 0, log_file_num_max: int = 0, log_flush_interval: int = 5, runtime_id: str = 'driver', max_task_instance_num: int = -1, load_paths: list = <factory>, rpc_timeout: int = 1800, enable_mtls: bool | None = None, enable_tls: bool | None = None, private_key_path: str = '', certificate_file_path: str = '', verify_file_path: str = '', private_key_paaswd: str = '', http_ioc_threads_num: int = 400, server_name: str = '', ns: str = '', tenant_id: str = '', enable_metrics: bool = True, custom_envs: ~typing.Dict[str, str] = <factory>, master_addr_list: list = <factory>, working_dir: str = '', enable_ds_encrypt: bool = False, ds_public_key_path: str = '', runtime_public_key_path: str = '', runtime_private_key_path: str = '', num_cpus: int | None = None, runtime_env: ~typing.Dict[str, ~typing.Any] | None = None, log_to_driver: bool = False, dedup_logs: bool = True, auth_token: str = '')[source]#

Bases: object

YR API config.

Attributes

auth_token

auto

Auto start distribute-executor when yr.init, and auto stop distribute-executor when yr.finalize.

certificate_file_path

Client certificate file path.

code_dir

The code directory path that must be configured at runtime initialization.

connection_nums

Http client connection nums.

cpp_auto_function_name

Use default function for cpp.

cpp_function_id

Cpp function id which you deploy, get default by env YR_CPP_FUNCID.

dedup_logs

If True, deduplicates logs that appear redundantly across multiple processes, default True.

deployment_config

When auto=True needed, use to define deployment detail.

ds_address

DataSystem address, get default by env YR_DS_ADDRESS.

ds_public_key_path

The path of worker public key for data system tls authentication, if enable_ds_encrypt is true and the ds_public_key_path is empty, an exception will be thrown.

enable_ds_encrypt

Whether to enable data system TLS authentication.

enable_metrics

Whether to enable metric collection.

enable_mtls

Whether to enable client two-way authentication, default is False.

enable_tls

env_file

Path to environment variable file (.env format) to load at startup.

function_id

Function id which you deploy, get default by env YRFUNCID.

function_name

Function name which need in runtime.

http_ioc_threads_num

HTTP link worker thread.

in_cluster

False.

invoke_timeout

Http client read timeout(sec), default is 900.

is_driver

Only False when initialize in runtime, default is True.

job_id

Auto generated by init.

local_mode

Run code in local, default is False.

log_dir

Log directory, specifies the path where log files will be stored.

log_file_num_max

Max number for log file, default is 0 (If the default value is 0, it will eventually be set to 20).

log_file_size_max

Max size for log file, default is 0 (If the default value is 0, it will eventually be set to 40).

log_flush_interval

Interval for log flush, default is 5.

log_level

YR api log level have ERROR/WARNING/INFO/DEBUG, default is WARNING.

log_to_driver

If True, the output from all of the job processes on all nodes will be directed to the driver, default is False.

max_task_instance_num

The maximum number of instances of stateless function.

ns

Namespace, used to organize and isolate configurations or resources.

num_cpus

private_key_paaswd

Client private key encryption password.

private_key_path

Client private key file path.

recycle_time

Instance recycle period(sec).

rpc_timeout

The timeout used for RPC.

rt_server_address

Runtime server, keep default in driver.

runtime_env

runtime_id

Runtime id, keep default in driver.

runtime_private_key_path

The path of client private key for data system tls authentication.

runtime_public_key_path

The path of client public key for data system tls authentication.

server_address

System cluster address, get default by env YR_SERVER_ADDRESS.

server_name

Server name, used to identify and connect to a specific server instance.

tenant_id

tls_config

For out cluster https ssl.

verify_file_path

Server certificate file path.

working_dir

Specify the user code or the local path location that it depends on, absolute path, and ensure that it exists on all nodes in the cluster.

load_paths

Code loading path.

custom_envs

Used to set custom environment variables for the runtime.

master_addr_list

Function master address list.

Methods