digitalkin 0.2.23__py3-none-any.whl → 0.3.1.dev2__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.
Files changed (78) hide show
  1. digitalkin/__version__.py +1 -1
  2. digitalkin/core/__init__.py +1 -0
  3. digitalkin/core/common/__init__.py +9 -0
  4. digitalkin/core/common/factories.py +156 -0
  5. digitalkin/core/job_manager/__init__.py +1 -0
  6. digitalkin/{modules → core}/job_manager/base_job_manager.py +137 -31
  7. digitalkin/core/job_manager/single_job_manager.py +354 -0
  8. digitalkin/{modules → core}/job_manager/taskiq_broker.py +116 -22
  9. digitalkin/core/job_manager/taskiq_job_manager.py +541 -0
  10. digitalkin/core/task_manager/__init__.py +1 -0
  11. digitalkin/core/task_manager/base_task_manager.py +539 -0
  12. digitalkin/core/task_manager/local_task_manager.py +108 -0
  13. digitalkin/core/task_manager/remote_task_manager.py +87 -0
  14. digitalkin/core/task_manager/surrealdb_repository.py +266 -0
  15. digitalkin/core/task_manager/task_executor.py +249 -0
  16. digitalkin/core/task_manager/task_session.py +406 -0
  17. digitalkin/grpc_servers/__init__.py +1 -19
  18. digitalkin/grpc_servers/_base_server.py +3 -3
  19. digitalkin/grpc_servers/module_server.py +27 -43
  20. digitalkin/grpc_servers/module_servicer.py +51 -36
  21. digitalkin/grpc_servers/registry_server.py +2 -2
  22. digitalkin/grpc_servers/registry_servicer.py +4 -4
  23. digitalkin/grpc_servers/utils/__init__.py +1 -0
  24. digitalkin/grpc_servers/utils/exceptions.py +0 -8
  25. digitalkin/grpc_servers/utils/grpc_client_wrapper.py +4 -4
  26. digitalkin/grpc_servers/utils/grpc_error_handler.py +53 -0
  27. digitalkin/logger.py +73 -24
  28. digitalkin/mixins/__init__.py +19 -0
  29. digitalkin/mixins/base_mixin.py +10 -0
  30. digitalkin/mixins/callback_mixin.py +24 -0
  31. digitalkin/mixins/chat_history_mixin.py +110 -0
  32. digitalkin/mixins/cost_mixin.py +76 -0
  33. digitalkin/mixins/file_history_mixin.py +93 -0
  34. digitalkin/mixins/filesystem_mixin.py +46 -0
  35. digitalkin/mixins/logger_mixin.py +51 -0
  36. digitalkin/mixins/storage_mixin.py +79 -0
  37. digitalkin/models/core/__init__.py +1 -0
  38. digitalkin/{modules/job_manager → models/core}/job_manager_models.py +3 -3
  39. digitalkin/models/core/task_monitor.py +70 -0
  40. digitalkin/models/grpc_servers/__init__.py +1 -0
  41. digitalkin/{grpc_servers/utils → models/grpc_servers}/models.py +5 -5
  42. digitalkin/models/module/__init__.py +2 -0
  43. digitalkin/models/module/module.py +9 -1
  44. digitalkin/models/module/module_context.py +122 -6
  45. digitalkin/models/module/module_types.py +307 -19
  46. digitalkin/models/services/__init__.py +9 -0
  47. digitalkin/models/services/cost.py +1 -0
  48. digitalkin/models/services/storage.py +39 -5
  49. digitalkin/modules/_base_module.py +123 -118
  50. digitalkin/modules/tool_module.py +10 -2
  51. digitalkin/modules/trigger_handler.py +7 -6
  52. digitalkin/services/cost/__init__.py +9 -2
  53. digitalkin/services/cost/grpc_cost.py +9 -42
  54. digitalkin/services/filesystem/default_filesystem.py +0 -2
  55. digitalkin/services/filesystem/grpc_filesystem.py +10 -39
  56. digitalkin/services/setup/default_setup.py +5 -6
  57. digitalkin/services/setup/grpc_setup.py +52 -15
  58. digitalkin/services/storage/grpc_storage.py +4 -4
  59. digitalkin/services/user_profile/__init__.py +1 -0
  60. digitalkin/services/user_profile/default_user_profile.py +55 -0
  61. digitalkin/services/user_profile/grpc_user_profile.py +69 -0
  62. digitalkin/services/user_profile/user_profile_strategy.py +40 -0
  63. digitalkin/utils/__init__.py +28 -0
  64. digitalkin/utils/arg_parser.py +1 -1
  65. digitalkin/utils/development_mode_action.py +2 -2
  66. digitalkin/utils/dynamic_schema.py +483 -0
  67. digitalkin/utils/package_discover.py +1 -2
  68. {digitalkin-0.2.23.dist-info → digitalkin-0.3.1.dev2.dist-info}/METADATA +11 -30
  69. digitalkin-0.3.1.dev2.dist-info/RECORD +119 -0
  70. modules/dynamic_setup_module.py +362 -0
  71. digitalkin/grpc_servers/utils/factory.py +0 -180
  72. digitalkin/modules/job_manager/single_job_manager.py +0 -294
  73. digitalkin/modules/job_manager/taskiq_job_manager.py +0 -290
  74. digitalkin-0.2.23.dist-info/RECORD +0 -89
  75. /digitalkin/{grpc_servers/utils → models/grpc_servers}/types.py +0 -0
  76. {digitalkin-0.2.23.dist-info → digitalkin-0.3.1.dev2.dist-info}/WHEEL +0 -0
  77. {digitalkin-0.2.23.dist-info → digitalkin-0.3.1.dev2.dist-info}/licenses/LICENSE +0 -0
  78. {digitalkin-0.2.23.dist-info → digitalkin-0.3.1.dev2.dist-info}/top_level.txt +0 -0
@@ -1,294 +0,0 @@
1
- """Background module manager with single instance."""
2
-
3
- import asyncio
4
- import uuid
5
- from collections.abc import AsyncGenerator, AsyncIterator
6
- from contextlib import asynccontextmanager
7
- from typing import Any, Generic
8
-
9
- import grpc
10
-
11
- from digitalkin.logger import logger
12
- from digitalkin.models import ModuleStatus
13
- from digitalkin.models.module import InputModelT, OutputModelT, SetupModelT
14
- from digitalkin.modules._base_module import BaseModule
15
- from digitalkin.modules.job_manager.base_job_manager import BaseJobManager
16
- from digitalkin.modules.job_manager.job_manager_models import StreamCodeModel
17
- from digitalkin.services.services_models import ServicesMode
18
-
19
-
20
- class SingleJobManager(BaseJobManager, Generic[InputModelT, SetupModelT]):
21
- """Manages a single instance of a module job.
22
-
23
- This class ensures that only one instance of a module job is active at a time.
24
- It provides functionality to create, stop, and monitor module jobs, as well as
25
- to handle their output data.
26
- """
27
-
28
- modules: dict[str, BaseModule]
29
- queue: dict[str, asyncio.Queue]
30
-
31
- def __init__(
32
- self,
33
- module_class: type[BaseModule],
34
- services_mode: ServicesMode,
35
- ) -> None:
36
- """Initialize the job manager.
37
-
38
- Args:
39
- module_class: The class of the module to be managed.
40
- services_mode: The mode of operation for the services (e.g., ASYNC or SYNC).
41
- """
42
- super().__init__(module_class, services_mode)
43
-
44
- self._lock = asyncio.Lock()
45
- self.modules: dict[str, BaseModule] = {}
46
- self.queues: dict[str, asyncio.Queue] = {}
47
-
48
- async def generate_config_setup_module_response(self, job_id: str) -> SetupModelT:
49
- """Generate a stream consumer for a module's output data.
50
-
51
- This method creates an asynchronous generator that streams output data
52
- from a specific module job. If the module does not exist, it generates
53
- an error message.
54
-
55
- Args:
56
- job_id: The unique identifier of the job.
57
-
58
- Returns:
59
- SetupModelT: the SetupModelT object fully processed.
60
- """
61
- module = self.modules.get(job_id, None)
62
- logger.debug("Module %s found: %s", job_id, module)
63
-
64
- try:
65
- return await self.queues[job_id].get()
66
- finally:
67
- logger.info(f"{job_id=}: {self.queues[job_id].empty()}")
68
- del self.queues[job_id]
69
-
70
- async def create_config_setup_instance_job(
71
- self,
72
- config_setup_data: SetupModelT,
73
- mission_id: str,
74
- setup_id: str,
75
- setup_version_id: str,
76
- ) -> str:
77
- """Create and start a new module setup configuration job.
78
-
79
- This method initializes a new module job, assigns it a unique job ID,
80
- and starts the config setup it in the background.
81
-
82
- Args:
83
- config_setup_data: The input data required to start the job.
84
- setup_data: The setup configuration for the module.
85
- mission_id: The mission ID associated with the job.
86
- setup_id: The setup ID associated with the module.
87
- setup_version_id: The setup ID.
88
-
89
- Returns:
90
- str: The unique identifier (job ID) of the created job.
91
-
92
- Raises:
93
- Exception: If the module fails to start.
94
- """
95
- job_id = str(uuid.uuid4())
96
- # TODO: Ensure the job_id is unique.
97
- module = self.module_class(job_id, mission_id=mission_id, setup_id=setup_id, setup_version_id=setup_version_id)
98
- self.modules[job_id] = module
99
- self.queues[job_id] = asyncio.Queue()
100
-
101
- try:
102
- await module.start_config_setup(
103
- config_setup_data,
104
- await self.job_specific_callback(self.add_to_queue, job_id),
105
- )
106
- logger.debug("Module %s (%s) started successfully", job_id, module.name)
107
- except Exception:
108
- # Remove the module from the manager in case of an error.
109
- del self.modules[job_id]
110
- logger.exception("Failed to start module %s: %s", job_id)
111
- raise
112
- else:
113
- return job_id
114
-
115
- async def add_to_queue(self, job_id: str, output_data: OutputModelT) -> None: # type: ignore
116
- """Add output data to the queue for a specific job.
117
-
118
- This method is used as a callback to handle output data generated by a module job.
119
-
120
- Args:
121
- job_id: The unique identifier of the job.
122
- output_data: The output data produced by the job.
123
- """
124
- await self.queues[job_id].put(output_data.model_dump())
125
-
126
- @asynccontextmanager # type: ignore
127
- async def generate_stream_consumer(self, job_id: str) -> AsyncIterator[AsyncGenerator[dict[str, Any], None]]: # type: ignore
128
- """Generate a stream consumer for a module's output data.
129
-
130
- This method creates an asynchronous generator that streams output data
131
- from a specific module job. If the module does not exist, it generates
132
- an error message.
133
-
134
- Args:
135
- job_id: The unique identifier of the job.
136
-
137
- Yields:
138
- AsyncGenerator: A stream of output data or error messages.
139
- """
140
- module = self.modules.get(job_id, None)
141
-
142
- logger.debug("Module %s found: %s", job_id, module)
143
-
144
- async def _stream() -> AsyncGenerator[dict[str, Any], Any]:
145
- """Stream output data from the module.
146
-
147
- Yields:
148
- dict: Output data generated by the module.
149
- """
150
- if module is None:
151
- yield {
152
- "error": {
153
- "error_message": f"Module {job_id} not found",
154
- "code": grpc.StatusCode.NOT_FOUND,
155
- }
156
- }
157
- return
158
-
159
- try:
160
- while module.status == ModuleStatus.RUNNING or (
161
- not self.queues[job_id].empty()
162
- and module.status
163
- in {
164
- ModuleStatus.STOPPED,
165
- ModuleStatus.STOPPING,
166
- }
167
- ):
168
- logger.info(f"{job_id=}: {module.status=}")
169
- yield await self.queues[job_id].get()
170
-
171
- finally:
172
- del self.queues[job_id]
173
-
174
- yield _stream()
175
-
176
- async def create_module_instance_job(
177
- self,
178
- input_data: InputModelT,
179
- setup_data: SetupModelT,
180
- mission_id: str,
181
- setup_id: str,
182
- setup_version_id: str,
183
- ) -> str:
184
- """Create and start a new module job.
185
-
186
- This method initializes a new module job, assigns it a unique job ID,
187
- and starts it in the background.
188
-
189
- Args:
190
- input_data: The input data required to start the job.
191
- setup_data: The setup configuration for the module.
192
- mission_id: The mission ID associated with the job.
193
- setup_id: The setup ID associated with the module.
194
- setup_version_id: The setup Version ID associated with the module.
195
-
196
- Returns:
197
- str: The unique identifier (job ID) of the created job.
198
-
199
- Raises:
200
- Exception: If the module fails to start.
201
- """
202
- job_id = str(uuid.uuid4())
203
- # TODO: Ensure the job_id is unique.
204
- module = self.module_class(
205
- job_id,
206
- mission_id=mission_id,
207
- setup_id=setup_id,
208
- setup_version_id=setup_version_id,
209
- )
210
- self.modules[job_id] = module
211
- self.queues[job_id] = asyncio.Queue()
212
- callback = await self.job_specific_callback(self.add_to_queue, job_id)
213
-
214
- try:
215
- await module.start(
216
- input_data,
217
- setup_data,
218
- callback,
219
- done_callback=lambda _: asyncio.create_task(callback(StreamCodeModel(code="__END_OF_STREAM__"))),
220
- )
221
- logger.debug("Module %s (%s) started successfully", job_id, module.name)
222
- except Exception:
223
- # Remove the module from the manager in case of an error.
224
- del self.modules[job_id]
225
- logger.exception("Failed to start module %s: %s", job_id)
226
- raise
227
- else:
228
- return job_id
229
-
230
- async def stop_module(self, job_id: str) -> bool:
231
- """Stop a running module job.
232
-
233
- Args:
234
- job_id: The unique identifier of the job to stop.
235
-
236
- Returns:
237
- bool: True if the module was successfully stopped, False if it does not exist.
238
-
239
- Raises:
240
- Exception: If an error occurs while stopping the module.
241
- """
242
- async with self._lock:
243
- module = self.modules.get(job_id)
244
- if not module:
245
- logger.warning(f"Module {job_id} not found")
246
- return False
247
- try:
248
- await module.stop()
249
- # should maybe be added in finally
250
- del self.queues[job_id]
251
- del self.modules[job_id]
252
- logger.debug(f"Module {job_id} ({module.name}) stopped successfully")
253
- except Exception as e:
254
- logger.error(f"Error while stopping module {job_id}: {e}")
255
- raise
256
- else:
257
- return True
258
-
259
- async def get_module_status(self, job_id: str) -> ModuleStatus | None:
260
- """Retrieve the status of a module job.
261
-
262
- Args:
263
- job_id: The unique identifier of the job.
264
-
265
- Returns:
266
- ModuleStatus | None: The status of the module, or None if it does not exist.
267
- """
268
- module = self.modules.get(job_id)
269
- return module.status if module else None
270
-
271
- async def stop_all_modules(self) -> None:
272
- """Stop all currently running module jobs.
273
-
274
- This method ensures that all active jobs are gracefully terminated.
275
- """
276
- async with self._lock:
277
- stop_tasks = [self.stop_module(job_id) for job_id in list(self.modules.keys())]
278
- if stop_tasks:
279
- await asyncio.gather(*stop_tasks, return_exceptions=True)
280
-
281
- async def list_modules(self) -> dict[str, dict[str, Any]]:
282
- """List all modules along with their statuses.
283
-
284
- Returns:
285
- dict[str, dict[str, Any]]: A dictionary containing information about all modules and their statuses.
286
- """
287
- return {
288
- job_id: {
289
- "name": module.name,
290
- "status": module.status,
291
- "class": module.__class__.__name__,
292
- }
293
- for job_id, module in self.modules.items()
294
- }
@@ -1,290 +0,0 @@
1
- """Taskiq job manager module."""
2
-
3
- try:
4
- import taskiq # noqa: F401
5
-
6
- except ImportError:
7
- msg = "Install digitalkin[taskiq] to use this functionality\n$ uv pip install digitalkin[taskiq]."
8
- raise ImportError(msg)
9
-
10
- import asyncio
11
- import contextlib
12
- import json
13
- import os
14
- from collections.abc import AsyncGenerator, AsyncIterator
15
- from contextlib import asynccontextmanager
16
- from typing import TYPE_CHECKING, Any, Generic
17
-
18
- from rstream import Consumer, ConsumerOffsetSpecification, MessageContext, OffsetType
19
-
20
- from digitalkin.logger import logger
21
- from digitalkin.models.module import InputModelT, SetupModelT
22
- from digitalkin.models.module.module import ModuleStatus
23
- from digitalkin.modules._base_module import BaseModule
24
- from digitalkin.modules.job_manager.base_job_manager import BaseJobManager
25
- from digitalkin.modules.job_manager.taskiq_broker import STREAM, STREAM_RETENTION, TASKIQ_BROKER
26
- from digitalkin.services.services_models import ServicesMode
27
-
28
- if TYPE_CHECKING:
29
- from taskiq.task import AsyncTaskiqTask
30
-
31
-
32
- class TaskiqJobManager(BaseJobManager, Generic[InputModelT, SetupModelT]):
33
- """Taskiq job manager for running modules in Taskiq tasks."""
34
-
35
- services_mode: ServicesMode
36
-
37
- @staticmethod
38
- def _define_consumer() -> Consumer:
39
- """Get from the env the connection parameter to RabbitMQ.
40
-
41
- Returns:
42
- Consumer
43
- """
44
- host: str = os.environ.get("RABBITMQ_RSTREAM_HOST", "localhost")
45
- port: str = os.environ.get("RABBITMQ_RSTREAM_PORT", "5552")
46
- username: str = os.environ.get("RABBITMQ_RSTREAM_USERNAME", "guest")
47
- password: str = os.environ.get("RABBITMQ_RSTREAM_PASSWORD", "guest")
48
-
49
- logger.info("Connection to RabbitMQ: %s:%s.", host, port)
50
- return Consumer(host=host, port=int(port), username=username, password=password)
51
-
52
- async def _on_message(self, message: bytes, message_context: MessageContext) -> None: # noqa: ARG002
53
- """Internal callback: parse JSON and route to the correct job queue."""
54
- try:
55
- data = json.loads(message.decode("utf-8"))
56
- except json.JSONDecodeError:
57
- return
58
- job_id = data.get("job_id")
59
- if not job_id:
60
- return
61
- queue = self.job_queues.get(job_id)
62
- if queue:
63
- await queue.put(data.get("output_data"))
64
-
65
- async def _start(self) -> None:
66
- await TASKIQ_BROKER.startup()
67
-
68
- self.stream_consumer = self._define_consumer()
69
-
70
- await self.stream_consumer.create_stream(
71
- STREAM,
72
- exists_ok=True,
73
- arguments={"max-length-bytes": STREAM_RETENTION},
74
- )
75
- await self.stream_consumer.start()
76
-
77
- start_spec = ConsumerOffsetSpecification(OffsetType.LAST)
78
- # on_message use bytes instead of AMQPMessage
79
- await self.stream_consumer.subscribe(
80
- stream=STREAM,
81
- subscriber_name=f"""subscriber_{os.environ.get("SERVER_NAME", "module_servicer")}""",
82
- callback=self._on_message, # type: ignore
83
- offset_specification=start_spec,
84
- )
85
- self.stream_consumer_task = asyncio.create_task(
86
- self.stream_consumer.run(),
87
- name="stream_consumer_task",
88
- )
89
-
90
- async def _stop(self) -> None:
91
- # Signal the consumer to stop
92
- await self.stream_consumer.close()
93
- # Cancel the background task
94
- self.stream_consumer_task.cancel()
95
- with contextlib.suppress(asyncio.CancelledError):
96
- await self.stream_consumer_task
97
-
98
- def __init__(
99
- self,
100
- module_class: type[BaseModule],
101
- services_mode: ServicesMode,
102
- ) -> None:
103
- """Initialize the Taskiq job manager."""
104
- super().__init__(module_class, services_mode)
105
-
106
- logger.warning("TaskiqJobManager initialized with app: %s", TASKIQ_BROKER)
107
- self.services_mode = services_mode
108
- self.job_queues: dict[str, asyncio.Queue] = {}
109
- self.max_queue_size = 1000
110
-
111
- async def generate_config_setup_module_response(self, job_id: str) -> SetupModelT:
112
- """Generate a stream consumer for a module's output data.
113
-
114
- This method creates an asynchronous generator that streams output data
115
- from a specific module job. If the module does not exist, it generates
116
- an error message.
117
-
118
- Args:
119
- job_id: The unique identifier of the job.
120
-
121
- Returns:
122
- SetupModelT: the SetupModelT object fully processed.
123
- """
124
- queue: asyncio.Queue = asyncio.Queue(maxsize=self.max_queue_size)
125
- self.job_queues[job_id] = queue
126
-
127
- try:
128
- item = await queue.get()
129
- queue.task_done()
130
- return item
131
- finally:
132
- logger.info(f"generate_config_setup_module_response: {job_id=}: {self.job_queues[job_id].empty()}")
133
- self.job_queues.pop(job_id, None)
134
-
135
- async def create_config_setup_instance_job(
136
- self,
137
- config_setup_data: SetupModelT,
138
- mission_id: str,
139
- setup_id: str,
140
- setup_version_id: str,
141
- ) -> str:
142
- """Create and start a new module setup configuration job.
143
-
144
- This method initializes a new module job, assigns it a unique job ID,
145
- and starts the config setup it in the background.
146
-
147
- Args:
148
- config_setup_data: The input data required to start the job.
149
- setup_data: The setup configuration for the module.
150
- mission_id: The mission ID associated with the job.
151
- setup_id: The setup ID associated with the module.
152
- setup_version_id: The setup ID.
153
-
154
- Returns:
155
- str: The unique identifier (job ID) of the created job.
156
-
157
- Raises:
158
- TypeError: If the function is called with bad data type.
159
- ValueError: If the module fails to start.
160
- """
161
- task = TASKIQ_BROKER.find_task("digitalkin.modules.job_manager.taskiq_broker:run_config_module")
162
-
163
- if task is None:
164
- msg = "Task not found"
165
- raise ValueError(msg)
166
-
167
- if config_setup_data is None:
168
- msg = "config_setup_data must be a valid model with model_dump method"
169
- raise TypeError(msg)
170
-
171
- running_task: AsyncTaskiqTask[Any] = await task.kiq(
172
- mission_id,
173
- setup_id,
174
- setup_version_id,
175
- self.module_class,
176
- self.services_mode,
177
- config_setup_data.model_dump(), # type: ignore
178
- )
179
-
180
- job_id = running_task.task_id
181
- result = await running_task.wait_result(timeout=10)
182
- logger.info("Job %s with data %s", job_id, result)
183
- return job_id
184
-
185
- @asynccontextmanager # type: ignore
186
- async def generate_stream_consumer(self, job_id: str) -> AsyncIterator[AsyncGenerator[dict[str, Any], None]]: # type: ignore
187
- """Generate a stream consumer for the RStream stream.
188
-
189
- Args:
190
- job_id: The job ID to filter messages.
191
-
192
- Yields:
193
- messages: The stream messages from the associated module.
194
- """
195
- queue: asyncio.Queue = asyncio.Queue(maxsize=self.max_queue_size)
196
- self.job_queues[job_id] = queue
197
-
198
- async def _stream() -> AsyncGenerator[dict[str, Any], Any]:
199
- """Generate the stream allowing flowless communication.
200
-
201
- Yields:
202
- dict: generated object from the module
203
- """
204
- while True:
205
- item = await queue.get()
206
- queue.task_done()
207
- yield item
208
-
209
- while True:
210
- try:
211
- item = queue.get_nowait()
212
- except asyncio.QueueEmpty:
213
- break
214
- queue.task_done()
215
- yield item
216
-
217
- try:
218
- yield _stream()
219
- finally:
220
- self.job_queues.pop(job_id, None)
221
-
222
- async def create_module_instance_job(
223
- self,
224
- input_data: InputModelT,
225
- setup_data: SetupModelT,
226
- mission_id: str,
227
- setup_id: str,
228
- setup_version_id: str,
229
- ) -> str:
230
- """Launches the module_task in Taskiq, returns the Taskiq task id as job_id.
231
-
232
- Args:
233
- input_data: Input data for the module
234
- setup_data: Setup data for the module
235
- mission_id: Mission ID for the module
236
- setup_id: The setup ID associated with the module.
237
- setup_version_id: The setup ID associated with the module.
238
-
239
- Returns:
240
- job_id: The Taskiq task id.
241
-
242
- Raises:
243
- ValueError: If the task is not found.
244
- """
245
- task = TASKIQ_BROKER.find_task("digitalkin.modules.job_manager.taskiq_broker:run_start_module")
246
-
247
- if task is None:
248
- msg = "Task not found"
249
- raise ValueError(msg)
250
-
251
- running_task: AsyncTaskiqTask[Any] = await task.kiq(
252
- mission_id,
253
- setup_id,
254
- setup_version_id,
255
- self.module_class,
256
- self.services_mode,
257
- input_data.model_dump(),
258
- setup_data.model_dump(),
259
- )
260
- job_id = running_task.task_id
261
- result = await running_task.wait_result(timeout=10)
262
- logger.debug("Job %s with data %s", job_id, result)
263
- return job_id
264
-
265
- async def stop_module(self, job_id: str) -> bool:
266
- """Revoke (terminate) the Taskiq task with id.
267
-
268
- Args:
269
- job_id: The Taskiq task id to stop.
270
-
271
- Raises:
272
- bool: True if the task was successfully revoked, False otherwise.
273
- """
274
- msg = "stop_module not implemented in TaskiqJobManager"
275
- raise NotImplementedError(msg)
276
-
277
- async def stop_all_modules(self) -> None:
278
- """Stop all running modules."""
279
- msg = "stop_all_modules not implemented in TaskiqJobManager"
280
- raise NotImplementedError(msg)
281
-
282
- async def get_module_status(self, job_id: str) -> ModuleStatus | None:
283
- """Query a module status."""
284
- msg = "get_module_status not implemented in TaskiqJobManager"
285
- raise NotImplementedError(msg)
286
-
287
- async def list_modules(self) -> dict[str, dict[str, Any]]:
288
- """List all modules."""
289
- msg = "list_modules not implemented in TaskiqJobManager"
290
- raise NotImplementedError(msg)
@@ -1,89 +0,0 @@
1
- base_server/__init__.py,sha256=gs8t9Dg0dNVHRdYYbEQY8bn8tzEUv2zE6eBhKNPG3kU,88
2
- base_server/server_async_insecure.py,sha256=Rvj5Xj8tDMglAj6aOGlQdMeD-FL97_OBEhHYHxxQrVo,3887
3
- base_server/server_async_secure.py,sha256=SV_CqEmD6YNHHP2Y369T2PLPJ-9JG3bvXytchX_Ensk,4684
4
- base_server/server_sync_insecure.py,sha256=VgSH8YghagK3fiwHhc7d6__zjN6lj_FgBUponFbOoxM,3127
5
- base_server/server_sync_secure.py,sha256=MMkq67vAZNiDLJSySjoXtHIEIK1pAlRz57n75Egnndk,3939
6
- base_server/mock/__init__.py,sha256=YZFT-F1l_TpvJYuIPX-7kTeE1CfOjhx9YmNRXVoi-jQ,143
7
- base_server/mock/mock_pb2.py,sha256=sETakcS3PAAm4E-hTCV1jIVaQTPEAIoVVHupB8Z_k7Y,1843
8
- base_server/mock/mock_pb2_grpc.py,sha256=BbOT70H6q3laKgkHfOx1QdfmCS_HxCY4wCOX84YAdG4,3180
9
- digitalkin/__init__.py,sha256=7LLBAba0th-3SGqcpqFO-lopWdUkVLKzLZiMtB-mW3M,162
10
- digitalkin/__version__.py,sha256=ztRCETPoZd6W_J-mnJ5nS74c-ka0qrOuTY9L88iKUGc,191
11
- digitalkin/logger.py,sha256=I6ARTJ2oWJ97VqMT2oMb6JU2J2GKOZi9LZk7PUplh2E,2889
12
- digitalkin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- digitalkin/grpc_servers/__init__.py,sha256=0cJBlwipSmFdXkyH3T0i6OJ1WpAtNsZgYX7JaSnkbtg,804
14
- digitalkin/grpc_servers/_base_server.py,sha256=NXnnZPjJqUDWoumhEbb7EOEWB7d8XYwpQs-l97NTe4k,18647
15
- digitalkin/grpc_servers/module_server.py,sha256=81l1i32F7XGQDgBXjQ7Dpukh-KTpmHzM5PKka8LjviE,10386
16
- digitalkin/grpc_servers/module_servicer.py,sha256=hhUAH6K5OcvkQEbXQUeUTAHJxkus-KlVwJnG1bGHTo4,18963
17
- digitalkin/grpc_servers/registry_server.py,sha256=StY18DKYoPKQIU1SIzgito6D4_QA1aMVddZ8O2WGlHY,2223
18
- digitalkin/grpc_servers/registry_servicer.py,sha256=dqsKGHZ0LnaIvGt4ipaAuigd37sbJBndT4MAT029GsY,16471
19
- digitalkin/grpc_servers/utils/exceptions.py,sha256=SyOgvjggaUECYmSiqy8KJLHwHVt5IClSTxslHM-IZzI,931
20
- digitalkin/grpc_servers/utils/factory.py,sha256=jm6rFjiqmtSv7BIHNAOxsG9xXtSvWpx9TfzSQiX97MQ,5899
21
- digitalkin/grpc_servers/utils/grpc_client_wrapper.py,sha256=iPHwVAaGeuV0ZW7YhTc7E3SWPyWX244Cy0iFf2DSf_Q,2685
22
- digitalkin/grpc_servers/utils/models.py,sha256=hiwiGHy3sEBBFdOUBCoC1n_7GVeJhjRmi0sl4tCEJy0,8965
23
- digitalkin/grpc_servers/utils/types.py,sha256=rQ78s4nAet2jy-NIDj_PUWriT0kuGHr_w6ELjmjgBao,539
24
- digitalkin/models/__init__.py,sha256=hDHtUfswaNh8wo4NZaBItg9JqC0uNSRqXArNWSrGynY,163
25
- digitalkin/models/module/__init__.py,sha256=fgTVbsNmLZgM43Vy-Ea5-g0EG3pncmAmJl9nk-OQdzo,561
26
- digitalkin/models/module/module.py,sha256=NWOwCeD_NH0NL89AF_NJ0SwE7G1n-HTcRalodLCDmpM,749
27
- digitalkin/models/module/module_context.py,sha256=AL6bzwjYfYPLHb1Hu5kKBjaIOxCpBCPMvxEnapdyrX4,1003
28
- digitalkin/models/module/module_types.py,sha256=IygT4MnS-ihI3s0oaPf4DibWcKlq7hvQCjgPc9JAH6g,3511
29
- digitalkin/models/services/__init__.py,sha256=HsW7MUGFPvH7Ri28WN4BHHBfEQk5dzU_9FOWAc-0lSE,56
30
- digitalkin/models/services/cost.py,sha256=QTEuFD6xz62nob0z4ksE-INJWcZ-iFiuNW5mvXhpFes,1599
31
- digitalkin/models/services/storage.py,sha256=cYTVIriGKiprF9OerhSxmc_jM6fUTVwmeon1yQCinkE,143
32
- digitalkin/modules/__init__.py,sha256=VwVbKok81NGyPIBZgEj_SR-59G8tTlSb4eBJI9W6Vx4,281
33
- digitalkin/modules/_base_module.py,sha256=uZ19kOgF-z5iEXjtfp0mBlex5XnifvuxFc7_Gj810qE,17365
34
- digitalkin/modules/archetype_module.py,sha256=lOe3yYufwfylZR_VGy1w-zqdqVaMI_JANfKkbH9eODE,471
35
- digitalkin/modules/tool_module.py,sha256=h9oo2vrFJdiBLW2qL_m79a9hEzfXV0L6bZd4KD5OSQs,422
36
- digitalkin/modules/trigger_handler.py,sha256=TpxFc_xkYia9B9rAvHkj02e818W08JOfIqssQqbsCpM,1785
37
- digitalkin/modules/job_manager/base_job_manager.py,sha256=4qrCw68ZAleZp8vnpd1qYH320aQO0ApH2cZrKM87Grk,6121
38
- digitalkin/modules/job_manager/job_manager_models.py,sha256=onHy-DfInLZQveniMIWIKwTKSQjojz500JvHB54x93c,1129
39
- digitalkin/modules/job_manager/single_job_manager.py,sha256=nMC1BX6G62Ehmam7aVSAlKW9ShJDB1ntuMq7KbD_sSI,10564
40
- digitalkin/modules/job_manager/taskiq_broker.py,sha256=4q3U03SNlb1ypup0VOa73KHLKJ9peuZUPCR5eFLMNAk,7498
41
- digitalkin/modules/job_manager/taskiq_job_manager.py,sha256=JxvNS95J_kEuRP08PvC3pQIO3DL8V1GRv7u6WUG59xg,10254
42
- digitalkin/services/__init__.py,sha256=LqGk_5DJy8Bzz62ajIq9jCeYNKQUIgtSCpafZk15FLc,910
43
- digitalkin/services/base_strategy.py,sha256=yA9KUJGRKuuaxA6l3GcMv8zKfWoIsW03UxJT80Yea2I,766
44
- digitalkin/services/services_config.py,sha256=JnyzZcG7OYBelwgn-wdVgY2n3yFTEkwLPHRZB8Tjw10,7468
45
- digitalkin/services/services_models.py,sha256=5zXkWcfKnXGwQi9sN4OAL3XrgqOcmsTl8ai5Mi4RPsw,1668
46
- digitalkin/services/agent/__init__.py,sha256=vJc8JN0pdtA8ecypLBeHrwAUIW6H2C8NyW-dk24rTpk,244
47
- digitalkin/services/agent/agent_strategy.py,sha256=42Q9RciHX6tg3CgDQkbrlIx4h_TX0WIuSpLmCjitVmA,492
48
- digitalkin/services/agent/default_agent.py,sha256=4N_E_eQxJGOx1KVUUg5jNOje-3ncMxF3ePB-uDuGrJc,345
49
- digitalkin/services/cost/__init__.py,sha256=Wi9ZB4LSXFsUYgkX-V1UJQkVXYDNDpp8q2dXccR2uRM,303
50
- digitalkin/services/cost/cost_strategy.py,sha256=MpPX33P_S5b2by6F4zT-rcyeRuh2V4NYPZe05VpDOGQ,2649
51
- digitalkin/services/cost/default_cost.py,sha256=XE7kNFde8NmbulU9m1lc3mi-vHFkbaJf0XHUc0D4UHE,3945
52
- digitalkin/services/cost/grpc_cost.py,sha256=cGtb0atPXSEEOrNIWee-o3ScfNRSAFXJGDu0vcWT6zg,6295
53
- digitalkin/services/filesystem/__init__.py,sha256=BhwMl_BUvM0d65fmglkp0SVwn3RfYiUOKJgIMnOCaGM,381
54
- digitalkin/services/filesystem/default_filesystem.py,sha256=qfC4jorfo86fBBnth-4ft13VuaGdvIHgWOVurCykXIk,15182
55
- digitalkin/services/filesystem/filesystem_strategy.py,sha256=zibVLvX_IBQ-kgh-KYzHdszDeiHFPEAZszu_k99x1GQ,9487
56
- digitalkin/services/filesystem/grpc_filesystem.py,sha256=ilxTFjelmf8_bVSs3xLlsyWFHVlSJf27c4j8H7R1Rkw,12987
57
- digitalkin/services/identity/__init__.py,sha256=InkeyLgFYYwItx8mePA8HpfacOMWZwwuc0G4pWtKq9s,270
58
- digitalkin/services/identity/default_identity.py,sha256=Y2auZHrGSZTIN5D8HyjLvLcNbYFM1CNUE23x7p5VIGw,386
59
- digitalkin/services/identity/identity_strategy.py,sha256=skappBbds1_qa0Gr24FGrNX1N0_OYhYT1Lh7dUaAirE,429
60
- digitalkin/services/registry/__init__.py,sha256=Zl4QAkCe9tOmmKGBWVuLQVFepdZiL0ec3VDj27IeyYM,270
61
- digitalkin/services/registry/default_registry.py,sha256=VnWkF6nHpFxUKuUbZLPqzXqdA6oXmyV_ySpeuOCf_ko,277
62
- digitalkin/services/registry/registry_strategy.py,sha256=uBXgZIv25jeXbeVO8vWvlNPxxNYu7_KiCw2PoE6AWr8,423
63
- digitalkin/services/setup/__init__.py,sha256=t6xcvEWqTbcRZstBFK9cESEqaZKvpW14VtYygxIqfYQ,65
64
- digitalkin/services/setup/default_setup.py,sha256=9VM3KwsuQcFQQ08RoOHWOE_-9BsRW0YGRtDWYTbQGdA,8246
65
- digitalkin/services/setup/grpc_setup.py,sha256=qjdED3HYZtpgeYYpiIwBWwPgB1NtoAuKmB5unNNRnVQ,12480
66
- digitalkin/services/setup/setup_strategy.py,sha256=ZnJ_HwWCkHCPrqKekSD5L9y3p8wMwfjQ8sj2hLZq6go,4004
67
- digitalkin/services/snapshot/__init__.py,sha256=Uzlnzo0CYlSpVsdiI37hW7xQk8hu3YA1fOI6O6MSzB0,270
68
- digitalkin/services/snapshot/default_snapshot.py,sha256=Mb8QwWRsHh9I_tN0ln_ZiFa1QCZxOVWmuVLemQOTWpc,1058
69
- digitalkin/services/snapshot/snapshot_strategy.py,sha256=B1TU3V_k9A-OdqBkdyc41-ihnrW5Btcwd1KyQdHT46A,898
70
- digitalkin/services/storage/__init__.py,sha256=T-ocYLLphudkQgzvG47jBOm5GQsRFRIGA88y7Ur4akg,341
71
- digitalkin/services/storage/default_storage.py,sha256=D8e-UYUkb2GvDEHMWcN3EkcIKXWA8DrsaQsXVjoXAYQ,7975
72
- digitalkin/services/storage/grpc_storage.py,sha256=3ZHGq3wnbF8dZjJcYN1EGTEUXA4rur0XEGtTBwAcGB4,7206
73
- digitalkin/services/storage/storage_strategy.py,sha256=sERF5tIJnzpb1iNqTXic9xRkGaXMifo6kb709ubB-Yo,8848
74
- digitalkin/utils/__init__.py,sha256=sJnY-ZUgsjMfojAjONC1VN14mhgIDnzyOlGkw21rRnM,28
75
- digitalkin/utils/arg_parser.py,sha256=nvjI1pKDY1HfS0oGcMQPtdTQcggXLtpxXMbnMxNEKRU,3109
76
- digitalkin/utils/development_mode_action.py,sha256=TqRuAF_A7bDD4twRB4PnZcRoNeaiAnEdxM5kvy4aoaA,1511
77
- digitalkin/utils/llm_ready_schema.py,sha256=JjMug_lrQllqFoanaC091VgOqwAd-_YzcpqFlS7p778,2375
78
- digitalkin/utils/package_discover.py,sha256=3e9-6Vf3yAAv2VkHHVK4QVqHJBxQqg3d8uuDTsXph24,13471
79
- digitalkin-0.2.23.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
80
- modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
- modules/cpu_intensive_module.py,sha256=ejB9XPnFfA0uCuFUQbM3fy5UYfqqAlF36rv_P5Ri8ho,8363
82
- modules/minimal_llm_module.py,sha256=Ijld__ZnhzfLwpXD1XVkLZ7jyKZKyOFZczOpiPttJZc,11216
83
- modules/text_transform_module.py,sha256=bwPSnEUthZQyfLwcTLo52iAxItAoknkLh8Y3m5aywaY,7251
84
- services/filesystem_module.py,sha256=71Mcja8jCQqiqFHPdsIXplFIHTvgkxRhp0TRXuCfgkk,7430
85
- services/storage_module.py,sha256=ybTMqmvGaTrR8PqJ4FU0cwxaDjT36TskVrGoetTGmno,6955
86
- digitalkin-0.2.23.dist-info/METADATA,sha256=6xGU63KlOxOodbF57XVFJGRE-2ufQiQISkzXaeuW_bw,30579
87
- digitalkin-0.2.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
88
- digitalkin-0.2.23.dist-info/top_level.txt,sha256=gcjqlyrZuLjIyxrOIavCQM_olpr6ND5kPKkZd2j0xGo,40
89
- digitalkin-0.2.23.dist-info/RECORD,,