SIENTIAPDE-1193
Update requirements and refactor datetime handling in OpcManager for timezone support - Commented out the specific version of sientia-dataops-library in requirements.txt and added a local path. - Updated GITHUB_BRANCH in values.yaml for consistency with current development. - Refactored source_timestamp handling in OpcManager to include timezone information. - Adjusted timestamp formatting in test cases to reflect the new datetime format with timezone.
This commit is contained in:
@@ -6,6 +6,7 @@ from sientia_do.notifications.models import NotificationLevel
|
||||
from sientia_do.notifications.handlers import CoreNotificationHandler as NotificationHandler
|
||||
from sientia_do.temporal.activities.base import BaseActivity
|
||||
from sientia_do.observability.logger import Logger
|
||||
from sientia_do.temporal.constants import OPC_TIMEZONE, DATETIME_FORMAT_WITH_TZ
|
||||
from ingestor.managers.data_manager import DataManager
|
||||
import ingestor.metrics as metrics
|
||||
|
||||
@@ -261,7 +262,8 @@ class OpcManager(BaseActivity):
|
||||
monitored_item = data.monitored_item
|
||||
value = monitored_item.Value.Value.Value
|
||||
# source_timestamp
|
||||
source_timestamp = monitored_item.Value.SourceTimestamp
|
||||
source_timestamp = monitored_item.Value.SourceTimestamp.replace(
|
||||
tzinfo=OPC_TIMEZONE)
|
||||
tag = str(node)
|
||||
|
||||
self.logger.debug(
|
||||
@@ -276,7 +278,7 @@ class OpcManager(BaseActivity):
|
||||
data = {
|
||||
'tag': tag,
|
||||
'name': self.nodes[str(node)]['tag_name'],
|
||||
'timestamp': source_timestamp.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'timestamp': source_timestamp.strftime(DATETIME_FORMAT_WITH_TZ),
|
||||
'value': value
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
asyncua==1.1.5
|
||||
redis
|
||||
git+ssh://git@github.com/Aignosi/sientia-dataops-library.git@1.4.1
|
||||
# git+ssh://git@github.com/Aignosi/sientia-dataops-library.git@1.4.1
|
||||
/home/grezewave/Documents/projects/sientia/sientia-dataops-library
|
||||
prometheus_client
|
||||
pymongo
|
||||
@@ -394,7 +394,7 @@ def test_datachange_notification(metrics, opc_manager_subscribed):
|
||||
{
|
||||
"tag": "ns=3;i=1001",
|
||||
"name": "Counter",
|
||||
"timestamp": "2021-01-01 00:00:00",
|
||||
"timestamp": "2021-01-01 00:00:00-0300",
|
||||
"value": 42,
|
||||
},
|
||||
)
|
||||
@@ -403,7 +403,7 @@ def test_datachange_notification(metrics, opc_manager_subscribed):
|
||||
{
|
||||
"tag": "ns=3;i=1001",
|
||||
"name": "Counter",
|
||||
"timestamp": "2021-01-01 00:00:00",
|
||||
"timestamp": "2021-01-01 00:00:00-0300",
|
||||
"value": 42,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -139,7 +139,7 @@ env:
|
||||
- name: GITHUB_REPO_URL
|
||||
value: "git@github.com:Aignosi/sientia-dataops-opc-ingestor.git"
|
||||
- name: GITHUB_BRANCH
|
||||
value: "SIENTIAPDE-1199-revisar-e-testar-observabilidade"
|
||||
value: "SIENTIAPDE-1193-conferir-como-a-escrita-de-datetime-ocorre-no-temporal"
|
||||
- name: PYTHON_APP
|
||||
value: "ingestor.app"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user