digitalkin 0.1.1__py3-none-any.whl → 0.2.1__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.
- base_server/__init__.py +1 -0
- base_server/mock/__init__.py +5 -0
- base_server/mock/mock_pb2.py +39 -0
- base_server/mock/mock_pb2_grpc.py +102 -0
- base_server/server_async_insecure.py +124 -0
- base_server/server_async_secure.py +142 -0
- base_server/server_sync_insecure.py +102 -0
- base_server/server_sync_secure.py +121 -0
- digitalkin/__init__.py +1 -11
- digitalkin/__version__.py +1 -4
- digitalkin/{grpc → grpc_servers}/__init__.py +1 -13
- digitalkin/{grpc → grpc_servers}/_base_server.py +3 -3
- digitalkin/{grpc → grpc_servers}/module_server.py +31 -13
- digitalkin/{grpc → grpc_servers}/module_servicer.py +30 -14
- digitalkin/{grpc → grpc_servers}/registry_server.py +13 -8
- digitalkin/{grpc → grpc_servers}/registry_servicer.py +8 -2
- digitalkin/{grpc → grpc_servers}/utils/factory.py +6 -4
- digitalkin/grpc_servers/utils/grpc_client_wrapper.py +68 -0
- digitalkin/{grpc → grpc_servers}/utils/models.py +1 -1
- digitalkin/models/__init__.py +1 -4
- digitalkin/models/module/__init__.py +8 -2
- digitalkin/models/module/module_types.py +10 -0
- digitalkin/models/services/__init__.py +0 -5
- digitalkin/modules/__init__.py +3 -3
- digitalkin/modules/_base_module.py +64 -27
- digitalkin/modules/archetype_module.py +2 -6
- digitalkin/modules/job_manager.py +46 -28
- digitalkin/modules/tool_module.py +3 -7
- digitalkin/modules/trigger_module.py +2 -7
- digitalkin/services/__init__.py +7 -9
- digitalkin/services/agent/__init__.py +2 -2
- digitalkin/services/agent/agent_strategy.py +3 -6
- digitalkin/services/agent/default_agent.py +1 -4
- digitalkin/services/base_strategy.py +18 -0
- digitalkin/services/cost/__init__.py +4 -3
- digitalkin/services/cost/cost_strategy.py +35 -5
- digitalkin/services/cost/default_cost.py +22 -5
- digitalkin/services/cost/grpc_cost.py +81 -0
- digitalkin/services/filesystem/__init__.py +4 -3
- digitalkin/services/filesystem/default_filesystem.py +197 -17
- digitalkin/services/filesystem/filesystem_strategy.py +54 -15
- digitalkin/services/filesystem/grpc_filesystem.py +209 -0
- digitalkin/services/identity/__init__.py +2 -2
- digitalkin/services/identity/default_identity.py +1 -1
- digitalkin/services/identity/identity_strategy.py +3 -1
- digitalkin/services/registry/__init__.py +2 -2
- digitalkin/services/registry/default_registry.py +1 -4
- digitalkin/services/registry/registry_strategy.py +3 -6
- digitalkin/services/services_config.py +176 -0
- digitalkin/services/services_models.py +61 -0
- digitalkin/services/setup/default_setup.py +222 -0
- digitalkin/services/setup/grpc_setup.py +307 -0
- digitalkin/services/setup/setup_strategy.py +145 -0
- digitalkin/services/snapshot/__init__.py +2 -2
- digitalkin/services/snapshot/default_snapshot.py +1 -1
- digitalkin/services/snapshot/snapshot_strategy.py +3 -4
- digitalkin/services/storage/__init__.py +4 -3
- digitalkin/services/storage/default_storage.py +184 -57
- digitalkin/services/storage/grpc_storage.py +76 -170
- digitalkin/services/storage/storage_strategy.py +195 -24
- digitalkin/utils/arg_parser.py +16 -17
- {digitalkin-0.1.1.dist-info → digitalkin-0.2.1.dist-info}/METADATA +8 -7
- digitalkin-0.2.1.dist-info/RECORD +78 -0
- {digitalkin-0.1.1.dist-info → digitalkin-0.2.1.dist-info}/WHEEL +1 -1
- digitalkin-0.2.1.dist-info/top_level.txt +3 -0
- modules/__init__.py +0 -0
- modules/minimal_llm_module.py +162 -0
- modules/storage_module.py +187 -0
- modules/text_transform_module.py +201 -0
- digitalkin/services/default_service.py +0 -13
- digitalkin/services/development_service.py +0 -10
- digitalkin/services/service_provider.py +0 -27
- digitalkin-0.1.1.dist-info/RECORD +0 -59
- digitalkin-0.1.1.dist-info/top_level.txt +0 -1
- /digitalkin/{grpc → grpc_servers}/utils/exceptions.py +0 -0
- /digitalkin/{grpc → grpc_servers}/utils/types.py +0 -0
- {digitalkin-0.1.1.dist-info → digitalkin-0.2.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
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 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.storage.storage_strategy import DataType, StorageRecord
|
|
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]):
|
|
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 = {"storage": {"config": {"example_outputs": ExampleOutput}}}
|
|
66
|
+
|
|
67
|
+
def __init__(self, job_id: str, mission_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)
|
|
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
|
+
output_data = self.output_format(
|
|
116
|
+
processed_message=processed_message,
|
|
117
|
+
processed_number=processed_number,
|
|
118
|
+
timestamp=datetime.datetime.now(),
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# Store the output data in storage
|
|
122
|
+
storage_id = self.storage.store("example_outputs", output_data.model_dump(), data_type=DataType.OUTPUT)
|
|
123
|
+
|
|
124
|
+
logger.info("Stored output data with ID: %s", storage_id)
|
|
125
|
+
|
|
126
|
+
# Call the callback with the output data
|
|
127
|
+
callback(output_data.model_dump())
|
|
128
|
+
|
|
129
|
+
# Wait a bit to simulate processing time
|
|
130
|
+
await asyncio.sleep(1)
|
|
131
|
+
|
|
132
|
+
async def cleanup(self) -> None:
|
|
133
|
+
"""Clean up the module."""
|
|
134
|
+
logger.info("Cleaning up ExampleModule")
|
|
135
|
+
# Nothing to clean up in this example
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
async def test_module() -> None:
|
|
139
|
+
"""Test the example module."""
|
|
140
|
+
# Create the module
|
|
141
|
+
module = ExampleModule(job_id="test-job-123", mission_id="test-mission-123")
|
|
142
|
+
|
|
143
|
+
# Define input and setup data
|
|
144
|
+
input_data = ExampleInput(message="Hello, world!", number=42)
|
|
145
|
+
|
|
146
|
+
setup_data = ExampleSetup(processing_mode="test", multiply_factor=10)
|
|
147
|
+
|
|
148
|
+
# Define a callback function
|
|
149
|
+
def callback(result) -> None:
|
|
150
|
+
for key, value in result.items():
|
|
151
|
+
pass
|
|
152
|
+
|
|
153
|
+
# Start the module
|
|
154
|
+
await module.start(input_data, setup_data, callback)
|
|
155
|
+
|
|
156
|
+
# Wait for the module to complete
|
|
157
|
+
while module.status not in {ModuleStatus.STOPPED, ModuleStatus.FAILED}:
|
|
158
|
+
await asyncio.sleep(0.5)
|
|
159
|
+
|
|
160
|
+
# Check the storage
|
|
161
|
+
if module.status == ModuleStatus.STOPPED:
|
|
162
|
+
result: StorageRecord = module.storage.read("example_outputs")
|
|
163
|
+
if result:
|
|
164
|
+
pass
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def test_storage_directly() -> None:
|
|
168
|
+
"""Test the storage service directly."""
|
|
169
|
+
# Initialize storage service
|
|
170
|
+
storage = ServicesConfig().storage(mission_id="test-mission", config={"test_table": ExampleStorage})
|
|
171
|
+
|
|
172
|
+
# Create a test record
|
|
173
|
+
storage.store("test_table", {"test_key": "test_value"}, DataType.OUTPUT)
|
|
174
|
+
|
|
175
|
+
# Retrieve the record
|
|
176
|
+
retrieved = storage.read("test_table")
|
|
177
|
+
|
|
178
|
+
if retrieved:
|
|
179
|
+
pass
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
if __name__ == "__main__":
|
|
183
|
+
# Run the module test
|
|
184
|
+
asyncio.run(test_module())
|
|
185
|
+
|
|
186
|
+
# Test storage directly
|
|
187
|
+
test_storage_directly()
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"""Simple module example transforming a text."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from collections.abc import Callable
|
|
5
|
+
from typing import Any, ClassVar
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel
|
|
8
|
+
|
|
9
|
+
from digitalkin.grpc_servers.utils.models import SecurityMode, ServerConfig, ServerMode
|
|
10
|
+
from digitalkin.modules._base_module import BaseModule
|
|
11
|
+
from digitalkin.services.setup.setup_strategy import SetupData
|
|
12
|
+
from digitalkin.services.storage.storage_strategy import DataType, StorageRecord
|
|
13
|
+
|
|
14
|
+
# Configure logging with clear formatting
|
|
15
|
+
logging.basicConfig(
|
|
16
|
+
level=logging.INFO,
|
|
17
|
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
18
|
+
)
|
|
19
|
+
logger = logging.getLogger(__name__)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# Define schema models using Pydantic
|
|
23
|
+
class TextTransformInput(BaseModel):
|
|
24
|
+
"""Input model defining what data the module expects."""
|
|
25
|
+
|
|
26
|
+
text: str
|
|
27
|
+
transform_count: int = 1 # Default to 1 transformation
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TextTransformOutput(BaseModel):
|
|
31
|
+
"""Output model defining what data the module produces."""
|
|
32
|
+
|
|
33
|
+
transformed_text: str
|
|
34
|
+
iteration: int # Tracks which transformation this is
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class TextTransformSetup(BaseModel):
|
|
38
|
+
"""Setup model defining module configuration parameters."""
|
|
39
|
+
|
|
40
|
+
shift_amount: int = 1 # Default Caesar shift by 1
|
|
41
|
+
uppercase: bool = False # Whether to convert to uppercase
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class TextTransformSecret(BaseModel):
|
|
45
|
+
"""Secret model defining module configuration parameters."""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class TextTransformStorage(BaseModel):
|
|
49
|
+
"""Secret model defining module configuration parameters."""
|
|
50
|
+
|
|
51
|
+
module: str = "Text_Transform_Module"
|
|
52
|
+
user: str = "user"
|
|
53
|
+
consumption: int = 0
|
|
54
|
+
ended: bool = False
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
server_config = ServerConfig(
|
|
58
|
+
host="[::]",
|
|
59
|
+
port=50151,
|
|
60
|
+
mode=ServerMode.ASYNC,
|
|
61
|
+
security=SecurityMode.INSECURE,
|
|
62
|
+
max_workers=10,
|
|
63
|
+
credentials=None,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class TextTransformModule(BaseModule[TextTransformInput, TextTransformOutput, TextTransformSetup, TextTransformSecret]):
|
|
68
|
+
"""A text transformation module that demonstrates streaming capabilities.
|
|
69
|
+
|
|
70
|
+
This module takes text input and performs multiple transformations on it,
|
|
71
|
+
sending back each transformation as a separate output message.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
# Define the schema formats for the module
|
|
75
|
+
name = "Text_Transform_Module"
|
|
76
|
+
input_format = TextTransformInput
|
|
77
|
+
output_format = TextTransformOutput
|
|
78
|
+
setup_format = TextTransformSetup
|
|
79
|
+
secret_format = TextTransformSecret
|
|
80
|
+
|
|
81
|
+
# Define module metadata for discovery
|
|
82
|
+
metadata: ClassVar[dict[str, Any]] = {
|
|
83
|
+
"name": "Text_Transform_Module",
|
|
84
|
+
"description": "Transforms input text using Caesar cipher with streaming output",
|
|
85
|
+
"version": "1.0.0",
|
|
86
|
+
"tags": ["text", "transformation", "encryption", "streaming"],
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# Define services_config_params with default values
|
|
90
|
+
services_config_strategies = {}
|
|
91
|
+
services_config_params = {
|
|
92
|
+
"storage": {
|
|
93
|
+
"config": {"monitor": TextTransformStorage, "setups": TextTransformStorage},
|
|
94
|
+
"server_config": server_config,
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async def initialize(self, setup_data: SetupData) -> None:
|
|
99
|
+
"""Initialize the module capabilities.
|
|
100
|
+
|
|
101
|
+
This method is called when the module is loaded by the server.
|
|
102
|
+
Use it to set up module-specific resources or configurations.
|
|
103
|
+
|
|
104
|
+
Raises:
|
|
105
|
+
Exception: If initialization fails.
|
|
106
|
+
"""
|
|
107
|
+
# Define what capabilities this module provides
|
|
108
|
+
self.capabilities = ["text-processing", "streaming", "transformation"]
|
|
109
|
+
logger.info(
|
|
110
|
+
"Module %s initialized with capabilities: %s",
|
|
111
|
+
self.metadata["name"],
|
|
112
|
+
self.capabilities,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
self.db_id = self.storage.store(
|
|
116
|
+
"monitor",
|
|
117
|
+
{
|
|
118
|
+
"module": self.metadata["name"],
|
|
119
|
+
"user": f"xxxx+{self.job_id}",
|
|
120
|
+
"consumption": 0,
|
|
121
|
+
"ended": False,
|
|
122
|
+
},
|
|
123
|
+
data_type=DataType.VIEW,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
async def run(
|
|
127
|
+
self,
|
|
128
|
+
input_data: dict[str, Any],
|
|
129
|
+
setup_data: SetupData,
|
|
130
|
+
callback: Callable,
|
|
131
|
+
) -> None:
|
|
132
|
+
"""Process input text and stream transformation results.
|
|
133
|
+
|
|
134
|
+
This method implements a Caesar cipher transformation on input text.
|
|
135
|
+
It demonstrates streaming capability by sending multiple outputs through
|
|
136
|
+
the callback for each transformation iteration.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
input_data: Contains the text to transform and number of iterations.
|
|
140
|
+
setup_data: Contains shift amount and uppercase flags.
|
|
141
|
+
callback: Function to send output data back to the client.
|
|
142
|
+
"""
|
|
143
|
+
text = input_data["text"]
|
|
144
|
+
transform_count = int(input_data["transform_count"])
|
|
145
|
+
logger.info("%s | %s", setup_data, type(setup_data))
|
|
146
|
+
shift_amount = int(setup_data.current_setup_version.content["shift_amount"])
|
|
147
|
+
uppercase = setup_data.current_setup_version.content["uppercase"]
|
|
148
|
+
|
|
149
|
+
logger.info(
|
|
150
|
+
"Running job %s with text: '%s', iterations: %s",
|
|
151
|
+
self.job_id,
|
|
152
|
+
text,
|
|
153
|
+
transform_count,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
# Process the text for each iteration
|
|
157
|
+
for i in range(transform_count):
|
|
158
|
+
# Apply Caesar cipher (shift each character by specified amount)
|
|
159
|
+
transformed = "".join([chr(ord(char) + shift_amount) if char.isalpha() else char for char in text])
|
|
160
|
+
|
|
161
|
+
# Apply uppercase transformation if configured
|
|
162
|
+
if uppercase:
|
|
163
|
+
transformed = transformed.upper()
|
|
164
|
+
|
|
165
|
+
output_data = TextTransformOutput(transformed_text=transformed, iteration=i + 1)
|
|
166
|
+
|
|
167
|
+
logger.info(
|
|
168
|
+
"Sending transformation %s/%s: '%s'",
|
|
169
|
+
i + 1,
|
|
170
|
+
transform_count,
|
|
171
|
+
transformed,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
monitor_obj: StorageRecord | None = self.storage.read("monitor")
|
|
175
|
+
if monitor_obj is None:
|
|
176
|
+
logger.error("Monitor object not found in storage.")
|
|
177
|
+
break
|
|
178
|
+
monitor_obj.data.consumption += 1
|
|
179
|
+
updated_monitor_obj: StorageRecord | None = self.storage.modify("monitor", monitor_obj.data.model_dump())
|
|
180
|
+
self.db_id = updated_monitor_obj.name if updated_monitor_obj else "monitor"
|
|
181
|
+
|
|
182
|
+
# Send results through callback and wait for acknowledgment
|
|
183
|
+
await callback(job_id=self.job_id, output_data=output_data.model_dump())
|
|
184
|
+
text = transformed
|
|
185
|
+
|
|
186
|
+
logger.info("Job %s completed with %s transformations", self.job_id, transform_count)
|
|
187
|
+
|
|
188
|
+
async def cleanup(self) -> None:
|
|
189
|
+
"""Clean up any resources when the module is stopped.
|
|
190
|
+
|
|
191
|
+
This method is called when the module is being shut down.
|
|
192
|
+
Use it to close connections, free resources, etc.
|
|
193
|
+
"""
|
|
194
|
+
logger.info(f"Cleaning up module {self.metadata['name']}")
|
|
195
|
+
monitor_obj = self.storage.read("monitor")
|
|
196
|
+
if monitor_obj is None:
|
|
197
|
+
logger.error("Monitor object not found in storage.")
|
|
198
|
+
return
|
|
199
|
+
monitor_obj.data.ended = True
|
|
200
|
+
updated_monitor_obj: StorageRecord | None = self.storage.modify("monitor", monitor_obj.data.model_dump())
|
|
201
|
+
self.db_id = updated_monitor_obj.name if updated_monitor_obj else "monitor"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"""Default entrypoint for a DigitalKin module's services."""
|
|
2
|
-
|
|
3
|
-
from digitalkin.services.service_provider import ServiceProvider
|
|
4
|
-
from digitalkin.services.storage.default_storage import DefaultStorage
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class DefaultServiceProvider(ServiceProvider):
|
|
8
|
-
"""Service Instance used as default service in a Module.
|
|
9
|
-
|
|
10
|
-
Currently only allow the default (local) database service.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
storage = DefaultStorage()
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"""Dev entrypoint for a DigitalKin module's services."""
|
|
2
|
-
|
|
3
|
-
from digitalkin.services.service_provider import ServiceProvider
|
|
4
|
-
from digitalkin.services.storage.grpc_storage import GrpcStorage
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class DevelopmentServiceProvider(ServiceProvider):
|
|
8
|
-
"""Service Instance used as a development service in a Module."""
|
|
9
|
-
|
|
10
|
-
storage = GrpcStorage()
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"""Service Provider definitions."""
|
|
2
|
-
|
|
3
|
-
from typing import ClassVar
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel
|
|
6
|
-
|
|
7
|
-
from digitalkin.services.agent.agent_strategy import AgentStrategy
|
|
8
|
-
from digitalkin.services.cost.cost_strategy import CostStrategy
|
|
9
|
-
from digitalkin.services.filesystem.filesystem_strategy import FilesystemStrategy
|
|
10
|
-
from digitalkin.services.identity.identity_strategy import IdentityStrategy
|
|
11
|
-
from digitalkin.services.registry.registry_strategy import RegistryStrategy
|
|
12
|
-
from digitalkin.services.snapshot.snapshot_strategy import SnapshotStrategy
|
|
13
|
-
from digitalkin.services.storage.storage_strategy import StorageStrategy
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class ServiceProvider(BaseModel):
|
|
17
|
-
"""Service class describing the available services in a Module."""
|
|
18
|
-
|
|
19
|
-
storage: ClassVar[StorageStrategy]
|
|
20
|
-
cost: ClassVar[CostStrategy]
|
|
21
|
-
snapshot: ClassVar[SnapshotStrategy]
|
|
22
|
-
registry: ClassVar[RegistryStrategy]
|
|
23
|
-
filesystem: ClassVar[FilesystemStrategy]
|
|
24
|
-
agent: ClassVar[AgentStrategy]
|
|
25
|
-
identity: ClassVar[IdentityStrategy]
|
|
26
|
-
|
|
27
|
-
model_config = {"arbitrary_types_allowed": True}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
digitalkin/__init__.py,sha256=-lXi1_j09LqoGKb5G5yYE1Px-GCv3e01GVdlR_HBYGU,425
|
|
2
|
-
digitalkin/__version__.py,sha256=ufsk7-Hv_LuYOeJWhJ5_b03iJSh5GN2IT8SJDyFWjXM,274
|
|
3
|
-
digitalkin/logger.py,sha256=9cDgyJV2QXXT8F--xRODFlZyDgjuTTXNdpCU3GdqCsk,382
|
|
4
|
-
digitalkin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
digitalkin/grpc/__init__.py,sha256=K4RLuuZmB4sGVHmpH7MyYvx0UTaEz0C70xUVX-zYS48,1050
|
|
6
|
-
digitalkin/grpc/_base_server.py,sha256=Y3JYo_bVqXhYr3ZRcgkD43_7sG0WmLZ5_g2GeXAYNr4,18625
|
|
7
|
-
digitalkin/grpc/module_server.py,sha256=nUizlFI03bs6OTy4dHsV9GbPhDSquyxRABQbtkUw-yA,8795
|
|
8
|
-
digitalkin/grpc/module_servicer.py,sha256=ocdNI1fng4DgPd_LhQg2VtBLfXwR34Txd7oQ2nwjR0Q,10918
|
|
9
|
-
digitalkin/grpc/registry_server.py,sha256=HGm3bd43Q9bMN_FJY37IhOTSEH9iVeZZTlfkGx7296M,2087
|
|
10
|
-
digitalkin/grpc/registry_servicer.py,sha256=9wtdWNsQzn3QOWC_ZkHb-09Tzzd-4tZkc5JrFhwBafc,16397
|
|
11
|
-
digitalkin/grpc/utils/exceptions.py,sha256=I00OM8p8up20He4dU1fiHsvdLj1DymjR_UmoeUm2MSA,785
|
|
12
|
-
digitalkin/grpc/utils/factory.py,sha256=RC8zh-y-Yq54G27Kn2UfgYalBeR0l_asYHPpU5yzoG8,5845
|
|
13
|
-
digitalkin/grpc/utils/models.py,sha256=N9yK3rHUCllh9uHkz17iv0SwF3bjOJ4RDPYkxCBQph0,5475
|
|
14
|
-
digitalkin/grpc/utils/types.py,sha256=rQ78s4nAet2jy-NIDj_PUWriT0kuGHr_w6ELjmjgBao,539
|
|
15
|
-
digitalkin/models/__init__.py,sha256=-j1DI6VklZXYn3gv7lFrR7HKxLKM3FGlqlE7Y4JVHrw,229
|
|
16
|
-
digitalkin/models/module/__init__.py,sha256=8Nd43spo0O3p3GSnWxzhnL9HOjHNY_6C-tKLv6MZMP4,135
|
|
17
|
-
digitalkin/models/module/module.py,sha256=vlIeWmH61NVEiJpRx0Crk4iB8hAUV4mG30likSyRFP4,686
|
|
18
|
-
digitalkin/models/services/__init__.py,sha256=xtKP4fYoQmowqWUgF5a35Dx1UPDwBm75C9PreYfXTLE,160
|
|
19
|
-
digitalkin/models/services/cost.py,sha256=QTEuFD6xz62nob0z4ksE-INJWcZ-iFiuNW5mvXhpFes,1599
|
|
20
|
-
digitalkin/models/services/storage.py,sha256=cYTVIriGKiprF9OerhSxmc_jM6fUTVwmeon1yQCinkE,143
|
|
21
|
-
digitalkin/modules/__init__.py,sha256=H-OwxX72K7cCkNVsCZtJc8Qx0rwPywXN8DUpUXCzCsM,224
|
|
22
|
-
digitalkin/modules/_base_module.py,sha256=S6wtWDXllF51wmYAKXNFuEMbisupKu_MPAgEGdYjd1o,5791
|
|
23
|
-
digitalkin/modules/archetype_module.py,sha256=pMa_NaQHd4L_oKCYczM_BIPby5VwSOKkdG6_L09qN8g,487
|
|
24
|
-
digitalkin/modules/job_manager.py,sha256=CPaoueyHHW6c3lkl6M1XGSXWdvndqj4PawxE0nwC1HQ,5408
|
|
25
|
-
digitalkin/modules/tool_module.py,sha256=Dt8ZoDmMZ2Rxf3ZVaWH7i74JUPdLRstMcvW0VA5LgOo,412
|
|
26
|
-
digitalkin/modules/trigger_module.py,sha256=sUWQdrS3LlnOUu_Rfmr7Jvt50AHWKeFyxgWYWTuEMNY,424
|
|
27
|
-
digitalkin/services/__init__.py,sha256=xr58TS7eCqPKIAZr1K71whvYy2tpiCwFKnXcOyQtX4Q,846
|
|
28
|
-
digitalkin/services/default_service.py,sha256=YOU8R4O5kKGBCQ0lUpeS8Ih14kpfAois_Isw6Q1YbTY,412
|
|
29
|
-
digitalkin/services/development_service.py,sha256=IaBTUXrcAPJvN8CSoCxyd2wrHY7MuKvuoNQGfE5NdXU,340
|
|
30
|
-
digitalkin/services/service_provider.py,sha256=ggHR_4uJN9MpI1JJOyeh7UIH0Sz4kMizwR3jtvgv7_A,1049
|
|
31
|
-
digitalkin/services/agent/__init__.py,sha256=m6NyxKWG0-EQkjSyU1VgUsOlPbfj26KG6hpsSsRXJLs,194
|
|
32
|
-
digitalkin/services/agent/agent_strategy.py,sha256=aQ5VJ9SOQnAqPGLraT0jjLHBsF10hc9FHosGCLzWhec,550
|
|
33
|
-
digitalkin/services/agent/default_agent.py,sha256=epqdZB0Tad-pYtyx_Fn2fqGNA_JnvGlhIP9EukqU1T0,397
|
|
34
|
-
digitalkin/services/cost/__init__.py,sha256=4I9cNPIN7Bj6b0vifKu3DYu_O--FpH5e9H1UMJjbypI,187
|
|
35
|
-
digitalkin/services/cost/cost_strategy.py,sha256=hWxQr46fbP67mcNEqQpaT0h4qN9p-o_lCgu02UTb70I,399
|
|
36
|
-
digitalkin/services/cost/default_cost.py,sha256=2DUnDu7_MlaMX1Zwn2MCUpWdKXh7L7npVYC159Eceew,301
|
|
37
|
-
digitalkin/services/filesystem/__init__.py,sha256=vfcC_Aox48qhGg7dfA0hN8YXzOD2nTBGL9fDnfi5sOs,229
|
|
38
|
-
digitalkin/services/filesystem/default_filesystem.py,sha256=EWR8y1MzJNdEOxXF9mvcfSMjUUVAYjthC017VkwKU_A,879
|
|
39
|
-
digitalkin/services/filesystem/filesystem_strategy.py,sha256=zSSe3is3DCCWQGu_SswEt0HGh-JfWtgsAdB3xgxh-y8,927
|
|
40
|
-
digitalkin/services/identity/__init__.py,sha256=D2VBvwkXx0JDEOvVH1dbDxv9G7RUkfbaUxhwAxN4_aA,214
|
|
41
|
-
digitalkin/services/identity/default_identity.py,sha256=cxUb0WKAtmlKlr5edpeMBty7CBctNQcZizi4nnr8YMg,358
|
|
42
|
-
digitalkin/services/identity/identity_strategy.py,sha256=FLZvBvcdfFs1lAwb0SB9AOTX-G1Sa0CfHhXQBlC7vaI,355
|
|
43
|
-
digitalkin/services/registry/__init__.py,sha256=RVwQ7M2Vx1xJpCh5-pAlePlfB5MU1pj3DSpaOtx4A6g,214
|
|
44
|
-
digitalkin/services/registry/default_registry.py,sha256=fF2CVOW52mMFhOA7q4Yb9c9P9GjB6lyEwpezORYPgdE,330
|
|
45
|
-
digitalkin/services/registry/registry_strategy.py,sha256=idSRg_95_fPrPbBT9g7fWby4_9KBPws9l-8ReXj1714,484
|
|
46
|
-
digitalkin/services/snapshot/__init__.py,sha256=awlR_9S64qO4SePQVYHclgAvzHEWyes9jpmFOTw382g,214
|
|
47
|
-
digitalkin/services/snapshot/default_snapshot.py,sha256=XrI3aaOaiVG9WuENVmbCn9w-oRDjOV5Pj8g0YBesVxk,1030
|
|
48
|
-
digitalkin/services/snapshot/snapshot_strategy.py,sha256=C7cPsV7eEqeGhAwjOJTIF3eyFJ00ADVgBBXhaBS6GMM,905
|
|
49
|
-
digitalkin/services/storage/__init__.py,sha256=mb6KS-8lPhh7Go65eVO3KuqugGR5QgRrBynOhfqvWUI,207
|
|
50
|
-
digitalkin/services/storage/default_storage.py,sha256=Brlpmjfie6KVieV-Gv3f0xJ8zRvRiPArkdZ7KWqGXNc,2855
|
|
51
|
-
digitalkin/services/storage/grpc_storage.py,sha256=wK6a9l1Fmc8WVAdKjd21XELm1KqLkGrtt4ziGcNR8sk,6893
|
|
52
|
-
digitalkin/services/storage/storage_strategy.py,sha256=yfEwMV_eeuk3r80-lXHqHOWGW8CR0IOjNJNV0FQlz8o,1300
|
|
53
|
-
digitalkin/utils/__init__.py,sha256=sJnY-ZUgsjMfojAjONC1VN14mhgIDnzyOlGkw21rRnM,28
|
|
54
|
-
digitalkin/utils/arg_parser.py,sha256=RGVXE2L0HwYCqA8ju5KjyOvOHvLvXS4psp8ha-LyLIs,4607
|
|
55
|
-
digitalkin-0.1.1.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
|
|
56
|
-
digitalkin-0.1.1.dist-info/METADATA,sha256=Swl_Epq2e8Jl4A6TRnVwR381DSA8PUfvNgb-drHNUws,29047
|
|
57
|
-
digitalkin-0.1.1.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
|
|
58
|
-
digitalkin-0.1.1.dist-info/top_level.txt,sha256=Fq3vZIKuGrYjfdNOqbKcbVQ4ac-HflvQzVadMhCXEMc,11
|
|
59
|
-
digitalkin-0.1.1.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
digitalkin
|
|
File without changes
|
|
File without changes
|
|
File without changes
|