rs_server_common/utils/utils2.md¶
This module is used to share common functions between apis endpoints. Split it from utils.py because of dependency conflicts between rs-server-catalog and rs-server-common.
AuthInfo
dataclass
¶
User authentication information in KeyCloak.
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
S3Credentials
dataclass
¶
S3 object storage credentials.
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
decorate_sync_async(decorating_context, func)
¶
Decorator for both sync and async functions, see: https://stackoverflow.com/a/68746329
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
filelock(func, env_var)
¶
Avoid concurrent writing to the database using a file lock.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
The function to wrap with a file-based lock. |
required | |
env_var
|
str
|
environment variable that defines the folder where to save the lock file. |
required |
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
read_response_error(response)
¶
Read and return an HTTP response error detail.
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
read_streaming_response(response)
async
¶
Read a json-formatted streaming response content