Skip to main content

Configuration and application lifecycle

Keyword arguments override environment variables. Unknown arguments fail immediately, including while disabled.

ArgumentEnvironment variableDefault
enabledSYNAPSYS_ENABLEDTrue
core_urlSYNAPSYS_CORE_URLrequired when enabled
core_tokenSYNAPSYS_CORE_TOKENnone; missing token warns
worker_nameSYNAPSYS_WORKER_NAMErequired when enabled
hostSYNAPSYS_HOSTmachine hostname
heartbeat_intervalSYNAPSYS_HEARTBEAT_INTERVAL"5s"; positive whole seconds
fail_fastSYNAPSYS_FAIL_FASTFalse
connect_timeoutSYNAPSYS_CONNECT_TIMEOUT"2s"
request_timeoutSYNAPSYS_REQUEST_TIMEOUT"5s"
shutdown_timeoutSYNAPSYS_SHUTDOWN_TIMEOUT"10s"
capture_consoleSYNAPSYS_CAPTURE_CONSOLETrue
log_levelSYNAPSYS_LOG_LEVEL"info"
loggernonelogging.getLogger("basamento_synapsys")

Durations carry units ("250ms", "5s", "2m", "1h"). A numeric value means milliseconds; a unitless string is rejected. enabled=False is a runtime no-op: no Core validation, network access, heartbeat thread, or stream replacement.

Start and stop​

The SDK does not install signal handlers. Attach it to the shutdown path the application already owns:

try:
worker.start()
run_application()
finally:
worker.stop()

with worker: provides the same synchronous lifecycle. Async applications use await worker.start_async() and await worker.stop_async(), or async with worker. Async startup avoids blocking the application event loop and allows async process bodies to reuse loop-bound resources. Sync process bodies always run on dedicated threads.

stop() is idempotent and non-throwing. It stops normal heartbeats, requests every active process to stop, waits up to shutdown_timeout, sends one best-effort final snapshot whose commands are ignored, then restores capture. A body that ignores cancellation is named and left running; Python cannot safely terminate its thread.

Current 0.2.0 caveat: the final request uses request_timeout, but is not shortened to a smaller remaining shutdown budget. See current client differences.

Application and process logging​

SDK diagnostics use Python logging and begin with [Synapsys] . Healthy heartbeats are silent. Availability transitions are logged once; the token is never exposed.

Process stdout and stderr are tee-captured only within an active execution. Capture is interpreter-wide, context-attributed, bounded, and restored only if the SDK still owns the streams. Logging handlers bound to an older stream or direct file descriptor bypass it. Disable this data path independently with capture_console=False.

For tests, call the original business function directly and construct the worker with enabled=False. See process registration and examples.