api.common
AmbiguousParameters
ClsNotRegisteredException
ConfigException
FaultyRoleException
InsufficientParameters
InvalidParameters
NonStrKeyException
NotFound
SerializationException
decorators
async_router_decorator(role, *, func)
Async Router decorator
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role |
ROLE_TYPE
|
role of this process |
required |
func |
function to be queued, or called, based on role |
required |
Raises:
AssertionError: if wrapped function is not async
TimeoutError: if the async process took more than 600sec to complete
FaultyRoleException: if role is set to other than all
or server
Source code in api/common/decorators.py
data_decorator(role)
data decorator
Extensively used in api.common.data_handlers. Most of the business logic, including data fetching, serialization, etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role |
ROLE_TYPE
|
Role of this process |
required |
Raises:
Type | Description |
---|---|
ImportError
|
Celery not installed, but role is set to either |
Source code in api/common/decorators.py
router_decorator(role, *, func, queue_as_async=False, **kwargs)
Sync Router Decorator
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role |
ROLE_TYPE
|
role of this process |
required |
func |
function to be queued, or called, based on role |
required | |
queue_as_async |
bool
|
if set, will return id of the task, instead of task itself. Query the id for result. |
False
|
Raises:
Type | Description |
---|---|
FaultyRoleException
|
if role is set to |
FaultyRoleException
|
if role is set to other than |
Source code in api/common/decorators.py
exceptions
AmbiguousParameters
ClsNotRegisteredException
ConfigException
FaultyRoleException
InsufficientParameters
InvalidParameters
NonStrKeyException
NotFound
logger
Logging module.
if LOGGER_DIR
is defined in config, will also use TimedRotatingFileHandler
to write
to LOGGER_DIR
.
storage
get_filename(*args, ext=None)
Get a hashed filename based on positional arguments.
Will also honor SIIBRA_API_SHARED_DIR
in config, if defined.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
List[str]
|
positional arguments |
()
|
ext |
str
|
extension |
None
|
Returns:
Type | Description |
---|---|
str
|
hashed path, in the form of |