ProcessContext¶
- class gafaelfawr.factory.ProcessContext(config, http_client, ldap_pool, redis, uid_cache, gid_cache, ldap_group_cache, ldap_group_name_cache, ldap_user_cache, internal_token_cache, notebook_token_cache)¶
Bases:
object
Per-process application context.
This object caches all of the per-process singletons that can be reused for every request and only need to be recreated if the application configuration changes. This does not include the database session; each request creates a new scoped session that’s removed at the end of the session to ensure that all transactions are committed or abandoned.
- Parameters:
config (
Config
)http_client (
AsyncClient
)ldap_pool (
AIOConnectionPool
|None
)redis (
Redis
)uid_cache (
IdCache
)gid_cache (
IdCache
)ldap_user_cache (
LDAPCache
[LDAPUserData
])internal_token_cache (
InternalTokenCache
)notebook_token_cache (
NotebookTokenCache
)
Attributes Summary
Gafaelfawr's configuration.
Shared GID cache.
Shared HTTP client.
Shared internal token cache.
Cache of LDAP group information.
Cache of LDAP group names.
Connection pool to talk to LDAP, if configured.
Cache of LDAP user data.
Shared notebook token cache.
Connection pool to use to talk to Redis.
Shared UID cache.
Methods Summary
aclose
()Clean up a process context.
from_config
(config)Create a new process context from the Gafaelfawr configuration.
Attributes Documentation
-
http_client:
AsyncClient
¶ Shared HTTP client.
-
internal_token_cache:
InternalTokenCache
¶ Shared internal token cache.
-
ldap_pool:
AIOConnectionPool
|None
¶ Connection pool to talk to LDAP, if configured.
-
ldap_user_cache:
LDAPCache
[LDAPUserData
]¶ Cache of LDAP user data.
-
notebook_token_cache:
NotebookTokenCache
¶ Shared notebook token cache.
Methods Documentation
- async aclose()¶
Clean up a process context.
Called during shutdown, or before recreating the process context using a different configuration.
- Return type: