Services Reference¶
Services are the orchestration layer between UI interactions, database access, workflow execution, and operational controls.
Package entrypoint¶
Purpose: service package exports.
Analytics¶
Purpose: analytics event collection and reporting helpers.
Operational analytics and KPI aggregation services.
AnalyticsService
¶
Aggregates operational QA and production KPIs.
Source code in accessibility_mgr/services/analytics.py
Artifact retention¶
Purpose: retention and cleanup policy handling for generated artifacts.
Artifact retention lifecycle management — SQLite-backed.
ArtifactRetentionService
¶
SQLite-backed retention lifecycle management for generated artifacts.
Source code in accessibility_mgr/services/artifact_retention.py
Audit log¶
Purpose: audit stream normalization and retrieval.
Audit-grade operational event logging — SQLite-backed.
AuditLogService
¶
SQLite-backed immutable-style audit event logging service.
Source code in accessibility_mgr/services/audit_log.py
Authentication¶
Purpose: user/session authentication workflows and credential validation.
Authentication and API token infrastructure.
GEN-009 / FUN-031: Tokens are currently stored in-memory only and are lost on restart. Revocation and token rotation are not persistent. A future migration should back this with the database (api_token table). All validation attempts are now logged for audit purposes.
AuthenticationService
¶
Authentication and credential lifecycle service.
Source code in accessibility_mgr/services/authentication.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
register_api_token(*, owner, raw_token, expiration_hours=24)
¶
Register a caller-provided raw API token for validation.
Source code in accessibility_mgr/services/authentication.py
validate_token(raw_token, *, caller_ip='unknown')
¶
Validate raw_token and log the attempt.
FUN-031: every call is logged with timestamp and caller_ip so operators can detect brute-force attempts. Token values are never logged — only token_ids.
Source code in accessibility_mgr/services/authentication.py
Backup¶
Purpose: scheduled and on-demand database backups with retention.
Backup service — automated weekly SQLite database backups.
Performs a hot backup using SQLite's built-in VACUUM INTO (or
sqlite3.connect().backup()) so the WAL is fully checkpointed and the
copy is a clean, consistent database file.
Rotation keeps the most recent 10 backups in backups/ and purges older
ones automatically.
Usage¶
Call BackupService.start() once at application startup. It schedules
a background thread that fires immediately (to ensure at least one backup
exists) and then every 7 days.
Manual backup¶
from accessibility_mgr.services.backup_service import BackupService
path = BackupService.run_backup(trigger="manual")
BackupService
¶
Automated weekly SQLite database backups service.
Source code in accessibility_mgr/services/backup_service.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
restore_backup(backup_path)
staticmethod
¶
Restore the live database from backup_path.
Performs a verified restore: 1. Validates the backup file is a readable SQLite database. 2. Creates a safety snapshot of the current live DB before overwriting. 3. Copies the backup over the live DB path using sqlite3.backup(). 4. Verifies the restored file can be opened and queried.
Raises RuntimeError on any validation or IO failure so the caller
can surface the error to the user without crashing the app.
Source code in accessibility_mgr/services/backup_service.py
run_backup(trigger='scheduled')
staticmethod
¶
Copy the live database to backups/ and return the backup file path.
The copy is done via sqlite3.Connection.backup(), which performs a
WAL checkpoint and produces a consistent snapshot even while the app is
running. Old backups beyond the retention limit are pruned afterwards.
Returns the absolute path of the new backup file as a string.
Raises RuntimeError if the source database does not yet exist.
Source code in accessibility_mgr/services/backup_service.py
start()
staticmethod
¶
Start the weekly backup scheduler.
Safe to call multiple times — subsequent calls are no-ops. The first backup fires after a short delay (30 s) so startup is not blocked, and then repeats every 7 days.
Source code in accessibility_mgr/services/backup_service.py
status()
staticmethod
¶
Return a summary dict for display in the Admin panel.
Source code in accessibility_mgr/services/backup_service.py
stop()
staticmethod
¶
Cancel the scheduled backup timer (called on app shutdown).
Source code in accessibility_mgr/services/backup_service.py
Compliance reporting¶
Purpose: compliance-oriented summaries and control evidence output.
Compliance reporting and signed provenance exports.
ComplianceReportingService
¶
Governance and compliance export service.
AUDIT-FIX-005: exports are now signed with HMAC-SHA256 using a server-held key (ACCESSMAN_SIGNING_KEY) when one is configured, which proves both integrity and that the export was produced by a holder of that key. Previously this used a bare SHA-256 hash of the payload — that only detects accidental corruption; anyone can recompute the same hash for fabricated data, so it provided no real authenticity guarantee despite being called a "signature".
If no signing key is configured, exports fall back to a SHA-256 checksum and are labeled "SHA256-CHECKSUM-UNSIGNED" rather than silently claiming to be signed.
Source code in accessibility_mgr/services/compliance_reporting.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
verify_signature(payload, signature, *, algorithm)
¶
Re-derive a signature for payload and compare it to signature.
Only meaningful for algorithm == "HMAC-SHA256" — a checksum ("SHA256-CHECKSUM-UNSIGNED") can be reproduced by anyone and verifying it proves nothing about who generated the export.
Source code in accessibility_mgr/services/compliance_reporting.py
Distributed workers¶
Purpose: worker distribution primitives for asynchronous operations.
Distributed worker coordination primitives — SQLite-backed.
DistributedWorkerRegistry
¶
SQLite-backed registry for distributed orchestration workers.
Source code in accessibility_mgr/services/distributed_workers.py
EPUB QA¶
Purpose: EPUB-specific QA checks and result handling.
EPUB QA automation services.
Provides orchestration primitives for automated EPUB accessibility quality assurance workflows and pipeline execution tracking.
EPUBQAService
¶
Accessibility QA orchestration service.
Source code in accessibility_mgr/services/epub_qa.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
run_ace_check(*, asset_id, epub_path)
¶
Run a real DAISY Ace accessibility audit against epub_path.
AUDIT-FIX-002: this previously fabricated a score from the file
extension and the word "draft" in the filename and never invoked
Ace at all. It now calls AccessibilityBinaryIntegrationService,
which runs the real ace CLI, and parses the JSON report Ace
writes to its output directory. If Ace is not installed, or the
report can't be parsed, that is reported honestly — the result is
never silently marked as passed.
Source code in accessibility_mgr/services/epub_qa.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
Event stream¶
Purpose: event bus style stream publication and consumption.
Event streaming and webhook infrastructure — SQLite-backed.
EventStreamService
¶
SQLite-backed internal event stream.
Future targets: - webhook delivery - Kafka/NATS adapters - distributed event streaming - audit event propagation
Source code in accessibility_mgr/services/event_stream.py
Execution service¶
Purpose: controlled command/process execution used by pipeline tasks.
Execution service — runs external tool commands via subprocess.
Used by QA tooling and pipeline orchestration.
ExecutionResult
dataclass
¶
ExecutionService
¶
Controlled subprocess execution with allowlist and timeout enforcement.
Source code in accessibility_mgr/services/execution_service.py
check_tool_available(tool_name)
staticmethod
¶
Return True if the named executable can be found on PATH.
Source code in accessibility_mgr/services/execution_service.py
run_command(command, timeout=120, cwd=None)
staticmethod
¶
Run a shell command and return the full result.
Source code in accessibility_mgr/services/execution_service.py
Metadata validation¶
Purpose: validation rules for metadata payloads and constraints.
Metadata governance and validation services.
This module centralizes metadata normalization, controlled vocabulary validation, and accessibility metadata checks for EPUB-oriented workflows.
MetadataValidationService
¶
Validate metadata against governance and accessibility rules.
Source code in accessibility_mgr/services/metadata_validation.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
Multi-tenant¶
Purpose: tenant isolation and tenant-scoped helper operations.
Multi-tenant organization infrastructure — SQLite-backed.
MultiTenantService
¶
SQLite-backed organization and tenant isolation service.
Source code in accessibility_mgr/services/multi_tenant.py
Persistent analytics¶
Purpose: durable analytics storage and retrieval.
Persistent analytics service — SQLite-backed KPI storage.
AUDIT-FIX-007: this was previously an empty subclass of AnalyticsService with no override at all:
class PersistentAnalyticsService(AnalyticsService):
'''Compatibility wrapper for API-facing analytics access.'''
Despite the name, every metric was stored in a plain Python list and lost on every restart. This now persists metrics to a real SQLite table in the same database the rest of the application uses.
PersistentAnalyticsService
¶
Bases: AnalyticsService
SQLite-backed analytics service.
Source code in accessibility_mgr/services/persistent_analytics.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
Persistent provenance¶
Purpose: durable provenance registry back-end.
Persistent provenance registry — SQLite-backed provenance events.
AUDIT-FIX-007: this was previously an empty subclass of ProvenanceRegistry with no override at all, so despite the name every provenance event was stored in a plain Python list and lost on every restart. It now persists events to a real SQLite table in the same database the rest of the application uses.
PersistentProvenanceRegistry
¶
Bases: ProvenanceRegistry
SQLite-backed provenance registry.
Source code in accessibility_mgr/services/persistent_provenance.py
Persistent queue¶
Purpose: durable workflow queue persistence and replay.
Persistent distributed workflow queue backend.
AUDIT-FIX-004/006: this module was fully implemented (a genuine SQLite-backed queue) but was never imported anywhere else in the codebase — the live app used the in-memory WorkflowQueueService instead, so "Persistent SQLite-backed workflow queue" was true of this file in isolation but not true of anything a user could actually reach. It now has full method parity with WorkflowQueueService (next_job / complete_job / fail_job) so it can be used as a drop-in replacement, and services/singletons.py has been updated to use it.
PersistentWorkflowQueue
¶
SQLite-backed distributed workflow queue.
Method names intentionally mirror WorkflowQueueService (enqueue / next_job / complete_job / fail_job / list_jobs) so this can be used as a drop-in replacement wherever that class is used.
Source code in accessibility_mgr/services/persistent_queue.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
Pipeline service¶
Purpose: pipeline orchestration, step flow, and status lifecycle.
Pipeline service — multi-stage accessibility production workflow automation.
Each pipeline definition carries ordered steps with tool names and commands. Execution runs each step via ExecutionService and persists run records to DB.
PipelineRunResult
dataclass
¶
Outcome of a complete pipeline execution, including per-step results.
Source code in accessibility_mgr/services/pipeline_service.py
PipelineService
¶
Service for listing and executing multi-step workflow pipelines.
Source code in accessibility_mgr/services/pipeline_service.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
get_pipeline(name)
staticmethod
¶
Look up a pipeline by name, or return None if not found.
list_pipelines()
staticmethod
¶
run_pipeline(name, input_path='')
staticmethod
¶
Execute all steps of a named pipeline, persisting results to DB.
Each step's required_binary is checked via shutil.which before
execution. Missing binaries produce an explicit FAIL result with
installation guidance rather than silently returning success.
Source code in accessibility_mgr/services/pipeline_service.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
PipelineStep
dataclass
¶
A single step in a multi-stage workflow pipeline.
Source code in accessibility_mgr/services/pipeline_service.py
WorkflowPipeline
dataclass
¶
An ordered collection of PipelineSteps representing a production workflow.
Source code in accessibility_mgr/services/pipeline_service.py
Provenance registry¶
Purpose: provenance event registration and lookup.
Unified provenance registry.
Aggregates metadata audit events, QA artifacts, and QA execution history into a normalized provenance timeline abstraction.
ProvenanceRegistry
¶
Central provenance aggregation service.
Source code in accessibility_mgr/services/provenance_registry.py
QA service¶
Purpose: QA workflow execution, scoring, and result emission.
QA service — accessibility validation tool registry and execution.
Changes applied (see fix_specs.json): FIX-012 When job_type and job_id are provided, a QA_RUN event is written to the job's metadata_event record in addition to qa_run table.
QAService
¶
Service for listing and executing QA tooling commands.
Source code in accessibility_mgr/services/qa_service.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
log_manual_qa_review(tool_name, asset_path, passed, reviewer, notes, job_type=None, job_id=None)
staticmethod
¶
Persist a manual QA review finding to qa_run and optionally to a job's event log.
Used by the 'Record Manual Review' form for tools where no CLI
exists (manual_review=True), such as ANZAGG Validation. Writing a
real record here replaces the previous behavior of running echo
and fabricating a SUCCESS result.
Source code in accessibility_mgr/services/qa_service.py
run_tool(name, input_path='', job_type=None, job_id=None)
staticmethod
¶
Execute a QA tool, persist the result, and return it.
FIX-012: When job_type and job_id are provided, a QA_RUN event is also written to the job's metadata_event record so the result appears in the job's audit trail.
Source code in accessibility_mgr/services/qa_service.py
RBAC¶
Purpose: role-based access control logic and permission checks.
Role-based access control infrastructure.
RBACService
¶
Central authorization service.
Source code in accessibility_mgr/services/rbac.py
SLA monitoring¶
Purpose: SLA tracking and breach detection helpers.
SLA monitoring and operational escalation infrastructure — SQLite-backed.
SLAMonitoringService
¶
SQLite-backed SLA and escalation monitoring.
Source code in accessibility_mgr/services/sla_monitoring.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
Toolchain core¶
Purpose: shared toolchain runtime helpers.
Accessibility toolchain integration layer.
Provides subprocess execution wrappers for: - DAISY Ace - EPUBCheck - DAISY Pipeline
This layer standardizes: - timeout handling - artifact capture - execution isolation - structured results
AccessibilityToolchainService
¶
Accessibility subprocess execution service.
Source code in accessibility_mgr/services/toolchain.py
Toolchain binaries¶
Purpose: discovery and management of external binary dependencies.
Production accessibility binary integrations.
Provides executable wrappers for: - DAISY Ace CLI - EPUBCheck - Liblouis braille translation (lou_translate / file2brl) - GLOW (ACB Large Print Toolkit)
This layer extends the existing subprocess abstraction with: - binary discovery - secure invocation - artifact output directories - structured execution contracts
AccessibilityBinaryIntegrationService
¶
Production binary integration service.
Source code in accessibility_mgr/services/toolchain_binaries.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
run_glow_audit(source_path)
¶
Audit a document with the GLOW (ACB Large Print Toolkit) CLI.
Source code in accessibility_mgr/services/toolchain_binaries.py
run_liblouis_translation(source_path, *, table='en-ueb-g2.ctb', use_file2brl=True)
¶
Translate source_path to BRF using Liblouis.
Uses the real file2brl (preferred) or lou_translate binary.
Parameters¶
source_path:
Path to the plain-text or formatted source document.
table:
Liblouis braille table name (default: en-ueb-g2.ctb for UEB grade 2).
use_file2brl:
When True (default), use file2brl which handles formatting.
When False, fall back to lou_translate for raw cell output.
Returns a dict with keys status, output_path, and
execution (the raw ToolExecutionResult dict).
Source code in accessibility_mgr/services/toolchain_binaries.py
Tools service¶
Purpose: tool-path resolution and command helper entrypoints.
Tools service — resolves external tool executables and augments PATH.
On import this module does nothing. Call bootstrap() (or init())
once at application startup to:
- Read
tools.inifrom the project root. - Prepend any
[paths] extradirectories toos.environ["PATH"]. - Resolve each tool's executable via the config, then
shutil.which(). - Cache resolved paths so the rest of the app can call
resolve(name)without re-scanning.
Tool names recognised
- "ace" → DAISY Ace
- "epubcheck" → EPUBCheck
- "pipeline" → DAISY Pipeline
- "liblouis" → LibLouis CLI (lou_translate / file2brl / etc.)
- "glow" → GLOW (ACB Large Print Toolkit, Community-Access)
bootstrap()
¶
Read tools.ini, extend PATH, and cache resolved tool paths.
Safe to call multiple times — subsequent calls are no-ops.
Source code in accessibility_mgr/services/tools_service.py
resolve(tool)
¶
Return the resolved absolute path for tool, or None if not found.
Calls bootstrap() automatically on first use.
Example::
ace_bin = tools_service.resolve("ace")
if ace_bin is None:
raise RuntimeError("DAISY Ace is not installed")
subprocess.run([ace_bin, "book.epub", "-o", "report"])
Source code in accessibility_mgr/services/tools_service.py
status()
¶
Return a copy of the resolved-tool map (useful for the Admin UI).
Worker runtime¶
Purpose: worker lifecycle and task execution runtime.
Background workflow worker runtime.
WorkerRuntime
¶
Simple threaded worker runtime.
Foundation for: - distributed orchestration - SLA monitoring - retry execution - async workflow execution
Source code in accessibility_mgr/services/worker_runtime.py
Workflow DAG¶
Purpose: DAG representation for workflow steps and dependencies.
Dependency-aware workflow DAG orchestration — SQLite-backed.
WorkflowDAGService
¶
SQLite-backed dependency-aware orchestration engine.
Source code in accessibility_mgr/services/workflow_dag.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
Workflow queue¶
Purpose: workflow job data structures.
Workflow queue primitives and in-memory queue service.
Provides:
- WorkflowJob dataclass shared across queue implementations.
- WorkflowQueueService in-memory priority queue that implements
the _QueueLike protocol used by WorkerRuntime.
The SQLite-backed PersistentWorkflowQueue in persistent_queue.py
is the production-grade replacement; this in-memory version is useful
for tests, lightweight deployments, and as a reference implementation.
WorkflowJob
dataclass
¶
Represents a single queued workflow execution request.
Source code in accessibility_mgr/services/workflow_queue.py
WorkflowQueueService
¶
In-memory priority queue for workflow execution requests.
Thread-safe. Implements the _QueueLike protocol expected by
WorkerRuntime: next_job() / complete_job() / fail_job() /
list_jobs().
Source code in accessibility_mgr/services/workflow_queue.py
complete_job(job)
¶
enqueue(*, workflow_name, asset_id, priority=5)
¶
Add a new job to the queue and return it.
Source code in accessibility_mgr/services/workflow_queue.py
fail_job(job)
¶
list_jobs()
¶
Return all jobs (queued, running, completed, failed) in insertion order.
Source code in accessibility_mgr/services/workflow_queue.py
next_job()
¶
Pop and return the highest-priority (lowest number) queued job.
Returns None when the queue is empty.