SIENTIAPDE-1150
refactor: update samples.json to change server_id from 'default_server' to '1' for multiple tags; add 'active' and 'updated_at' fields for better state management in orchestration
This commit is contained in:
@@ -197,6 +197,7 @@ class MongoDB(BaseActivity):
|
||||
"""
|
||||
updated_pipelines = input_data.get("updated_pipelines", [])
|
||||
now = datetime.now().strftime(DEFAULT_DATE_FORMAT)
|
||||
collection = self.database["orchestrated_schedules"]
|
||||
|
||||
argument = [
|
||||
{"schedule_name": pipeline["schedule_name"],
|
||||
@@ -204,7 +205,7 @@ class MongoDB(BaseActivity):
|
||||
for pipeline in updated_pipelines if pipeline["success"]
|
||||
]
|
||||
data_filter = {"$or": argument} if argument else {}
|
||||
self.database["pipelines"].update_many(
|
||||
collection.update_many(
|
||||
data_filter,
|
||||
{"$set": {"updated_at": now}}
|
||||
)
|
||||
@@ -217,6 +218,7 @@ class MongoDB(BaseActivity):
|
||||
- created_pipelines (list): List of created pipelines.
|
||||
"""
|
||||
created_pipelines = input_data.get("created_pipelines", [])
|
||||
collection = self.database["orchestrated_schedules"]
|
||||
|
||||
now = datetime.now().strftime(DEFAULT_DATE_FORMAT)
|
||||
|
||||
@@ -227,7 +229,7 @@ class MongoDB(BaseActivity):
|
||||
for pipeline in created_pipelines if pipeline["success"]
|
||||
]
|
||||
data_filter = argument if argument else {}
|
||||
self.database["pipelines"].insert_many(data_filter)
|
||||
collection.insert_many(data_filter)
|
||||
|
||||
@activity.defn(name="delete_pipelines_timestamps")
|
||||
async def delete_pipelines_timestamps(self, input_data: dict[str, Any]) -> None:
|
||||
@@ -237,6 +239,7 @@ class MongoDB(BaseActivity):
|
||||
- deleted_pipelines (list): List of deleted pipelines.
|
||||
"""
|
||||
deleted_pipelines = input_data.get("deleted_pipelines", [])
|
||||
collection = self.database["orchestrated_schedules"]
|
||||
|
||||
argument = [
|
||||
{"schedule_name": pipeline["schedule_name"],
|
||||
@@ -245,4 +248,4 @@ class MongoDB(BaseActivity):
|
||||
]
|
||||
data_filter = {"$or": argument} if argument else {}
|
||||
|
||||
self.database["pipelines"].delete_many(data_filter)
|
||||
collection.delete_many(data_filter)
|
||||
|
||||
14
samples.json
14
samples.json
@@ -14,7 +14,7 @@
|
||||
"read_tags": [
|
||||
{
|
||||
"tag_name": "Counter",
|
||||
"server_id": "default_server",
|
||||
"server_id": "1",
|
||||
"aggr_func": "avg",
|
||||
"tag_address": "ns=2;i=2",
|
||||
"frequency": "15000",
|
||||
@@ -25,7 +25,7 @@
|
||||
},
|
||||
{
|
||||
"tag_name": "Rollout",
|
||||
"server_id": "default_server",
|
||||
"server_id": "1",
|
||||
"aggr_func": "mdn",
|
||||
"tag_address": "ns=2;i=3",
|
||||
"frequency": "15000",
|
||||
@@ -36,7 +36,7 @@
|
||||
},
|
||||
{
|
||||
"tag_name": "Square",
|
||||
"server_id": "default_server",
|
||||
"server_id": "1",
|
||||
"aggr_func": "lts",
|
||||
"tag_address": "ns=2;i=4",
|
||||
"frequency": "15000",
|
||||
@@ -56,7 +56,9 @@
|
||||
"policy": "DISCARD"
|
||||
}
|
||||
],
|
||||
"tag_retention_minutes": 60
|
||||
"tag_retention_minutes": 60,
|
||||
"active": true,
|
||||
"updated_at": "2025-07-14T10:00:00Z"
|
||||
},
|
||||
"2": {
|
||||
"schedule_name": "laborious-orchestrated-pipeline",
|
||||
@@ -115,7 +117,9 @@
|
||||
"STOP",
|
||||
"CONTINUE",
|
||||
"REPEAT"
|
||||
]
|
||||
],
|
||||
"active": true,
|
||||
"updated_at": "2025-07-14T10:00:00Z"
|
||||
}
|
||||
},
|
||||
"opc-servers": {
|
||||
|
||||
Reference in New Issue
Block a user