Skip to content

Commit

Permalink
Implement topology-discovery create_backup worker
Browse files Browse the repository at this point in the history
  • Loading branch information
jaro0149 committed Sep 23, 2024
1 parent e12b43c commit 5c6a2d6
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 24 deletions.
3 changes: 3 additions & 0 deletions topology-discovery/python/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# 1.1.0
- Implemented worker and workflow for synchronization of the devices in the specified topology.

# 1.2.0
- Implemented worker for creation of the topology database backup.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from frinx.common.worker.task_def import TaskInput
from frinx.common.worker.task_result import TaskResult
from frinx.common.worker.worker import WorkerImpl
from frinx_api.topology_discovery import CreateBackupMutation
from frinx_api.topology_discovery import CreateBackupResponse
from frinx_api.topology_discovery import SyncMutation
from frinx_api.topology_discovery import SyncResponse
from frinx_api.topology_discovery import TopologyType
Expand Down Expand Up @@ -65,3 +67,31 @@ def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
query = self._sync_topology.render()
response: TopologyOutput = execute_graphql_operation(query=query.query, variables=query.variable)
return response_handler(query, response)

class CreateBackup(WorkerImpl):
_create_backup: CreateBackupMutation = CreateBackupMutation(
payload=CreateBackupResponse(
dbName=True,
)
)

class ExecutionProperties(TaskExecutionProperties):
exclude_empty_inputs: bool = True

class WorkerDefinition(TaskDefinition):
name: str = "TOPOLOGY_create_backup"
description: str = "Create backup from the current state of the topology database"
labels: ListStr = ["BASIC", "TOPOLOGY"]
timeout_seconds: int = 3600
response_timeout_seconds: int = 3600

class WorkerInput(TaskInput):
...

class WorkerOutput(TopologyWorkerOutput):
...

def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
query = self._create_backup.render()
response: TopologyOutput = execute_graphql_operation(query=query.query, variables=query.variable)
return response_handler(query, response)
46 changes: 23 additions & 23 deletions topology-discovery/python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion topology-discovery/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ packages = [{ include = "frinx_worker" }]
name = "frinx-topology-discovery-worker"
description = "Conductor worker for Frinx Topology Discovery"
authors = ["Jozef Volak <[email protected]>"]
version = "1.1.0"
version = "1.2.0"
readme = ["README.md", "CHANGELOG.md", "RELEASE.md"]
keywords = ["frinx-machine", "topology-discovery", "worker"]
license = "Apache 2.0"
Expand Down

0 comments on commit 5c6a2d6

Please sign in to comment.