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