From 59d4daf3dea71f8152ad0c139e02fb9ff5327344 Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Thu, 28 Mar 2024 11:02:22 -0400 Subject: [PATCH] Improve docstring --- superset/db_engine_specs/base.py | 2 +- superset/utils/lock.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/superset/db_engine_specs/base.py b/superset/db_engine_specs/base.py index c2f071211cb5f..06d3491900556 100644 --- a/superset/db_engine_specs/base.py +++ b/superset/db_engine_specs/base.py @@ -2008,7 +2008,7 @@ def cancel_query( # pylint: disable=unused-argument :param query: Query instance :param cancel_query_id: Value returned by get_cancel_query_payload or set in other life-cycle methods of the query - :return: True if query cancelled successfuly, False otherwise + :return: True if query cancelled successfully, False otherwise """ return False diff --git a/superset/utils/lock.py b/superset/utils/lock.py index 0f63695792cd7..7a84278f09b76 100644 --- a/superset/utils/lock.py +++ b/superset/utils/lock.py @@ -60,6 +60,17 @@ def KeyValueDistributedLock( # pylint: disable=invalid-name ) -> Iterator[uuid.UUID]: """ KV global lock for refreshing tokens. + + This context manager acquires a distributed lock for a given namespace, with + optional parameters (eg, namespace="cache", user_id=1). It yields a UUID for the + lock that can be used within the context, and corresponds to the key in the KV + store. + + :param namespace: The namespace for which the lock is to be acquired. + :type namespace: str + :param kwargs: Additional keyword arguments. + :yields: A unique identifier (UUID) for the acquired lock (the KV key). + :raises CreateKeyValueDistributedLockFailedException: If the lock is taken. """ # pylint: disable=import-outside-toplevel from superset.commands.key_value.create import CreateKeyValueCommand