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

[influxdb] Update project path to frinx_worker/influxdb #19

Merged
merged 1 commit into from
Nov 14, 2023
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
5 changes: 4 additions & 1 deletion misc/python/influxdb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# 1.0.0
- Upgrade pydantic version to v2
- Upgrade pydantic version to v2

# 1.1.0
- Fix project path to frinx_worker/influxdb
89 changes: 0 additions & 89 deletions misc/python/influxdb/frinx_worker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,89 +0,0 @@
from typing import Optional

from frinx.common.type_aliases import DictAny
from frinx.common.type_aliases import ListAny
from frinx.common.type_aliases import ListStr
from frinx.common.worker.service import ServiceWorkersImpl
from frinx.common.worker.task_def import TaskDefinition
from frinx.common.worker.task_def import TaskExecutionProperties
from frinx.common.worker.task_def import TaskInput
from frinx.common.worker.task_def import TaskOutput
from frinx.common.worker.task_result import TaskResult
from frinx.common.worker.worker import WorkerImpl

from . import utils


class Influx(ServiceWorkersImpl):

class InfluxWriteData(WorkerImpl):

class ExecutionProperties(TaskExecutionProperties):
transform_string_to_json_valid: bool = True
exclude_empty_inputs: bool = True

class WorkerDefinition(TaskDefinition):
name: str = 'INFLUX_write_data'
description: str = 'Write data do InfluxDB'
labels: ListStr = ['INFLUX']
timeout_seconds: int = 300

class WorkerInput(TaskInput):
org: str
token: str
bucket: str
measurement: str
tags: DictAny
fields: DictAny

class WorkerOutput(TaskOutput):
pass

def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
return utils.influx_write_data(self, worker_input)

class InfluxQueryData(WorkerImpl):

class ExecutionProperties(TaskExecutionProperties):
transform_string_to_json_valid: bool = True
exclude_empty_inputs: bool = True

class WorkerDefinition(TaskDefinition):
name: str = 'INFLUX_query_data'
description: str = 'Query data from InfluxDB'
labels: ListStr = ['INFLUX']
timeout_seconds: int = 300

class WorkerInput(TaskInput):
org: str
token: str
query: str
format_data: Optional[ListStr] = None

class WorkerOutput(TaskOutput):
data: ListAny

def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
return utils.influx_query_data(self, worker_input)

class InfluxCreateBucket(WorkerImpl):

class ExecutionProperties(TaskExecutionProperties):
exclude_empty_inputs: bool = True

class WorkerDefinition(TaskDefinition):
name: str = 'INFLUX_create_bucket'
description: str = 'Create bucket for organization in InfluxDB'
labels: ListStr = ['INFLUX']
timeout_seconds: int = 300

class WorkerInput(TaskInput):
org: str
token: str
bucket: str

class WorkerOutput(TaskOutput):
pass

def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
return utils.influx_create_bucket(self, worker_input)
85 changes: 85 additions & 0 deletions misc/python/influxdb/frinx_worker/influxdb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
from typing import Optional

from frinx.common.type_aliases import DictAny
from frinx.common.type_aliases import ListAny
from frinx.common.type_aliases import ListStr
from frinx.common.worker.service import ServiceWorkersImpl
from frinx.common.worker.task_def import TaskDefinition
from frinx.common.worker.task_def import TaskExecutionProperties
from frinx.common.worker.task_def import TaskInput
from frinx.common.worker.task_def import TaskOutput
from frinx.common.worker.task_result import TaskResult
from frinx.common.worker.worker import WorkerImpl

from . import utils


class InfluxDB(ServiceWorkersImpl):
class InfluxWriteData(WorkerImpl):
class ExecutionProperties(TaskExecutionProperties):
transform_string_to_json_valid: bool = True
exclude_empty_inputs: bool = True

class WorkerDefinition(TaskDefinition):
name: str = 'INFLUX_write_data'
description: str = 'Write data do InfluxDB'
labels: ListStr = ['INFLUX']
timeout_seconds: int = 300

class WorkerInput(TaskInput):
org: str
token: str
bucket: str
measurement: str
tags: DictAny
fields: DictAny

class WorkerOutput(TaskOutput):
pass

def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
return utils.influx_write_data(self, worker_input)

class InfluxQueryData(WorkerImpl):
class ExecutionProperties(TaskExecutionProperties):
transform_string_to_json_valid: bool = True
exclude_empty_inputs: bool = True

class WorkerDefinition(TaskDefinition):
name: str = 'INFLUX_query_data'
description: str = 'Query data from InfluxDB'
labels: ListStr = ['INFLUX']
timeout_seconds: int = 300

class WorkerInput(TaskInput):
org: str
token: str
query: str
format_data: Optional[ListStr] = None

class WorkerOutput(TaskOutput):
data: ListAny

def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
return utils.influx_query_data(self, worker_input)

class InfluxCreateBucket(WorkerImpl):
class ExecutionProperties(TaskExecutionProperties):
exclude_empty_inputs: bool = True

class WorkerDefinition(TaskDefinition):
name: str = 'INFLUX_create_bucket'
description: str = 'Create bucket for organization in InfluxDB'
labels: ListStr = ['INFLUX']
timeout_seconds: int = 300

class WorkerInput(TaskInput):
org: str
token: str
bucket: str

class WorkerOutput(TaskOutput):
pass

def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
return utils.influx_create_bucket(self, worker_input)
4 changes: 2 additions & 2 deletions misc/python/influxdb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ packages = [{ include = "frinx_worker" }]
name = "frinx-influxdb-worker"
description = "Conductor InfluxDB worker for Frinx Machine"
authors = ["Jozef Volak <[email protected]>"]
version = "1.0.0"
version = "1.1.0"
readme = ["README.md", "CHANGELOG.md"]
keywords = ["frinx-machine", "influx", "worker"]
keywords = ["frinx-machine", "influxdb", "worker"]
license = "Apache 2.0"

[project.urls]
Expand Down