test.lock

test.lock(timeout, requested_key)

Establish a shared lock to the resource.

Parameters
  • timeout (Union[float, Literal[“default”]], optional) – Absolute time period (in milliseconds) that a resource waits to get unlocked by the locking session before returning an error. Defaults to “default” which means use self.timeout.

  • requested_key (Optional[str], optional) – Access key used by another session with which you want your session to share a lock or None to generate a new shared access key.

Returns

str – A new shared access key if requested_key is None, otherwise, same value as the requested_key