Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement topology-discovery create_backup worker #61

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading