You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Record runs as a PROV bundle with file and MariaDB stores - #2
A run is recorded as a PROV bundle (prov:Bundle, attributed to rec's purl): a prov-ext:Execution and an oslc_auto:AutomationResult with its OSLC state and verdict, wall-clock instants and host, written with the rdf-utils helpers (create_bundle, load_pkg_prov, load_execution_prov, add_wall_instant)
Run(store, run_id, base) is one handle on a run: queue(), start(), beat(), end(verdict, fail_trace), cancel(), lifecycle(); run(work) does the steps around a plain function, beating while it runs and ending it as passed, failed or error
Each step edits the bundle the store parsed under its lock: it checks the run's state once and changes only its own triples, so a start and a cancel cannot both succeed across processes
A queued run that is cancelled never starts; a run in progress asked to stop ends canceled, or keeps its verdict if its work raised; an interrupt is raised again once recorded
FileStore keeps a run's bundle as <run_id>.ld.json under an flock; MariaDBStore keeps it as JSON-LD in a row of <prefix>_runs, locking the row by inserting it, with case-sensitive run ids
What a run executes, the software and files it uses or generates, and its steps are left to the tool that knows them, in its own bundle
examples/robot_runs.py records runs in files and in MariaDB: passed, failed, cancelled while queued, stopped while running
rdflib and rdf-utils (pinned to bad7c02) become dependencies; MariaDB stays an extra; the observers, Feature and Scenario are replaced by the run handle and stores
- RunRecord (rec.record) is what rec knows of a run: OSLC state and verdict, times, result and fail trace, program and recording software, trigger, host, agents, sources, repositories, dependencies, resources, artefacts and metrics
- Observer(store) records every event once for any store: load the record, change it, save it; a run cancelled in the store does not start, only a run that has not started can be cancelled, and a step logged again replaces its value
- A store is any object with load, save, run_ids and close (rec.stores.Store); FileStore keeps a run as its PROV document (fmt="rdf") or its record as JSON (fmt="json"), MariaDBStore as one row with state and verdict columns, migrating the previous release's table
- rec.provenance maps a record to PROV with the rdf-utils helpers and back: an unstarted run is a prov:Activity, a started one a prov-ext:Execution associated with rec whose plan is the file defining the run; files are entities, relative paths prov-ext:RelativeLocation under the directory they were logged from
- Run records the program it ran, stops the heartbeat before completion, and runs post-run hooks after it, so a hook that raises no longer rewrites the verdict
- rdflib and rdf-utils become dependencies; MariaDB stays an extra; observers are replaced by the observer and stores
- Store.edit(run_id) replaces save: FileStore holds an flock on <id>.lock, MariaDBStore a SELECT ... FOR UPDATE transaction, so a start and a cancel from separate observers cannot both succeed
- A run starts only when new or queued, in Run.run and Observer.log_started_run
- Run ids are percent-encoded in run IRIs
- A list or mapping result is an rdf:JSON literal and reads back as itself
- Drop the migration of MariaDBObserver's table and its test
- Drop Run's unused ingredients, scenario and **kwargs
Pin VCS dependency to a released or immutable version
pyproject.toml:11
Depending on the moving main branch makes installations and CI non-reproducible; an upstream change can break this package without any REC commit, especially because the code imports an underscore-prefixed helper from this dependency. Use a released version or pin the VCS reference to an immutable commit/tag.
Select next step above the maximum existing metric step
rec/observer.py:96
Counting existing metrics does not reliably select a new step. For example, after explicitly logging step 1, the next call without a step also chooses 1 and silently replaces it; sparse explicit steps have the same problem. Choose one greater than the maximum existing step for this metric.
Guard missing run start before RDF trigger lookup
rec/provenance.py:218
When a run has no qualified start, start is None; in rdflib, g.value(None, PROV.entity) searches for a subject with that predicate rather than returning None. A run with resources but no trigger can therefore deserialize a prov:Usage node as its trigger, breaking the RDF/record round trip. Guard both lookups with if start.
- The heartbeat stops in a finally around the hooks and main, so SystemExit no longer leaves its non-daemon thread running
- MariaDBStore.number had no caller; the id column stays to order runs
- Only a new run can be queued and only a queued run cancelled, so a finished run cannot be queued and run again, and cancelling an unknown id creates nothing
- Run queues and cancels only once its stores accept, as it already started
- A record with a value JSON cannot keep is refused for every store, so a result or metric no longer passes in one store and fails in another
- add_agent accepts only PROV-O's agent classes
- MariaDBStore serializes its threads on its one connection; the observer no longer locks
- Queueing, starting, cancelling and ending hold every store's record at once, so a refusal by one store leaves all unchanged; observers sharing a store are refused
- Ending a run and its heartbeat require it in progress
- The observer keeps lists in one order and refuses a change JSON or PROV would not give back unchanged: lossy JSON values, NaN, empty strings, an entity logged twice
- A file is generated once per run (PROV-Constraints generation-uniqueness)
- provenance.record reads only the requested run, and a file's IRI includes its root
- The heartbeat is a daemon thread, so one stuck on a store cannot keep the process alive
- FileStore.save is private to edit
- README states the multi-store limits: no two-phase commit, and opposite store orders can deadlock
- graph() types a run prov-ext:Execution and oslc_auto:AutomationResult whatever its state; a started run adds its start time and association
- A queued or cancelled run conforms with no start time, association or usage
- The shapes refuse a run without a verdict, a queued run with a start time, and a run that is not an execution or not an automation result
- README describes the run's types
- MariaDBStore keeps a run as a row of <prefix>_runs and a row per list item, from rec/stores/mariadb.sql, instead of a JSON blob
- Run reads state and verdict from the store; a Run with a stored run_id goes on from there and the store decides each step
- cancel() ends a queued run as canceled; a run in progress becomes canceling and ends as canceled once main returns
- Keep what main returned as rec:result
- Add run steps: add_activity records a prov-extension activity dcterms:isPartOf the run; a resource or artefact may only name a step of its run
- Compare stores by PROV graph isomorphism and drop the sorting of record lists
- Remove log_sources, info(), the pre/post run hooks, Scenario, Feature and the decentralized example
- Build with hatchling and take the version from git tags
- Fix reading agents back from MariaDB, whose id column was dropped
- Add file, MariaDB and all-stores examples; rewrite the README around snippets
- Test cancelling a run in progress, run steps, and files of unknown steps
- Write a run as a prov:Bundle attributed to rec's purl, with rdf-utils load_pkg_prov, load_execution_prov and add_wall_instant
- Keep the bundle id in the record, minted on the run's first edit
- Record the packages a run used as rdf-utils PackageInfo (log_packages), replacing repositories and dependencies
- Drop agents, activities, resources, artefacts, metrics, program, trigger and result: tools record their files and steps in their own bundles
- FileStore writes any rdf-utils DatasetFormat; drop the JSON record format
- MariaDB keeps runs and packages tables, the recorder flagged
- Keep queue, cancel and heartbeat
vamsikalagaturu
changed the title
Record runs as a store-agnostic record with a PROV view
Record runs as a PROV bundle with file and MariaDB stores
Nov 12, 2026
- Drop packages, log_packages and add_package: the calling tool records the software it ran in its own bundle
- Keep rec as the run's recorder; MariaDB keeps it in recorder_* columns of the runs table and drops the packages table
- Remove the all-stores example
- One example records runs in a bundle file and in MariaDB: passed, failed, cancelled while queued, stopped while running
- PickPlaceRun checks for a stop request between motions; DrawerOpeningRun fails on an unreachable handle
- The runs table holds a run's id and its bundle as JSON-LD; edit and load go through the same provenance functions as FileStore
- Drop the per-field columns, the column mapping and MariaDBRun; run_ids filters by state from the bundles
- Both stores yield a RunRecord, so the RunHandle protocol goes
- A store's edit yields the run's parsed Dataset under its lock and writes it back; the Observer checks the state and sets only the event's triples
- rdf-utils writes the bundle, rec as software agent, the execution and its instants once each; RunRecord and the record-bundle round trip go
- A run has one observer and store; the run is associated with the rec that started it, the bundle attributed to the rec that first recorded it
- MariaDB locks a new run's row by inserting it and keeps run ids case-sensitive; the table is created in code
- An interrupt ends the run as error and is raised again; a failed heartbeat is logged and the next tried; a run that fails while canceling keeps its verdict
- A run cancelled while queued has no beginning or end; times without a zone and files outside the store's directory are refused
- Drop TriG and N-Quads files, run_ids, the warning verdict, the store protocols and the close forwarders; base moves to the Observer
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Host-metadata failures can leave runs stuck in progress and block retries, while incorrect PROV bundle selection can crash lifecycle updates or misplace host metadata.
…un's own bundle
- run() records the host inside the guarded block, so a failure there ends the started run as failed; the heartbeat is joined only if it started
- The Observer finds the run's bundle by the run's state, not the first prov:Bundle, and refuses a dataset holding a run under another base
- Run(store, run_id, base) queues, starts, beats, ends, cancels and reads its lifecycle; run(work) does the steps around a plain function, replacing the Observer and subclassed main
- Each step checks the state once in _step, stamps its time under the store's lock and changes only its triples; the host is recorded with the start
- end refuses an unavailable verdict and a trace on a passed run; an interrupt is raised again even when the end cannot be recorded; the heartbeat join is bounded
- MariaDB refuses a prefix that is not a table name; a stored run holds only rec's bundle
- Follow rdf-utils add_wall_instant(graph, stamp, instant_id=) and pin rdf-utils to bad7c02, which no release tag includes yet
- The example records fresh runs on every invocation
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
prov:Bundle, attributed to rec's purl): aprov-ext:Executionand anoslc_auto:AutomationResultwith its OSLC state and verdict, wall-clock instants and host, written with the rdf-utils helpers (create_bundle,load_pkg_prov,load_execution_prov,add_wall_instant)Run(store, run_id, base)is one handle on a run:queue(),start(),beat(),end(verdict, fail_trace),cancel(),lifecycle();run(work)does the steps around a plain function, beating while it runs and ending it as passed, failed or errorFileStorekeeps a run's bundle as<run_id>.ld.jsonunder anflock;MariaDBStorekeeps it as JSON-LD in a row of<prefix>_runs, locking the row by inserting it, with case-sensitive run idsexamples/robot_runs.pyrecords runs in files and in MariaDB: passed, failed, cancelled while queued, stopped while runningbad7c02) become dependencies; MariaDB stays an extra; the observers,FeatureandScenarioare replaced by the run handle and stores