Always use timestamp with timezone when inserting/updating foglamp.tasks table
Always use timestamp with timezone when inserting/updating foglamp.tasks table
@@ -28,6 +28,7 @@ from foglamp.common.storage_client.storage_client import StorageClientAsync
from foglamp.services.core.service_registry.service_registry import ServiceRegistry
from foglamp.services.core.service_registry import exceptions as service_registry_exceptions
from foglamp.services.common import utils
+from foglamp.plugins.common import utils
__author__ = "Terris Linenbach, Amarendra K Sinha, Massimiliano Pinto"
__copyright__ = "Copyright (c) 2017-2018 OSIsoft, LLC"
@@ -263,7 +264,7 @@ class Scheduler(object):
update_payload = PayloadBuilder() \
.SET(exit_code=exit_code,
state=int(state),
- end_time=str(datetime.datetime.now())) \
+ end_time=str(utils.local_timestamp())) \
.WHERE(['id', '=', str(task_process.task_id)]) \
.payload()
try:
@@ -336,7 +337,7 @@ class Scheduler(object):
schedule_name=schedule.name,
process_name=schedule.process_name,
state=int(Task.State.RUNNING),
- start_time=str(datetime.datetime.now())) \
+ start_time=str(utils.local_timestamp())) \
.payload()
try:
self._logger.debug('Database command: %s', insert_payload)
