Stores¶
reflow.stores.Store¶
reflow.stores.Store
¶
Bases: ABC
Abstract manifest store.
init()
abstractmethod
¶
close()
abstractmethod
¶
insert_run(run_id, graph_name, user_id, parameters)
abstractmethod
¶
get_run(run_id)
abstractmethod
¶
get_run_parameters(run_id)
abstractmethod
¶
update_run_status(run_id, status)
abstractmethod
¶
list_runs(graph_name=None, user_id=None)
abstractmethod
¶
insert_task_spec(run_id, task_name, is_array, config_json, dependencies)
abstractmethod
¶
Persist one task specification and its dependencies.
list_task_dependencies(run_id, task_name)
abstractmethod
¶
insert_task_instance(run_id, task_name, array_index, state, input_payload, identity='', input_hash='')
abstractmethod
¶
Insert one task instance, return its database id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_id
|
str
|
Uniq identifier for this job. |
required |
task_name
|
str
|
Name of the job. |
required |
identity
|
str
|
Full Merkle identity hash. |
''
|
input_hash
|
str
|
Hash of direct inputs only (without upstream hashes). |
''
|
array_index
|
int | None
|
Number of array job. If any. |
required |
state
|
TaskState
|
Stats of the task. |
required |
input_payload
|
dict[str, Any]
|
payload of the input jobs |
required |
identity
|
str
|
|
''
|
input_hash
|
str
|
|
''
|
Source code in src/reflow/stores/__init__.py
get_task_instance(run_id, task_name, array_index)
abstractmethod
¶
list_task_instances(run_id, task_name=None, states=None)
abstractmethod
¶
List task instances with optional filters.
count_task_instances(run_id, task_name)
abstractmethod
¶
get_singleton_output(run_id, task_name)
abstractmethod
¶
get_array_outputs(run_id, task_name)
abstractmethod
¶
get_output_hash(run_id, task_name, array_index=None)
abstractmethod
¶
Get the output hash for a specific successful task instance.
get_all_output_hashes(run_id, task_name)
abstractmethod
¶
dependency_is_satisfied(run_id, task_name)
abstractmethod
¶
update_task_submitted(run_id, task_name, job_id)
abstractmethod
¶
update_task_running(instance_id)
abstractmethod
¶
update_task_success(instance_id, output, output_hash='')
abstractmethod
¶
Mark one instance as successful.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_hash
|
str
|
Hash of the output value for downstream Merkle propagation. |
''
|
instance_id
|
int
|
Database id |
required |
output
|
Any
|
Output for the job |
required |
output_hash
|
str
|
hash of the output |
''
|
Source code in src/reflow/stores/__init__.py
update_task_failed(instance_id, error_text)
abstractmethod
¶
update_task_cancelled(instance_id)
abstractmethod
¶
mark_for_retry(instance_id)
abstractmethod
¶
find_cached(task_name, identity)
abstractmethod
¶
Find a successful task instance with a matching Merkle identity.
Searches across all runs. Returns the most recent match.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_name
|
str
|
Task name. |
required |
identity
|
str
|
Full Merkle identity hash. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] or None
|
The cached instance row, or |
Source code in src/reflow/stores/__init__.py
reflow.stores.sqlite.SqliteStore¶
reflow.stores.sqlite.SqliteStore(path, readonly=False)
¶
Bases: Store
SQLite-backed manifest store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path or str
|
Path to the SQLite database file. |
required |
Source code in src/reflow/stores/sqlite.py
for_run_dir(run_dir, readonly=False)
classmethod
¶
Create a store at <run_dir>/manifest.db.
This remains available for callers that want a run-local store,
but the default reflow behaviour uses default instead so
one manifest database can serve multiple run directories.
Source code in src/reflow/stores/sqlite.py
default_path(config=None)
classmethod
¶
Return the default shared manifest path.
By default this is the user cache directory, typically
~/.cache/reflow/manifest.db on Linux, unless overridden by
config or REFLOW_STORE_PATH.
Source code in src/reflow/stores/sqlite.py
default(config=None, readonly=False)
classmethod
¶
Create a store using the shared default manifest path.
get_output_hash(run_id, task_name, array_index=None)
¶
Get the output hash for a specific task instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_id
|
str
|
Run identifier. |
required |
task_name
|
str
|
Task name. |
required |
array_index
|
int or None
|
Array index, or None for singleton. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Output hash, or empty string if not found. |
Source code in src/reflow/stores/sqlite.py
get_all_output_hashes(run_id, task_name)
¶
Get output hashes for all successful instances of a task.
Source code in src/reflow/stores/sqlite.py
find_cached_record(task_name, identity)
¶
Find the most recent successful instance matching the identity.
Searches across all runs.
Source code in src/reflow/stores/sqlite.py
reflow.stores.records.RunRecord¶
reflow.stores.records.RunRecord(run_id, graph_name, user_id, created_at, status, parameters)
dataclass
¶
Typed representation of one workflow run row.
to_public_dict()
¶
Return the legacy public dictionary shape.
Source code in src/reflow/stores/records.py
reflow.stores.records.TaskSpecRecord¶
reflow.stores.records.TaskSpecRecord(run_id, task_name, is_array, config, dependencies)
dataclass
¶
Typed representation of one persisted task specification.
reflow.stores.records.TaskInstanceRecord¶
reflow.stores.records.TaskInstanceRecord(id, run_id, task_name, array_index, state, job_id, input, output, error_text, identity, input_hash, output_hash, created_at, updated_at)
dataclass
¶
Typed representation of one persisted task instance.
to_public_dict()
¶
Return the legacy public dictionary shape.