Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit 5c6a2d6

Browse files
committed
Implement topology-discovery create_backup worker
1 parent e12b43c commit 5c6a2d6

4 files changed

Lines changed: 57 additions & 24 deletions

File tree

topology-discovery/python/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33

44
# 1.1.0
55
- Implemented worker and workflow for synchronization of the devices in the specified topology.
6+
7+
# 1.2.0
8+
- Implemented worker for creation of the topology database backup.

topology-discovery/python/frinx_worker/topology_discovery/workers.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from frinx.common.worker.task_def import TaskInput
66
from frinx.common.worker.task_result import TaskResult
77
from frinx.common.worker.worker import WorkerImpl
8+
from frinx_api.topology_discovery import CreateBackupMutation
9+
from frinx_api.topology_discovery import CreateBackupResponse
810
from frinx_api.topology_discovery import SyncMutation
911
from frinx_api.topology_discovery import SyncResponse
1012
from frinx_api.topology_discovery import TopologyType
@@ -65,3 +67,31 @@ def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
6567
query = self._sync_topology.render()
6668
response: TopologyOutput = execute_graphql_operation(query=query.query, variables=query.variable)
6769
return response_handler(query, response)
70+
71+
class CreateBackup(WorkerImpl):
72+
_create_backup: CreateBackupMutation = CreateBackupMutation(
73+
payload=CreateBackupResponse(
74+
dbName=True,
75+
)
76+
)
77+
78+
class ExecutionProperties(TaskExecutionProperties):
79+
exclude_empty_inputs: bool = True
80+
81+
class WorkerDefinition(TaskDefinition):
82+
name: str = "TOPOLOGY_create_backup"
83+
description: str = "Create backup from the current state of the topology database"
84+
labels: ListStr = ["BASIC", "TOPOLOGY"]
85+
timeout_seconds: int = 3600
86+
response_timeout_seconds: int = 3600
87+
88+
class WorkerInput(TaskInput):
89+
...
90+
91+
class WorkerOutput(TopologyWorkerOutput):
92+
...
93+
94+
def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
95+
query = self._create_backup.render()
96+
response: TopologyOutput = execute_graphql_operation(query=query.query, variables=query.variable)
97+
return response_handler(query, response)

topology-discovery/python/poetry.lock

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

topology-discovery/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ packages = [{ include = "frinx_worker" }]
1919
name = "frinx-topology-discovery-worker"
2020
description = "Conductor worker for Frinx Topology Discovery"
2121
authors = ["Jozef Volak <jozef.volak@elisapolystar.com>"]
22-
version = "1.1.0"
22+
version = "1.2.0"
2323
readme = ["README.md", "CHANGELOG.md", "RELEASE.md"]
2424
keywords = ["frinx-machine", "topology-discovery", "worker"]
2525
license = "Apache 2.0"

0 commit comments

Comments
 (0)