avtomatika 1.0b6__tar.gz → 1.0b7__tar.gz

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.
Files changed (85) hide show
  1. {avtomatika-1.0b6/src/avtomatika.egg-info → avtomatika-1.0b7}/PKG-INFO +43 -3
  2. {avtomatika-1.0b6 → avtomatika-1.0b7}/README.md +42 -1
  3. {avtomatika-1.0b6 → avtomatika-1.0b7}/pyproject.toml +1 -2
  4. avtomatika-1.0b7/src/avtomatika/api/handlers.py +549 -0
  5. avtomatika-1.0b7/src/avtomatika/api/routes.py +118 -0
  6. avtomatika-1.0b7/src/avtomatika/app_keys.py +32 -0
  7. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/blueprint.py +125 -54
  8. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/context.py +2 -2
  9. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/data_types.py +3 -2
  10. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/dispatcher.py +1 -1
  11. avtomatika-1.0b7/src/avtomatika/engine.py +380 -0
  12. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/executor.py +21 -16
  13. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/scheduler.py +8 -8
  14. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/storage/memory.py +12 -7
  15. avtomatika-1.0b7/src/avtomatika/utils/__init__.py +0 -0
  16. avtomatika-1.0b7/src/avtomatika/utils/webhook_sender.py +54 -0
  17. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/watcher.py +1 -3
  18. {avtomatika-1.0b6 → avtomatika-1.0b7/src/avtomatika.egg-info}/PKG-INFO +43 -3
  19. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika.egg-info/SOURCES.txt +9 -0
  20. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika.egg-info/requires.txt +0 -1
  21. avtomatika-1.0b7/tests/test_blueprint_integrity.py +100 -0
  22. avtomatika-1.0b7/tests/test_engine.py +259 -0
  23. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_error_handling.py +21 -13
  24. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_executor.py +68 -0
  25. avtomatika-1.0b7/tests/test_handlers.py +451 -0
  26. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_history.py +4 -1
  27. avtomatika-1.0b7/tests/test_optimization.py +83 -0
  28. avtomatika-1.0b7/tests/test_webhook_sender.py +54 -0
  29. avtomatika-1.0b6/src/avtomatika/engine.py +0 -929
  30. avtomatika-1.0b6/tests/test_engine.py +0 -678
  31. {avtomatika-1.0b6 → avtomatika-1.0b7}/LICENSE +0 -0
  32. {avtomatika-1.0b6 → avtomatika-1.0b7}/setup.cfg +0 -0
  33. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/__init__.py +0 -0
  34. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/api.html +0 -0
  35. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/client_config_loader.py +0 -0
  36. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/compression.py +0 -0
  37. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/config.py +0 -0
  38. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/constants.py +0 -0
  39. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/datastore.py +0 -0
  40. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/health_checker.py +0 -0
  41. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/history/base.py +0 -0
  42. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/history/noop.py +0 -0
  43. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/history/postgres.py +0 -0
  44. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/history/sqlite.py +0 -0
  45. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/logging_config.py +0 -0
  46. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/metrics.py +0 -0
  47. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/py.typed +0 -0
  48. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/quota.py +0 -0
  49. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/ratelimit.py +0 -0
  50. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/reputation.py +0 -0
  51. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/scheduler_config_loader.py +0 -0
  52. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/security.py +0 -0
  53. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/storage/__init__.py +0 -0
  54. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/storage/base.py +0 -0
  55. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/storage/redis.py +0 -0
  56. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/telemetry.py +0 -0
  57. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/worker_config_loader.py +0 -0
  58. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika/ws_manager.py +0 -0
  59. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika.egg-info/dependency_links.txt +0 -0
  60. {avtomatika-1.0b6 → avtomatika-1.0b7}/src/avtomatika.egg-info/top_level.txt +0 -0
  61. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_blueprint_conditions.py +0 -0
  62. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_blueprints.py +0 -0
  63. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_client_config_loader.py +0 -0
  64. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_compression.py +0 -0
  65. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_config_validation.py +0 -0
  66. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_context.py +0 -0
  67. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_dispatcher.py +0 -0
  68. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_dispatcher_extended.py +0 -0
  69. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_health_checker.py +0 -0
  70. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_integration.py +0 -0
  71. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_logging_config.py +0 -0
  72. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_memory_locking.py +0 -0
  73. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_memory_storage.py +0 -0
  74. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_metrics.py +0 -0
  75. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_noop_history.py +0 -0
  76. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_postgres_history.py +0 -0
  77. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_ratelimit.py +0 -0
  78. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_redis_locking.py +0 -0
  79. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_redis_storage.py +0 -0
  80. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_reputation.py +0 -0
  81. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_scheduler.py +0 -0
  82. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_telemetry.py +0 -0
  83. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_watcher.py +0 -0
  84. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_worker_config_loader.py +0 -0
  85. {avtomatika-1.0b6 → avtomatika-1.0b7}/tests/test_ws_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: avtomatika
3
- Version: 1.0b6
3
+ Version: 1.0b7
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
@@ -12,7 +12,6 @@ Requires-Python: >=3.11
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: aiohttp~=3.12
15
- Requires-Dist: aiocache~=0.12
16
15
  Requires-Dist: python-json-logger~=4.0
17
16
  Requires-Dist: graphviz~=0.21
18
17
  Requires-Dist: zstandard~=0.24
@@ -61,6 +60,7 @@ This document serves as a comprehensive guide for developers looking to build pi
61
60
  - [Parallel Execution and Aggregation (Fan-out/Fan-in)](#parallel-execution-and-aggregation-fan-outfan-in)
62
61
  - [Dependency Injection (DataStore)](#dependency-injection-datastore)
63
62
  - [Native Scheduler](#native-scheduler)
63
+ - [Webhook Notifications](#webhook-notifications)
64
64
  - [Production Configuration](#production-configuration)
65
65
  - [Fault Tolerance](#fault-tolerance)
66
66
  - [Storage Backend](#storage-backend)
@@ -157,7 +157,13 @@ async def end_handler(context):
157
157
  engine = OrchestratorEngine(storage, config)
158
158
  engine.register_blueprint(my_blueprint)
159
159
 
160
- # 4. Define the main entrypoint to run the server
160
+ # 4. Accessing Components (Optional)
161
+ # You can access the internal aiohttp app and core components using AppKeys
162
+ # from avtomatika.app_keys import ENGINE_KEY, DISPATCHER_KEY
163
+ # app = engine.app
164
+ # dispatcher = app[DISPATCHER_KEY]
165
+
166
+ # 5. Define the main entrypoint to run the server
161
167
  async def main():
162
168
  await engine.start()
163
169
 
@@ -355,6 +361,40 @@ blueprint = "backup_flow"
355
361
  daily_at = "02:00"
356
362
  ```
357
363
 
364
+ ### 6. Webhook Notifications
365
+
366
+ The orchestrator can send asynchronous notifications to an external system when a job completes, fails, or is quarantined. This eliminates the need for clients to constantly poll the API for status updates.
367
+
368
+ * **Usage:** Pass a `webhook_url` in the request body when creating a job.
369
+ * **Events:**
370
+ * `job_finished`: The job reached a final success state.
371
+ * `job_failed`: The job failed (e.g., due to an error or invalid input).
372
+ * `job_quarantined`: The job was moved to quarantine after repeated failures.
373
+
374
+ **Example Request:**
375
+ ```json
376
+ POST /api/v1/jobs/my_flow
377
+ {
378
+ "initial_data": {
379
+ "video_url": "..."
380
+ },
381
+ "webhook_url": "https://my-app.com/webhooks/avtomatika"
382
+ }
383
+ ```
384
+
385
+ **Example Webhook Payload:**
386
+ ```json
387
+ {
388
+ "event": "job_finished",
389
+ "job_id": "123e4567-e89b-12d3-a456-426614174000",
390
+ "status": "finished",
391
+ "result": {
392
+ "output_path": "/videos/result.mp4"
393
+ },
394
+ "error": null
395
+ }
396
+ ```
397
+
358
398
  ## Production Configuration
359
399
 
360
400
  The orchestrator's behavior can be configured through environment variables. Additionally, any configuration parameter loaded from environment variables can be programmatically overridden in your application code after the `Config` object has been initialized. This provides flexibility for different deployment and testing scenarios.
@@ -15,6 +15,7 @@ This document serves as a comprehensive guide for developers looking to build pi
15
15
  - [Parallel Execution and Aggregation (Fan-out/Fan-in)](#parallel-execution-and-aggregation-fan-outfan-in)
16
16
  - [Dependency Injection (DataStore)](#dependency-injection-datastore)
17
17
  - [Native Scheduler](#native-scheduler)
18
+ - [Webhook Notifications](#webhook-notifications)
18
19
  - [Production Configuration](#production-configuration)
19
20
  - [Fault Tolerance](#fault-tolerance)
20
21
  - [Storage Backend](#storage-backend)
@@ -111,7 +112,13 @@ async def end_handler(context):
111
112
  engine = OrchestratorEngine(storage, config)
112
113
  engine.register_blueprint(my_blueprint)
113
114
 
114
- # 4. Define the main entrypoint to run the server
115
+ # 4. Accessing Components (Optional)
116
+ # You can access the internal aiohttp app and core components using AppKeys
117
+ # from avtomatika.app_keys import ENGINE_KEY, DISPATCHER_KEY
118
+ # app = engine.app
119
+ # dispatcher = app[DISPATCHER_KEY]
120
+
121
+ # 5. Define the main entrypoint to run the server
115
122
  async def main():
116
123
  await engine.start()
117
124
 
@@ -309,6 +316,40 @@ blueprint = "backup_flow"
309
316
  daily_at = "02:00"
310
317
  ```
311
318
 
319
+ ### 6. Webhook Notifications
320
+
321
+ The orchestrator can send asynchronous notifications to an external system when a job completes, fails, or is quarantined. This eliminates the need for clients to constantly poll the API for status updates.
322
+
323
+ * **Usage:** Pass a `webhook_url` in the request body when creating a job.
324
+ * **Events:**
325
+ * `job_finished`: The job reached a final success state.
326
+ * `job_failed`: The job failed (e.g., due to an error or invalid input).
327
+ * `job_quarantined`: The job was moved to quarantine after repeated failures.
328
+
329
+ **Example Request:**
330
+ ```json
331
+ POST /api/v1/jobs/my_flow
332
+ {
333
+ "initial_data": {
334
+ "video_url": "..."
335
+ },
336
+ "webhook_url": "https://my-app.com/webhooks/avtomatika"
337
+ }
338
+ ```
339
+
340
+ **Example Webhook Payload:**
341
+ ```json
342
+ {
343
+ "event": "job_finished",
344
+ "job_id": "123e4567-e89b-12d3-a456-426614174000",
345
+ "status": "finished",
346
+ "result": {
347
+ "output_path": "/videos/result.mp4"
348
+ },
349
+ "error": null
350
+ }
351
+ ```
352
+
312
353
  ## Production Configuration
313
354
 
314
355
  The orchestrator's behavior can be configured through environment variables. Additionally, any configuration parameter loaded from environment variables can be programmatically overridden in your application code after the `Config` object has been initialized. This provides flexibility for different deployment and testing scenarios.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "avtomatika"
7
- version = "1.0b6"
7
+ version = "1.0b7"
8
8
  description = "A state-machine based orchestrator for long-running AI and other jobs."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -16,7 +16,6 @@ classifiers = [
16
16
  ]
17
17
  dependencies = [
18
18
  "aiohttp~=3.12",
19
- "aiocache~=0.12",
20
19
  "python-json-logger~=4.0",
21
20
  "graphviz~=0.21",
22
21
  "zstandard~=0.24",