avtomatika 1.0b3__py3-none-any.whl → 1.0b4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
avtomatika/api.html CHANGED
@@ -199,17 +199,6 @@
199
199
  { code: '202 Accepted', description: 'Job successfully accepted for processing.', body: { "status": "accepted", "job_id": "..." } }
200
200
  ]
201
201
  },
202
- {
203
- id: 'post-create-showcase-job',
204
- name: 'Create a Full Showcase Job',
205
- method: 'POST',
206
- path: '/api/v1/jobs/full_showcase',
207
- description: 'Creates and starts a new instance (Job) of the `full_showcase` blueprint. This blueprint demonstrates most of the features of the Avtomatika library.',
208
- request: { body: { "path": "/path/to/video.mp4", "user_id": "user-123", "quality": "high" } },
209
- responses: [
210
- { code: '202 Accepted', description: 'Job successfully accepted for processing.', body: { "status": "accepted", "job_id": "..." } }
211
- ]
212
- },
213
202
  {
214
203
  id: 'get-job-status',
215
204
  name: 'Get Job Status',
avtomatika/engine.py CHANGED
@@ -599,17 +599,53 @@ class OrchestratorEngine:
599
599
  await load_client_configs_to_redis(self.storage)
600
600
  return web.json_response({"status": "db_flushed"}, status=200)
601
601
 
602
- @staticmethod
603
- async def _docs_handler(request: web.Request) -> web.Response:
602
+ async def _docs_handler(self, request: web.Request) -> web.Response:
603
+ import json
604
604
  from importlib import resources
605
605
 
606
606
  try:
607
607
  content = resources.read_text("avtomatika", "api.html")
608
- return web.Response(text=content, content_type="text/html")
609
608
  except FileNotFoundError:
610
609
  logger.error("api.html not found within the avtomatika package.")
611
610
  return web.json_response({"error": "Documentation file not found on server."}, status=500)
612
611
 
612
+ # Generate dynamic documentation for registered blueprints
613
+ blueprint_endpoints = []
614
+ for bp in self.blueprints.values():
615
+ if not bp.api_endpoint:
616
+ continue
617
+
618
+ version_prefix = f"/{bp.api_version}" if bp.api_version else ""
619
+ endpoint_path = bp.api_endpoint if bp.api_endpoint.startswith("/") else f"/{bp.api_endpoint}"
620
+ full_path = f"/api{version_prefix}{endpoint_path}"
621
+
622
+ blueprint_endpoints.append(
623
+ {
624
+ "id": f"post-create-{bp.name.replace('_', '-')}",
625
+ "name": f"Create {bp.name.replace('_', ' ').title()} Job",
626
+ "method": "POST",
627
+ "path": full_path,
628
+ "description": f"Creates and starts a new instance (Job) of the `{bp.name}` blueprint.",
629
+ "request": {"body": {"initial_data": {}}},
630
+ "responses": [
631
+ {
632
+ "code": "202 Accepted",
633
+ "description": "Job successfully accepted for processing.",
634
+ "body": {"status": "accepted", "job_id": "..."},
635
+ }
636
+ ],
637
+ }
638
+ )
639
+
640
+ # Inject dynamic endpoints into the apiData structure in the HTML
641
+ if blueprint_endpoints:
642
+ endpoints_json = json.dumps(blueprint_endpoints, indent=2)
643
+ # We insert the new endpoints at the beginning of the 'Protected API' group
644
+ marker = "group: 'Protected API',\n endpoints: ["
645
+ content = content.replace(marker, f"{marker}\n{endpoints_json.strip('[]')},")
646
+
647
+ return web.Response(text=content, content_type="text/html")
648
+
613
649
  def _setup_routes(self):
614
650
  public_app = web.Application()
615
651
  public_app.router.add_get("/status", status_handler)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: avtomatika
3
- Version: 1.0b3
3
+ Version: 1.0b4
4
4
  Summary: A state-machine based orchestrator for long-running AI and other jobs.
5
5
  Project-URL: Homepage, https://github.com/avtomatika-ai/avtomatika
6
6
  Project-URL: Bug Tracker, https://github.com/avtomatika-ai/avtomatika/issues
@@ -334,6 +334,24 @@ The orchestrator's behavior can be configured through environment variables. Add
334
334
 
335
335
  **Important:** The system employs **strict validation** for configuration files (`clients.toml`, `workers.toml`) at startup. If a configuration file is invalid (e.g., malformed TOML, missing required fields), the application will **fail fast** and exit with an error, rather than starting in a partially broken state. This ensures the security and integrity of the deployment.
336
336
 
337
+ ### Configuration Files
338
+
339
+ To manage access and worker settings securely, Avtomatika uses TOML configuration files.
340
+
341
+ - **`clients.toml`**: Defines API clients, their tokens, plans, and quotas.
342
+ ```toml
343
+ [client_premium]
344
+ token = "secret-token-123"
345
+ plan = "premium"
346
+ ```
347
+ - **`workers.toml`**: Defines individual tokens for workers to enhance security.
348
+ ```toml
349
+ [gpu-worker-01]
350
+ token = "worker-secret-456"
351
+ ```
352
+
353
+ For detailed specifications and examples, please refer to the [**Configuration Guide**](docs/configuration.md).
354
+
337
355
  ### Fault Tolerance
338
356
 
339
357
  The orchestrator has built-in mechanisms for handling failures based on the `error.code` field in a worker's response.
@@ -418,11 +436,21 @@ To run the `avtomatika` test suite:
418
436
  pytest avtomatika/tests/
419
437
  ```
420
438
 
439
+ ### Interactive API Documentation
440
+
441
+ Avtomatika provides a built-in interactive API documentation page (similar to Swagger UI) that is automatically generated based on your registered blueprints.
442
+
443
+ * **Endpoint:** `/_public/docs`
444
+ * **Features:**
445
+ * **List of all system endpoints:** Detailed documentation for Public, Protected, and Worker API groups.
446
+ * **Dynamic Blueprint Documentation:** Automatically generates and lists documentation for all blueprints registered in the engine, including their specific API endpoints.
447
+ * **Interactive Testing:** Allows you to test API calls directly from the browser. You can provide authentication tokens, parameters, and request bodies to see real server responses.
448
+
421
449
  ## Detailed Documentation
422
450
 
423
- For a deeper dive into the system, please refer to the following documents in the `docs/` directory:
451
+ For a deeper dive into the system, please refer to the following documents:
424
452
 
425
- - [**Architecture Guide**](docs/architecture.md): A detailed overview of the system components and their interactions.
426
- - [**API Reference**](docs/api_reference.md): Full specification of the HTTP API.
427
- - [**Deployment Guide**](docs/deployment.md): Instructions for deploying with Gunicorn/Uvicorn and NGINX.
428
- - [**Cookbook**](docs/cookbook/README.md): Examples and best practices for creating blueprints.
453
+ - [**Architecture Guide**](https://github.com/avtomatika-ai/avtomatika/blob/main/docs/architecture.md): A detailed overview of the system components and their interactions.
454
+ - [**API Reference**](https://github.com/avtomatika-ai/avtomatika/blob/main/docs/api_reference.md): Full specification of the HTTP API.
455
+ - [**Deployment Guide**](https://github.com/avtomatika-ai/avtomatika/blob/main/docs/deployment.md): Instructions for deploying with Gunicorn/Uvicorn and NGINX.
456
+ - [**Cookbook**](https://github.com/avtomatika-ai/avtomatika/blob/main/docs/cookbook/README.md): Examples and best practices for creating blueprints.
@@ -1,5 +1,5 @@
1
1
  avtomatika/__init__.py,sha256=nlk59j7YcK1gapRUVfHjvFZVAD_PZoamgHEptchP3TA,698
2
- avtomatika/api.html,sha256=Z-Ikqrle7YPXagx2D-C5ylVZicLQFSsIzPsHCQgqMHM,33628
2
+ avtomatika/api.html,sha256=RLx-D1uFCSAXIf_2WgFlSTWrWPcmonNYM-9oNanKXBg,32835
3
3
  avtomatika/blueprint.py,sha256=Hx5h0upr_IYbCy1ebUTpXw4bnt5yYhgWtdPLVE1_h48,9403
4
4
  avtomatika/client_config_loader.py,sha256=zVVHZlxSqZUaNpZ4zoU0T1CFYXdxy-3vKSmPcaFuHSY,2772
5
5
  avtomatika/compression.py,sha256=bhA1kw4YrCR3I3kdquZSY0fAzCrRrjtz55uepzLUDKI,2498
@@ -8,7 +8,7 @@ avtomatika/context.py,sha256=rnF09jqQGkaKlax8P5ku9USwijSm6dommDGZbeVrzLk,4295
8
8
  avtomatika/data_types.py,sha256=g-g5hPnCpzeATgOn5v7EvDm5ps314owFJD5iWJ6IPR0,1425
9
9
  avtomatika/datastore.py,sha256=ERMyiFYQpAhVYijxzTrrdm6jtIPFf4dngWIa0qod3Wc,551
10
10
  avtomatika/dispatcher.py,sha256=a_7DjJwSXbW-ZzqcjZG0ZXMYDD2JLZxpQRIzHOrjeow,9688
11
- avtomatika/engine.py,sha256=zwouopyGjHkyiE3dMndxu1uAIMOFvnV1h8-ZIFHIH-k,37507
11
+ avtomatika/engine.py,sha256=-y_gwj1YK_X3QZ6h02KntVep7vRtZWYf1RYFnXtUmP8,39213
12
12
  avtomatika/executor.py,sha256=JHwT2DR-Hbrb_-Le1-mVaXiiQ7z-PkMsuIYB9ciiVo0,21201
13
13
  avtomatika/health_checker.py,sha256=WXwvRJ-3cZC2Udc_ogsyIQp7VzcvJjq_IaqzkTdE0TE,1265
14
14
  avtomatika/logging_config.py,sha256=e0-eEEGHw1zz9ZshzXaxfavV0uZfamRNdcAeHnrgBYQ,1370
@@ -30,8 +30,8 @@ avtomatika/storage/__init__.py,sha256=ygqv240XuYuHjU_2eci0J3FWoJLNSRpUFA2GzBrHMK
30
30
  avtomatika/storage/base.py,sha256=BCC7uAQrko1UCwZo5kGF-0blwJiFcLCcT-pMnhYAxqY,10494
31
31
  avtomatika/storage/memory.py,sha256=7VhQO02SbYc65uDTOY9g43CVOgsodxzg-WYo0JGpUec,11387
32
32
  avtomatika/storage/redis.py,sha256=kgNUJuwcxQvCzul0m5COKhDnfJGKReMNeWxtG_BGfLc,18171
33
- avtomatika-1.0b3.dist-info/licenses/LICENSE,sha256=tqCjw9Y1vbU-hLcWi__7wQstLbt2T1XWPdbQYqCxuWY,1072
34
- avtomatika-1.0b3.dist-info/METADATA,sha256=OXavLWy_3WKrw5oW2Q8WdWvAdFFDA1-XvXGN59LQLKM,19455
35
- avtomatika-1.0b3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- avtomatika-1.0b3.dist-info/top_level.txt,sha256=gLDWhA_wxHj0I6fG5X8vw9fE0HSN4hTE2dEJzeVS2x8,11
37
- avtomatika-1.0b3.dist-info/RECORD,,
33
+ avtomatika-1.0b4.dist-info/licenses/LICENSE,sha256=tqCjw9Y1vbU-hLcWi__7wQstLbt2T1XWPdbQYqCxuWY,1072
34
+ avtomatika-1.0b4.dist-info/METADATA,sha256=o_4U54i5frChX81Jyw6SZcg18RCxloSj5uQ4A8dwilQ,20927
35
+ avtomatika-1.0b4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ avtomatika-1.0b4.dist-info/top_level.txt,sha256=gLDWhA_wxHj0I6fG5X8vw9fE0HSN4hTE2dEJzeVS2x8,11
37
+ avtomatika-1.0b4.dist-info/RECORD,,