notice
This is unreleased documentation for Rasa Documentation Main/Unreleased version.
For the latest released documentation, see the latest version (3.x).
rasa.core.lock_store
LockError Objects
Exception that is raised when a lock cannot be acquired.
Attributes:
messagestr - explanation of whichconversation_idraised the error
LockStore Objects
Base class for ticket locks.
create
Factory to create a lock store.
create_lock
Create a new TicketLock for conversation_id.
get_lock
Fetch lock for conversation_id from storage.
delete_lock
Delete lock for conversation_id from storage.
save_lock
Commit lock to storage.
issue_ticket
Issue new ticket with lock_lifetime for lock associated with
conversation_id.
Creates a new lock if none is found.
lock
Acquire lock with lifetime lock_lifetimefor conversation_id.
Try acquiring lock with a wait time of wait_time_in_seconds seconds
between attempts. Raise a LockError if lock has expired.
update_lock
Fetch lock for conversation_id, remove expired tickets and save lock.
get_or_create_lock
Fetch existing lock for conversation_id.
Alternatively, create a new one if it doesn't exist.
is_someone_waiting
Return whether someone is waiting for lock for this conversation_id.
finish_serving
Finish serving ticket with ticket_number for conversation_id.
Removes ticket from lock and saves lock.
cleanup
Remove lock for conversation_id if no one is waiting.
RedisLockStore Objects
Redis store for ticket locks.
__init__
Create a lock store which uses Redis for persistence.
Arguments:
host- The host of the redis server.port- The port of the redis server.db- The name of the database within Redis which should be used by Rasa Open Source.username- The username which should be used for authentication with the Redis database.password- The password which should be used for authentication with the Redis database.use_ssl-Trueif SSL should be used for the connection to Redis.ssl_certfile- Path to the SSL certificate file.ssl_keyfile- Path to the SSL private key file.ssl_ca_certs- Path to the SSL CA certificate file.port0 - prefix to prepend to all keys used by the lock store. Must be alphanumeric.port1 - Timeout in seconds after which an exception will be raised in case Redis doesn't respond withinport1 seconds.
get_lock
Retrieves lock (see parent docstring for more information).
delete_lock
Deletes lock for conversation ID.
InMemoryLockStore Objects
In-memory store for ticket locks.
__init__
Initialise dictionary of locks.
get_lock
Get lock for conversation if it exists.
delete_lock
Delete lock for conversation.
save_lock
Save lock in store.
