The default DBOS app version is computed by the compute_app_version method in dbos/_dbos.py. This method generates an MD5 hash of the source code for all registered workflow functions (sorted for stability) and appends the DBOS framework version string.
The method includes graceful error handling: if it cannot retrieve workflow source code (e.g., when inspect.getsource() fails in certain deployment environments), it catches the exception and returns "DEFAULT_VERSION" as a fallback. A warning is logged: "Could not get workflow source code to compute an application version, defaulting application version to 'DEFAULT_VERSION'. Set a custom version through the 'application_version' field in DBOSConfig".
You can manually set a custom app version through the application_version field in DBOSConfig. This app version is distinct from the release version and only changes when your workflow code or the DBOS framework version changes, ensuring compatibility and recoverability.
The current application version is available via DBOS.application_version.
Application Version Management#
Application versions are automatically registered on startup with SystemDatabase.create_application_version(). The system maintains version metadata in the application_versions table, which tracks each version's unique identifier, name, and timestamp.
VersionInfo#
Version information is represented by the VersionInfo TypedDict with the following fields:
version_id(str): Unique identifier for the versionversion_name(str): Human-readable version nameversion_timestamp(int): Timestamp in milliseconds when the version was last set as latestcreated_at(int): Timestamp in milliseconds when the version was first registered (immutable)
Note: The created_at field is immutable and set when a version is first registered on startup. The version_timestamp field is updated whenever set_latest_application_version is called to make that version the latest. This distinction allows tracking both when a version was created and when it was last promoted to latest.
DBOS Class Methods#
The DBOS class provides the following methods for managing application versions:
DBOS.list_application_versions() -> List[VersionInfo]: Returns all application versions ordered by timestamp descendingDBOS.get_latest_application_version() -> VersionInfo: Returns the latest application version (highest timestamp)DBOS.set_latest_application_version(version_name: str) -> None: Sets a version as latest by updating its timestamp to the current timeDBOS.list_application_versions_async() -> List[VersionInfo]: Async version oflist_application_versionsDBOS.get_latest_application_version_async() -> VersionInfo: Async version ofget_latest_application_versionDBOS.set_latest_application_version_async(version_name: str) -> None: Async version ofset_latest_application_version
DBOSClient Methods#
The same application version management methods are available on the DBOSClient class:
DBOSClient.list_application_versions() -> List[VersionInfo]DBOSClient.get_latest_application_version() -> VersionInfoDBOSClient.set_latest_application_version(version_name: str) -> NoneDBOSClient.list_application_versions_async() -> List[VersionInfo]DBOSClient.get_latest_application_version_async() -> VersionInfoDBOSClient.set_latest_application_version_async(version_name: str) -> None
The latest version is determined by the highest version_timestamp value in the application_versions table. When set_latest_application_version is called, it updates the timestamp of the specified version to the current time, making it the latest version.