digitalkin 0.2.14__tar.gz → 0.2.15__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.
- {digitalkin-0.2.14 → digitalkin-0.2.15}/PKG-INFO +1 -1
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/modules/cpu_intensive_module.py +0 -1
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/modules/text_transform_module.py +0 -1
- digitalkin-0.2.15/examples/services/filesystem_module.py +198 -0
- {digitalkin-0.2.14/examples/modules → digitalkin-0.2.15/examples/services}/storage_module.py +20 -7
- {digitalkin-0.2.14 → digitalkin-0.2.15}/pyproject.toml +27 -3
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/__version__.py +1 -1
- digitalkin-0.2.15/src/digitalkin/services/filesystem/default_filesystem.py +405 -0
- digitalkin-0.2.15/src/digitalkin/services/filesystem/filesystem_strategy.py +206 -0
- digitalkin-0.2.15/src/digitalkin/services/filesystem/grpc_filesystem.py +322 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/setup/grpc_setup.py +1 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin.egg-info/PKG-INFO +1 -1
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin.egg-info/SOURCES.txt +2 -1
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin.egg-info/top_level.txt +1 -0
- digitalkin-0.2.14/src/digitalkin/services/filesystem/default_filesystem.py +0 -208
- digitalkin-0.2.14/src/digitalkin/services/filesystem/filesystem_strategy.py +0 -71
- digitalkin-0.2.14/src/digitalkin/services/filesystem/grpc_filesystem.py +0 -214
- {digitalkin-0.2.14 → digitalkin-0.2.15}/LICENSE +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/README.md +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/base_server/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/base_server/mock/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/base_server/mock/mock_pb2.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/base_server/mock/mock_pb2_grpc.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/base_server/server_async_insecure.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/base_server/server_async_secure.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/base_server/server_sync_insecure.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/base_server/server_sync_secure.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/modules/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/examples/modules/minimal_llm_module.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/setup.cfg +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/_base_server.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/module_server.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/module_servicer.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/registry_server.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/registry_servicer.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/utils/exceptions.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/utils/factory.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/utils/grpc_client_wrapper.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/utils/models.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/grpc_servers/utils/types.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/logger.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/models/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/models/module/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/models/module/module.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/models/module/module_types.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/models/services/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/models/services/cost.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/models/services/storage.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/_base_module.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/archetype_module.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/job_manager/base_job_manager.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/job_manager/job_manager_models.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/job_manager/single_job_manager.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/job_manager/taskiq_broker.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/job_manager/taskiq_job_manager.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/tool_module.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/modules/trigger_module.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/py.typed +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/agent/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/agent/agent_strategy.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/agent/default_agent.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/base_strategy.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/cost/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/cost/cost_strategy.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/cost/default_cost.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/cost/grpc_cost.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/filesystem/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/identity/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/identity/default_identity.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/identity/identity_strategy.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/registry/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/registry/default_registry.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/registry/registry_strategy.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/services_config.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/services_models.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/setup/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/setup/default_setup.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/setup/setup_strategy.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/snapshot/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/snapshot/default_snapshot.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/snapshot/snapshot_strategy.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/storage/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/storage/default_storage.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/storage/grpc_storage.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/services/storage/storage_strategy.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/utils/__init__.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/utils/arg_parser.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/utils/development_mode_action.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin/utils/llm_ready_schema.py +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin.egg-info/dependency_links.txt +0 -0
- {digitalkin-0.2.14 → digitalkin-0.2.15}/src/digitalkin.egg-info/requires.txt +0 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"""Example module implementation to test ArchetypeModule functionality."""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
import datetime
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from typing import TYPE_CHECKING, Any
|
|
7
|
+
|
|
8
|
+
from pydantic import BaseModel, Field
|
|
9
|
+
|
|
10
|
+
from digitalkin.logger import logger
|
|
11
|
+
from digitalkin.models.module import ModuleStatus
|
|
12
|
+
from digitalkin.modules.archetype_module import ArchetypeModule
|
|
13
|
+
from digitalkin.services.services_config import ServicesConfig
|
|
14
|
+
from digitalkin.services.services_models import ServicesMode
|
|
15
|
+
from digitalkin.services.filesystem.filesystem_strategy import FilesystemRecord, FileFilter, UploadFileData
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ExampleInput(BaseModel):
|
|
19
|
+
"""Input model for example module."""
|
|
20
|
+
|
|
21
|
+
message: str = Field(description="Message to process")
|
|
22
|
+
number: int = Field(description="Number to process")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ExampleOutput(BaseModel):
|
|
26
|
+
"""Output model for example module."""
|
|
27
|
+
|
|
28
|
+
processed_message: str = Field(description="The processed message")
|
|
29
|
+
processed_number: int = Field(description="The processed number")
|
|
30
|
+
timestamp: datetime.datetime = Field(description="When the processing was done")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ExampleSetup(BaseModel):
|
|
34
|
+
"""Setup model for example module."""
|
|
35
|
+
|
|
36
|
+
processing_mode: str = Field(description="Mode to process data in", default="default")
|
|
37
|
+
multiply_factor: int = Field(description="Factor to multiply number by", default=1)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ExampleSecret(BaseModel):
|
|
41
|
+
"""Secret model for example module."""
|
|
42
|
+
|
|
43
|
+
api_key: str = Field(description="API key for external service")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ExampleStorage(BaseModel):
|
|
47
|
+
"""Secret model for example module."""
|
|
48
|
+
|
|
49
|
+
test_key: str = Field(description="Test value for storage")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class ExampleModule(ArchetypeModule[ExampleInput, ExampleOutput, ExampleSetup, ExampleSecret, None]):
|
|
53
|
+
"""Example module that demonstrates ArchetypeModule functionality."""
|
|
54
|
+
|
|
55
|
+
name = "ExampleModule"
|
|
56
|
+
description = "An example module for testing purposes"
|
|
57
|
+
input_format = ExampleInput
|
|
58
|
+
output_format = ExampleOutput
|
|
59
|
+
setup_format = ExampleSetup
|
|
60
|
+
secret_format = ExampleSecret
|
|
61
|
+
metadata = {"name": "ExampleModule", "description": "A module for testing ArchetypeModule functionality"}
|
|
62
|
+
|
|
63
|
+
# Define services_config_params with default values
|
|
64
|
+
services_config_strategies = {}
|
|
65
|
+
services_config_params = {"cost": {"config": {}}, "storage": {"config": {}}} # Filesystem has no config but it's enabled
|
|
66
|
+
|
|
67
|
+
def __init__(self, job_id: str, mission_id: str, setup_version_id: str) -> None:
|
|
68
|
+
"""Initialize the example module.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
job_id: Unique identifier for the job
|
|
72
|
+
name: Optional name for the module
|
|
73
|
+
"""
|
|
74
|
+
# Initialize services configuration using the class attribute before the instance is created
|
|
75
|
+
self.services_config = ServicesConfig(
|
|
76
|
+
services_config_strategies=self.services_config_strategies,
|
|
77
|
+
services_config_params=self.services_config_params,
|
|
78
|
+
mode=ServicesMode.LOCAL,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
super().__init__(job_id, mission_id, setup_version_id)
|
|
82
|
+
|
|
83
|
+
async def initialize(self, setup_data: ExampleSetup) -> None:
|
|
84
|
+
"""Initialize the module.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
setup_data: Setup data for the module
|
|
88
|
+
"""
|
|
89
|
+
logger.info("Initializing ExampleModule with setup data: %s", setup_data)
|
|
90
|
+
self.setup = self.setup_format.model_validate(setup_data)
|
|
91
|
+
logger.info("Initialization complete, using processing mode: [%s]", self.setup.processing_mode)
|
|
92
|
+
|
|
93
|
+
async def run(
|
|
94
|
+
self,
|
|
95
|
+
input_data: dict[str, Any],
|
|
96
|
+
setup_data: ExampleSetup,
|
|
97
|
+
callback: Callable,
|
|
98
|
+
) -> None:
|
|
99
|
+
"""Run the module.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
input_data: Input data for the module
|
|
103
|
+
setup_data: Setup data for the module
|
|
104
|
+
callback: Callback function to report progress
|
|
105
|
+
"""
|
|
106
|
+
# Validate the input data
|
|
107
|
+
input_model = self.input_format.model_validate(input_data)
|
|
108
|
+
logger.info("Running with input data: %s", input_model)
|
|
109
|
+
|
|
110
|
+
# Process the data
|
|
111
|
+
processed_message = f"Processed: {input_model.message}"
|
|
112
|
+
processed_number = input_model.number * self.setup.multiply_factor
|
|
113
|
+
|
|
114
|
+
# Create output model
|
|
115
|
+
file = UploadFileData(
|
|
116
|
+
content=b"%s\n%s" % (processed_message.encode(), str(processed_number).encode()),
|
|
117
|
+
name="example_output.txt",
|
|
118
|
+
file_type="text/plain",
|
|
119
|
+
content_type="text/plain",
|
|
120
|
+
metadata={"example_key": "example_value"},
|
|
121
|
+
replace_if_exists=True,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
records, uploaded, failed = self.filesystem.upload_files(files=[file])
|
|
125
|
+
for record in records:
|
|
126
|
+
logger.info("Uploaded file: %s, uploaded: %d, failed: %d", record, uploaded, failed)
|
|
127
|
+
logger.info("Stored file with ID: %s", record.id)
|
|
128
|
+
callback(record.model_dump())
|
|
129
|
+
# Call the callback with the output data
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# Wait a bit to simulate processing time
|
|
133
|
+
await asyncio.sleep(1)
|
|
134
|
+
|
|
135
|
+
async def run_config_setup(
|
|
136
|
+
self,
|
|
137
|
+
setup_data: ExampleSetup,
|
|
138
|
+
) -> None:
|
|
139
|
+
"""Run the configuration setup for the module.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
setup_data: Setup data for the module
|
|
143
|
+
"""
|
|
144
|
+
logger.info("Running config setup with data: %s", setup_data)
|
|
145
|
+
# Here we could implement any additional configuration logic if needed
|
|
146
|
+
|
|
147
|
+
async def cleanup(self) -> None:
|
|
148
|
+
"""Clean up the module."""
|
|
149
|
+
logger.info("Cleaning up ExampleModule")
|
|
150
|
+
# Nothing to clean up in this example
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
async def test_module() -> None:
|
|
154
|
+
"""Test the example module."""
|
|
155
|
+
# Create the module
|
|
156
|
+
module = ExampleModule(job_id="test-job-123", mission_id="test-mission-123", setup_version_id="test-setup-123")
|
|
157
|
+
|
|
158
|
+
# Define input and setup data
|
|
159
|
+
input_data = ExampleInput(message="Hello, world!", number=42)
|
|
160
|
+
|
|
161
|
+
setup_data = ExampleSetup(processing_mode="test", multiply_factor=10)
|
|
162
|
+
|
|
163
|
+
# Define a callback function
|
|
164
|
+
def callback(result) -> None:
|
|
165
|
+
logger.info(f"callback {result}")
|
|
166
|
+
|
|
167
|
+
# Start the module
|
|
168
|
+
await module.start(input_data, setup_data, callback)
|
|
169
|
+
|
|
170
|
+
# Wait for the module to complete
|
|
171
|
+
while module.status not in {ModuleStatus.STOPPED, ModuleStatus.FAILED}:
|
|
172
|
+
await asyncio.sleep(0.5)
|
|
173
|
+
|
|
174
|
+
# Check the storage
|
|
175
|
+
if module.status == ModuleStatus.STOPPED:
|
|
176
|
+
files, nb_results = module.filesystem.get_files(
|
|
177
|
+
filters=FileFilter(name="example_output.txt", context="test-mission-123"),
|
|
178
|
+
)
|
|
179
|
+
for file in files:
|
|
180
|
+
module.filesystem.update_file(file.id, file_type="updated")
|
|
181
|
+
# module.filesystem.delete_files(filters=FileFilter(name="example_output.txt", context="test-mission-123"), permanent=True)
|
|
182
|
+
|
|
183
|
+
logger.info("Retrieved file: %s with ID: %s", file.name, file.id)
|
|
184
|
+
try:
|
|
185
|
+
file_record = module.filesystem.get_file(file_id=file.id, include_content=True)
|
|
186
|
+
if file_record:
|
|
187
|
+
logger.info("File ID: %s", file_record.id)
|
|
188
|
+
logger.info("File name: %s", file_record.name)
|
|
189
|
+
logger.info("File type: %s", file_record.file_type)
|
|
190
|
+
logger.info("File status: %s", file_record.status)
|
|
191
|
+
logger.info("File content: %s", file_record.content.decode())
|
|
192
|
+
except Exception:
|
|
193
|
+
logger.error("No file retrieved")
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
if __name__ == "__main__":
|
|
197
|
+
# Run the module test
|
|
198
|
+
asyncio.run(test_module())
|
{digitalkin-0.2.14/examples/modules → digitalkin-0.2.15/examples/services}/storage_module.py
RENAMED
|
@@ -51,7 +51,7 @@ class ExampleStorage(BaseModel):
|
|
|
51
51
|
test_key: str = Field(description="Test value for storage")
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
class ExampleModule(ArchetypeModule[ExampleInput, ExampleOutput, ExampleSetup, ExampleSecret]):
|
|
54
|
+
class ExampleModule(ArchetypeModule[ExampleInput, ExampleOutput, ExampleSetup, ExampleSecret, None]):
|
|
55
55
|
"""Example module that demonstrates ArchetypeModule functionality."""
|
|
56
56
|
|
|
57
57
|
name = "ExampleModule"
|
|
@@ -64,14 +64,15 @@ class ExampleModule(ArchetypeModule[ExampleInput, ExampleOutput, ExampleSetup, E
|
|
|
64
64
|
|
|
65
65
|
# Define services_config_params with default values
|
|
66
66
|
services_config_strategies = {}
|
|
67
|
-
services_config_params = {"storage": {"config": {"example": ExampleOutput}},
|
|
67
|
+
services_config_params = {"storage": {"config": {"example": ExampleOutput}},"cost": {"config":{}}}
|
|
68
68
|
|
|
69
|
-
def __init__(self, job_id: str, mission_id: str) -> None:
|
|
69
|
+
def __init__(self, job_id: str, mission_id: str, setup_version_id: str) -> None:
|
|
70
70
|
"""Initialize the example module.
|
|
71
71
|
|
|
72
72
|
Args:
|
|
73
73
|
job_id: Unique identifier for the job
|
|
74
|
-
|
|
74
|
+
mission_id: Unique identifier for the mission
|
|
75
|
+
setup_version_id: Unique identifier for the setup version
|
|
75
76
|
"""
|
|
76
77
|
# Initialize services configuration using the class attribute before the instance is created
|
|
77
78
|
self.services_config = ServicesConfig(
|
|
@@ -80,7 +81,7 @@ class ExampleModule(ArchetypeModule[ExampleInput, ExampleOutput, ExampleSetup, E
|
|
|
80
81
|
mode=ServicesMode.LOCAL,
|
|
81
82
|
)
|
|
82
83
|
|
|
83
|
-
super().__init__(job_id, mission_id)
|
|
84
|
+
super().__init__(job_id, mission_id, setup_version_id)
|
|
84
85
|
|
|
85
86
|
async def initialize(self, setup_data: ExampleSetup) -> None:
|
|
86
87
|
"""Initialize the module.
|
|
@@ -92,6 +93,18 @@ class ExampleModule(ArchetypeModule[ExampleInput, ExampleOutput, ExampleSetup, E
|
|
|
92
93
|
self.setup = self.setup_format.model_validate(setup_data)
|
|
93
94
|
logger.info("Initialization complete, using processing mode: [%s]", self.setup.processing_mode)
|
|
94
95
|
|
|
96
|
+
async def run_config_setup(
|
|
97
|
+
self,
|
|
98
|
+
setup_data: ExampleSetup,
|
|
99
|
+
) -> None:
|
|
100
|
+
"""Run the configuration setup for the module.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
setup_data: Setup data for the module
|
|
104
|
+
"""
|
|
105
|
+
logger.info("Running config setup with data: %s", setup_data)
|
|
106
|
+
# Here we could implement any additional configuration logic if needed
|
|
107
|
+
|
|
95
108
|
async def run(
|
|
96
109
|
self,
|
|
97
110
|
input_data: dict[str, Any],
|
|
@@ -142,7 +155,7 @@ class ExampleModule(ArchetypeModule[ExampleInput, ExampleOutput, ExampleSetup, E
|
|
|
142
155
|
async def test_module() -> None:
|
|
143
156
|
"""Test the example module."""
|
|
144
157
|
# Create the module
|
|
145
|
-
module = ExampleModule(job_id="test-job-123", mission_id="test-mission-123")
|
|
158
|
+
module = ExampleModule(job_id="test-job-123", mission_id="test-mission-123", setup_version_id="test-setup-123")
|
|
146
159
|
|
|
147
160
|
# Define input and setup data
|
|
148
161
|
input_data = ExampleInput(message="Hello, world!", number=42)
|
|
@@ -171,7 +184,7 @@ async def test_module() -> None:
|
|
|
171
184
|
def test_storage_directly() -> None:
|
|
172
185
|
"""Test the storage service directly."""
|
|
173
186
|
# Initialize storage service
|
|
174
|
-
storage = ServicesConfig().storage(mission_id="test-mission", config={"example": ExampleStorage})
|
|
187
|
+
storage = ServicesConfig().storage(mission_id="test-mission",setup_version_id="test-setup-123", config={"example": ExampleStorage})
|
|
175
188
|
|
|
176
189
|
# Create a test record
|
|
177
190
|
storage.store("example", "test_table", {"test_key": "test_value"}, "OUTPUT")
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
keywords = [ "digitalkin", "kin", "agent", "gprc", "sdk" ]
|
|
14
14
|
# Version of the package automatically updated by bump2version (that is why it is separated)
|
|
15
|
-
version = "0.2.
|
|
15
|
+
version = "0.2.15"
|
|
16
16
|
|
|
17
17
|
classifiers = [
|
|
18
18
|
"Development Status :: 3 - Alpha",
|
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
"tool_module.py",
|
|
116
116
|
"trigger_module.py",
|
|
117
117
|
"generate_certificates.py",
|
|
118
|
-
"test_*.py",
|
|
119
|
-
"tests/*",
|
|
118
|
+
# "test_*.py",
|
|
119
|
+
# "tests/*",
|
|
120
120
|
"examples/*",
|
|
121
121
|
]
|
|
122
122
|
preview = true
|
|
@@ -186,9 +186,33 @@
|
|
|
186
186
|
"TRY002",
|
|
187
187
|
"FBT001",
|
|
188
188
|
"FBT002",
|
|
189
|
+
"ANN001",
|
|
189
190
|
"ANN003",
|
|
190
191
|
"ANN002",
|
|
191
192
|
"ARG002",
|
|
193
|
+
"PLR0914",
|
|
194
|
+
"PLR2004",
|
|
195
|
+
"PLR0915",
|
|
196
|
+
"PLR1702",
|
|
197
|
+
"D417",
|
|
198
|
+
"ARG001",
|
|
199
|
+
"D103",
|
|
200
|
+
"D102",
|
|
201
|
+
"D101",
|
|
202
|
+
"D107",
|
|
203
|
+
"N802",
|
|
204
|
+
"DOC201",
|
|
205
|
+
"DOC501",
|
|
206
|
+
"PERF203",
|
|
207
|
+
"C901",
|
|
208
|
+
"PLR0911",
|
|
209
|
+
"G004",
|
|
210
|
+
"ERA001",
|
|
211
|
+
"E501",
|
|
212
|
+
"ANN401",
|
|
213
|
+
"PLR0912",
|
|
214
|
+
"ANN201",
|
|
215
|
+
"D100"
|
|
192
216
|
]
|
|
193
217
|
|
|
194
218
|
[tool.ruff.lint.pylint]
|