Repository navigation
Serve the reasoning job operations at /reasoning - #2
Merged
Merged
Conversation
Queue length, finished-job history and age, and the reasoning disk quota are read by JobSettings with the entrypoint's rules, and test/reasoning-settings.cases pins both, as it already does for the worker settings. Queued and kept jobs are held in memory, so their counts have at most four digits. The quota is a size or a share of the data volume, 25% by default until snapshot sizes are measured.
The extension cannot depend on OpenMetadata's jars, so JobRequest checks a request against rdfReasoningJobRequest.json and the schemas it references with Jena's JSON, including the per-operation and per-check requirements of OpenMetadata pull request 35199 and the prose rule that a REFRESH accepts only APPROVED ontologies. Bodies are bounded in size, and in nesting before parsing, since the parser recurses per level. A canonical digest tells a retry from a different request that reuses its ID. OpenMetadata's schemas and examples are copied into test resources, with the commit they came from, and a small checker validates the store's documents against them.
A job service needs two things from the launcher. After a restart it must find and kill a worker that outlived the server, so the launcher records the worker's pid next to the step while it runs. And a cancellation must reach a step whether or not it has started: run(step, cancelled) cancels the step at launch when the caller's flag is already set, so a caller that sets its flag and then calls cancel() stops its own step and never a later one.
…ention JobService admits a job only when the memory budget fits and the reasoning root is under its disk quota, queues at most OPENMETADATA_REASONING_MAX_QUEUED_JOBS behind the running one, and runs them in order on a thread of its own. Each job has a directory under /fuseki/reasoning/jobs/<id>/ with its request and a manifest replaced atomically on every change. A request ID returns its job for as long as the job is kept; finished jobs are kept up to a count and an age. A queued job is cancelled at once; a running one stays RUNNING with cancelRequested until its worker has exited. After a restart, unfinished jobs become INTERRUPTED, their unpublished work is removed, and a worker recorded in their directory is killed if it is still that directory's worker. Worker steps run through the launcher and map its outcomes to the protocol's problems. Capture of a serving dataset is the next change, so every operation's plan fails at its capture step for now, with NOT_READY and a NOT_IMPLEMENTED message, since the protocol has no code for it. The tests run real stand-in worker processes and check every job document against OpenMetadata's schema.
The module registers one servlet at /reasoning/* that routes capabilities, job
submission, status and cancellation itself, and answers results and query with
501 until snapshots exist.
Routing: Fuseki dispatches a dataset's operations by endpoint name, so
/reasoning/jobs/{id} cannot be an endpoint; query-parameter dispatch on one
endpoint would work but turns a resource API into ?op=...&id=... on every
dataset. A servlet added with FusekiServer.Builder.addServlet sits after
Fuseki's dataset dispatch and behind the same Shiro filter as every other path,
so the image's shiro.ini keeps it admin-only with no change, and its paths are
the plan's. The serving dataset a job reads is the dataset parameter, checked
against the datasets the server serves. A dataset named reasoning would hide
the operations, which the module logs.
With reasoning disabled the operations still answer, DISABLED and 503, and
nothing is written to disk. The integration test runs a real Fuseki server with
Shiro, once with the image's shiro.ini (admin only) and once with the
documented operator file that grants a non-admin service account the
reasoning role and nothing else.
README.md describes the operations, their answers and limits, the routing, execution, cancellation, restart and disk policies, what a job does in this release, and the shiro.ini that grants a non-admin service account reasoning alone. The smoke test checks, in the built image: DISABLED and 503 with reasoning off; NOT_READY and 503 in an undersized container; and with the budget met, admin-only capabilities, a job accepted with 202 and returned by its request ID with 200, a 400 for an invalid request, the job failing at capture with a structured problem, cancellation answers, a 501 for results, and the job and its request ID surviving a container restart. Invalid queue and quota settings stop the container.
harshach
changed the base branch from
openmetadata/reasoner-worker
to
release/6.2.0
October 11, 2026 16:10
This was referenced Oct 15, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
First slice of phase 4 of OpenMetadata's reasoning inside the Fuseki image design: the HTTP job API OpenMetadata will call, with a real lifecycle. Stacked on #1 (base is its branch; retarget to
release/6.2.0after #1 merges).Included
Operations:
GET /reasoning/capabilities,POST /reasoning/jobs?dataset=…,GET/DELETE /reasoning/jobs/{id}.GET /reasoning/results/{id}andPOST /reasoning/queryanswer501until snapshots exist.GET /reasoning/capabilitiesREADY/NOT_READY/DISABLEDwith reasons), memory budget, enforced limitsPOST /reasoning/jobs?dataset=XLocation(new job); 200 (samerequestId); 400 invalid request or missing dataset; 404 unknown dataset; 409requestIdreused with a different request; 413 over 4 MiB; 415 not JSON; 429 queue full; 503 disabled, not ready, or disk quota reachedGET /reasoning/jobs/{id}DELETE /reasoning/jobs/{id}Contract: requests are validated against OpenMetadata's
rdfReasoningJobRequest.jsonand the schemas it references, plus the per-operation rules from Fixes 35198: Keep RDF reasoning freshness exact during rolling upgrades and failed updates OpenMetadata#35199, without OM jars. Every job and capabilities document is checked in tests against copies of OM's schemas (extension/src/test/resources/openmetadata-contract/, from OM12f9e16e). Every error body is the protocol'sproblemobject.Routing: one servlet registered by the module at
/reasoning/*. Fuseki routes a dataset's operations by endpoint name, so/jobs/{id}cannot be a dataset endpoint, and query-parameter dispatch would put?op=…&id=…on every dataset. The servlet sits behind the same Shiro/*filter, so the image'sshiro.inikeeps it admin-only unchanged; the README documents ashiro.inifor a non-admin service account with areasoningrole.Execution: admitted on the memory budget and a disk quota; one job at a time on a dedicated thread, never a Jetty request thread; a bounded FIFO queue (
429when full); idempotent byrequestIdwithin a bounded history; durablejob.jsonmanifests written atomically in/fuseki/reasoning/jobs/<id>/. Worker steps share the container worker lock withbin/reasoner.Cancel: a queued job is cancelled at once; a running job reports
CANCELLEDonly after its worker has exited (SIGTERM, then SIGKILL). A cancel never reaches a later step.Restart: unfinished jobs become
INTERRUPTED, their working data is removed, and a worker recorded in a<step>.pidfile is killed only if that process is still the worker for a step in that job's directory.Retention: finished jobs are evicted by count and age, oldest first; directories without a manifest (steps run by hand) are never touched. With reasoning disabled nothing is written.
Settings (entrypoint/Java parity, pinned in
test/reasoning-settings.cases):OPENMETADATA_REASONING_MAX_QUEUED_JOBS(16),OPENMETADATA_REASONING_JOB_HISTORY(1000),OPENMETADATA_REASONING_JOB_RETENTION_HOURS(168),OPENMETADATA_REASONING_DISK_QUOTA(size or percentage of the volume, 25%).Not yet
Capture, snapshots, generation checks and engine work are the next slices. Every job currently ends
FAILEDat itscapturestep with problem codeNOT_READYand a message startingNOT_IMPLEMENTED:; the protocol has no not-implemented code, and an unknown value would break OM's client. Capabilities list no engines or coverage until an operation reaches one.Schema gaps to raise in OpenMetadata: capabilities has no list of supported operations; the problem-code enum has no not-implemented value; the limits description asks for
NOT_READYwhen a limit is unset, while this slice reports readiness from the memory budget and lists only the limits it enforces.Tests
extensionmvn verify: 251 tests, includingJobRequestTest(OM's examples and violation cases),JobServiceTest(ordering, queue limit, cancel only after a real worker exits, busy lock, restart recovery that kills a real orphan and spares an unrelated pid, retention, quota), andReasoningOperationsITon a real Fuseki server with Shiro (admin 200; anonymous and wrong password 401; service account reaches/reasoningbut gets 403 on/ds/sparql; submit, retry, cancel, every error code).reasonermvn verify: 151 unit + 5 integration tests.DISABLEDwith nothing written,NOT_READYin an undersized container, admin-only capabilities, submit then idempotent retry, structured capture failure, cancel,501for results, and the job survivingdocker restart.