hpcflow.sdk.monitoring.registry.SubmissionRegistry#
- class hpcflow.sdk.monitoring.registry.SubmissionRegistry(app)#
Bases:
objectPersist submission history independently of workflow-store readability.
The host-scoped JSON registry retains job references needed for monitoring and cancellation. Read legacy history without changing its source file. Mutations use an OS lock and atomic replacement. Inactive and unknown records have separate retention limits; active records are protected. Only explicit unregistering releases IDs; automatic pruning leaves them retired.
Methods
Append one successful job reference immediately and advance the record revision.
Register a submission part before jobs are launched and return its local ID.
Clear submission-in-progress tracking and advance the record revision.
Read typed records, or import legacy text history in memory if JSON is absent.
Yield mutable registry data under an exclusive lock and commit on success.
Remove one submission part and make its ID explicitly reusable.
Release all inactive entries, or every entry when explicitly requested.
Validate and remove explicit IDs atomically, resolving -1 under the lock.
Merge observations only when their record revisions still match the registry.
Attributes
- Parameters:
app (BaseApp)
- SCHEMA_VERSION = 1#
- add_job(local_id, job)#
Append one successful job reference immediately and advance the record revision.
- begin(submission, part)#
Register a submission part before jobs are launched and return its local ID.
Save workflow/template names and submitting-process identity immediately so a partial or interrupted submission can still be monitored.
- Parameters:
submission (Submission)
part (str)
- Return type:
- finish(local_id)#
Clear submission-in-progress tracking and advance the record revision.
Remove a record with no successfully registered jobs, including submissions that failed before launching anything. Existing local IDs remain allocated.
- Parameters:
local_id (int)
- Return type:
None
- read()#
Read typed records, or import legacy text history in memory if JSON is absent.
Repair legacy display names without loading workflows or writing files. Malformed or unsupported JSON raises ValueError rather than silently discarding registered job references.
- Return type:
- transaction(*, prune=True)#
Yield mutable registry data under an exclusive lock and commit on success.
After the caller finishes, apply separate inactive and unknown retention limits, retain every active record, and atomically replace the JSON document. Unknown records are ordered by submission time, then local ID; rechecking a stale record does not make it recent. Explicit removal uses
prune=Falseto preserve records outside its selection. Exceptions skip the commit.- Parameters:
prune (bool)
- unregister(local_id)#
Remove one submission part and make its ID explicitly reusable.
Do not load/delete workflows or query/cancel jobs. Reject removal while submission writes are in progress. Save the next revision for a reused ID so previously collected observations cannot overwrite its new owner. Automatically pruned IDs never enter this reuse pool.
- Parameters:
local_id (int)
- Return type:
- unregister_all(include_active=False)#
Release all inactive entries, or every entry when explicitly requested.
Selection uses last recorded activity without querying schedulers. Including active entries also includes unknown entries, which may still be running. Validate the whole selection before removing anything; a live submitter aborts the transaction. Do not prune records outside the selected activity states, even when retention settings have since been lowered.
- Parameters:
include_active (bool)
- Return type:
- unregister_many(local_ids)#
Validate and remove explicit IDs atomically, resolving -1 under the lock.
Only the named submission parts are removed. Unknown IDs and submitting records reject the entire selection before any IDs are released.
- Parameters:
- Return type:
- update(records)#
Merge observations only when their record revisions still match the registry.
Preserve concurrent submission/job updates rather than overwriting them with older observations. Apply normal retention and return the IDs still retained.
- Parameters:
records (list[SubmissionRecord])
- Return type: