Skip to content

Commit a978431

Browse files
committed
fix: update schema and behaviours
- Updated MLSysOps schema and regenerated model files - Adjusted nb to work with updated schema - Fixed typo in FailoverBehaviour - Updated ML_process_Behaviour to parse with new model - Minor adjustments in ml_models endpoint - Updated .gitignore
1 parent b83e2bd commit a978431

7 files changed

Lines changed: 162 additions & 1440 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
values.yaml
22
.idea/
3+
4+
__pycache__/
5+
*.pyc
6+
*.log

agents/mlsysops/spade/behaviors/FailoverBehaviour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def run(self):
2929
# Retrieve all apps and their statuses from Redis
3030
status_data = self.r.get_dict(self.r.dict_name)
3131
if not status_data:
32-
logger.debug("No Apps running on the frameworkF")
32+
logger.debug("No Apps running on the framework")
3333
return
3434

3535
# Filter for deployed apps (case-insensitive)

agents/mlsysops/spade/behaviors/ML_process_Behaviour.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ async def run(self):
7979

8080
try:
8181
await kubernetes_asyncio.config.load_kube_config(config_file=karmada_api_kubeconfig)
82+
logger.info(f" Karmada api config Loaded with external kubeconfig: {karmada_api_kubeconfig}")
8283
except kubernetes_asyncio.config.ConfigException:
8384
logger.error(f"Error loading karmada api config with external kubeconfig: {karmada_api_kubeconfig}")
8485
return
@@ -94,19 +95,19 @@ async def run(self):
9495

9596
q_info = self.r.pop(self.r.ml_q)
9697
q_info = q_info.replace("'", '"')
97-
print(q_info)
98+
logger.debug(q_info)
9899
data_queue = json.loads(q_info)
99-
if 'MLSysOpsApplication' not in data_queue:
100+
if 'MLSysOpsApp' not in data_queue:
100101
# probably it is removal
101-
print(f"fffff {data_queue.keys()}")
102+
logger.debug(f"DataKeys {data_queue.keys()}")
102103
for key in data_queue.keys():
103104
model_id = key
104105
else:
105-
model_id = data_queue["MLSysOpsApplication"]["mlsysops-id"]
106-
data_queue['MLSysOpsApplication']['name'] = data_queue['MLSysOpsApplication']['name'] + "-" + model_id
106+
model_id = data_queue["MLSysOpsApp"]["components"][0]["metadata"]["uid"]
107+
data_queue['MLSysOpsApp']['name'] = data_queue['MLSysOpsApp']['name'] + "-" + model_id
107108
try:
108-
comp_name = data_queue["MLSysOpsApplication"]["components"][0]["Component"]["name"]
109-
cluster_id = data_queue["MLSysOpsApplication"]["clusterPlacement"]["clusterID"][0]
109+
comp_name = data_queue["MLSysOpsApp"]["components"][0]["Component"]["name"]
110+
cluster_id = data_queue["MLSysOpsApp"]["clusterPlacement"]["clusterID"][0]
110111

111112
self.r.update_dict_value("ml_location", model_id, cluster_id)
112113
except KeyError:
@@ -116,7 +117,7 @@ async def run(self):
116117
group = "mlsysops.eu"
117118
version = "v1"
118119
plural = "mlsysopsapps"
119-
namespace = "default"
120+
namespace = "mlsysops"
120121
name = model_id
121122

122123
if self.r.get_dict_value("endpoint_hash", model_id) == "To_be_removed":
@@ -133,7 +134,7 @@ async def run(self):
133134
logger.debug(f"Custom Resource '{name}' deleted successfully.")
134135
await self.message_queue.put({
135136
"event": "application_removed",
136-
"payload": data_dict
137+
"payload": data_queue
137138
}
138139
)
139140
self.r.update_dict_value("endpoint_hash", model_id, "Removed")
@@ -161,10 +162,10 @@ async def run(self):
161162
await self.message_queue.put(
162163
{
163164
"event": "application_submitted",
164-
"payload": file_content
165+
"payload": data_queue
165166
}
166167
)
167-
168+
168169
logger.debug(f"Creating or updating Custom Resource: {name}")
169170
try:
170171
current_resource = await custom_api.get_namespaced_custom_object(

0 commit comments

Comments
 (0)