pynenc.util.redis_keys¶
Module Contents¶
Classes¶
Helper class to manage Redis key formats for various components. |
Functions¶
Sanitizes a string for use as a Redis key. |
Data¶
API¶
- pynenc.util.redis_keys.PYNENC_KEY_PREFIX¶
‘pynenc’
- pynenc.util.redis_keys.sanitize_for_redis(s: str) str[source]¶
Sanitizes a string for use as a Redis key.
- Parameters:
s (str) – The string to sanitize.
- Returns:
The sanitized string.
- class pynenc.util.redis_keys.Key(app_id: str, prefix: str)[source]¶
Helper class to manage Redis key formats for various components.
Initialization
- status(task_id: str, status: pynenc.invocation.status.InvocationStatus) str[source]¶
- purge(client: redis.Redis) None[source]¶
Purges all keys with the given prefix in Redis.
- Parameters:
client (redis.Redis) – The Redis client.
- condition_triggers(condition_id: str) str[source]¶
Get key for storing triggers that use a condition.
- cron_last_execution(condition_id: str) str[source]¶
Generate a key for storing the last execution time of a cron condition.
- Parameters:
condition_id – ID of the cron condition
- Returns:
Redis key string
- source_task_conditions(task_id: str) str[source]¶
Generate key for source task to condition mapping.
This key stores conditions that are sourced from a specific task.
- Parameters:
task_id – ID of the source task
- Returns:
Redis key for task’s source conditions
- trigger_execution_claim(trigger_id: str, valid_condition_id: str) str[source]¶
Generate a key for a trigger execution claim.
This key is used to atomically claim the right to execute a trigger for a specific valid condition across multiple workers.
- Parameters:
trigger_id – ID of the trigger definition
valid_condition_id – ID of the valid condition
- Returns:
Redis key for the trigger execution claim
- trigger_run_claim(trigger_run_id: str) str[source]¶
Generate a key for a trigger run claim.
This key is used to atomically claim the right to execute a specific trigger run across multiple workers. A trigger run is a unique execution attempt for a trigger and its satisfied conditions.
- Parameters:
trigger_run_id – Unique ID for this trigger run
- Returns:
Redis key for the trigger run claim
- workflow_deterministic_value(workflow_id: str, key: str) str[source]¶
Get key for storing a deterministic value for workflow operations.
- Parameters:
workflow_id – ID of the workflow
key – Identifier for the deterministic value
- Returns:
Redis key for the deterministic value
- workflow_types() str[source]¶
Get key for storing workflow types set.
This key automatizes purge as it follows the app-scoped prefix pattern.
- Returns:
Redis key for workflow types set
- workflow_runs(workflow_task_id: str) str[source]¶
Get key for storing workflow runs list for a specific workflow type.
This key automatizes purge as it follows the app-scoped prefix pattern.
- Parameters:
workflow_task_id – ID of the workflow task type
- Returns:
Redis key for workflow runs list