graflo.hq.sync.run¶
Write a grouped sync run: ensure every vertex, then rewrite the changed owners.
The input is staged, folded and grouped exactly as a bulk load's (see
:mod:graflo.hq.bulk.run and :mod:graflo.hq.sync.group), so a sync of a
release writes what a bulk load of it would. Vertices come first, key-only for
the owned types, so an owned edge finds both endpoints whichever chunk writes
it. Every chunk is recorded in the run ledger; a stopped run resumes.
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
SyncKeyOnlyError
¶
SyncReport
¶
Bases: BaseModel
Owners rewritten and owners skipped, per owned vertex type.
Source code in graflo/hq/sync/run.py
Functions:¶
check_key_only(schema, staging_dir, counts, owned)
¶
Refuse a folded vertex of a type the run does not own that has properties.
Such a type is only ever created by a sync run, never updated, so a property on it would go stale. Identity and reserved fields are its key and its stamp, and may be set.
Raises:
| Type | Description |
|---|---|
SyncKeyOnlyError
|
Naming each type and the fields found. |
Source code in graflo/hq/sync/run.py
write_sync(schema, conn_conf, staging_dir, ledger, cfg, owner_runs, owned)
¶
Ensure the folded vertices, then rewrite every owner whose hash changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
Schema
|
The schema, logical names, initialized for the target flavor. |
required |
conn_conf
|
DBConfig
|
The target; it must declare |
required |
staging_dir
|
Path
|
A folded and grouped staging directory. |
required |
ledger
|
RunLedger
|
Its ledger. |
required |
cfg
|
BulkConfig
|
Chunk size and parallelism. |
required |
owner_runs
|
list[OwnerRun]
|
The grouped owner types. |
required |
owned
|
Mapping[EdgeId, OwnedEdge]
|
How each owned edge is owned, by declared edge id. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The target has no sync writer. |