results
prefect.results
Functions
DEFAULT_STORAGE_KEY_FN
↗
get_default_result_storage
↗
Generate a default file system for result storage.
resolve_result_storage
↗
Resolve one of the valid ResultStorage
input types into a saved block
document id and an instance of the block.
resolve_serializer
↗
Resolve one of the valid ResultSerializer
input types into a serializer
instance.
get_default_result_serializer
↗
Generate a default file system for result storage.
get_default_persist_setting
↗
Return the default option for result persistence.
get_default_persist_setting_for_tasks
↗
Return the default option for result persistence for tasks.
should_persist_result
↗
Return the default option for result persistence determined by the current run context.
If there is no current run context, the value of results.persist_by_default
on the
current settings will be returned.
default_cache
↗
result_storage_discriminator
↗
get_result_store
↗
Get the current result store.
Classes
ResultStore
↗
Manages the storage and retrieval of results.
Methods:
result_storage_block_id
↗
generate_default_holder
↗
Generate a default holder string using hostname, PID, and thread ID.
Returns:
- A unique identifier string.
exists
↗
Check if a result record exists in storage.
Args:
key
: The key to check for the existence of a result record.
Returns:
- True if the result record exists, False otherwise.
read
↗
Read a result record from storage.
Args:
key
: The key to read the result record from.holder
: The holder of the lock if a lock was set on the record.
Returns:
- A result record.
create_result_record
↗
Create a result record.
Args:
key
: The key to create the result record for.obj
: The object to create the result record for.expiration
: The expiration time for the result record.
write
↗
Write a result to storage.
Handles the creation of a ResultRecord
and its serialization to storage.
Args:
key
: The key to write the result record to.obj
: The object to write to storage.expiration
: The expiration time for the result record.holder
: The holder of the lock if a lock was set on the record.
persist_result_record
↗
Persist a result record to storage.
Args:
result_record
: The result record to persist.
supports_isolation_level
↗
Check if the result store supports a given isolation level.
Args:
level
: The isolation level to check.
Returns:
- True if the isolation level is supported, False otherwise.
acquire_lock
↗
Acquire a lock for a result record.
Args:
key
: The key to acquire the lock for.holder
: The holder of the lock. If not provided, a default holder based on the current host, process, and thread will be used.timeout
: The timeout for the lock.
Returns:
- True if the lock was successfully acquired; False otherwise.
release_lock
↗
Release a lock for a result record.
Args:
key
: The key to release the lock for.holder
: The holder of the lock. Must match the holder that acquired the lock. If not provided, a default holder based on the current host, process, and thread will be used.
is_locked
↗
Check if a result record is locked.
is_lock_holder
↗
Check if the current holder is the lock holder for the result record.
Args:
key
: The key to check the lock for.holder
: The holder of the lock. If not provided, a default holder based on the current host, process, and thread will be used.
Returns:
- True if the current holder is the lock holder; False otherwise.
wait_for_lock
↗
Wait for the corresponding transaction record to become free.