From c552b649ad356cc8fe25290e04ed23ffd26602b9 Mon Sep 17 00:00:00 2001 From: "sandipsamal117@gmail.com" Date: Sun, 28 Jan 2024 18:57:59 -0500 Subject: [PATCH] fix datetime string in workflow model --- app/config.py | 2 +- app/controllers/subprocesses/utils.py | 4 ++-- app/models/workflow.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/config.py b/app/config.py index b65751d..4b1c81a 100644 --- a/app/config.py +++ b/app/config.py @@ -3,7 +3,7 @@ class Settings(BaseSettings): pflink_mongodb: MongoDsn = 'mongodb://localhost:27017' - version: str = "3.8.2" + version: str = "3.8.4" mongo_username: str = "admin" mongo_password: str = "admin" log_level: str = "DEBUG" diff --git a/app/controllers/subprocesses/utils.py b/app/controllers/subprocesses/utils.py index 483a0f5..379f0ac 100644 --- a/app/controllers/subprocesses/utils.py +++ b/app/controllers/subprocesses/utils.py @@ -1,4 +1,4 @@ -import datetime +from datetime import datetime import hashlib import json import requests @@ -42,7 +42,7 @@ def workflow_retrieve_helper(workflow: dict) -> WorkflowDBSchema: return WorkflowDBSchema( key=workflow["_id"], fingerprint=workflow["fingerprint"], - creation_time=datetime.datetime.min if not workflow.get("creation_time") else workflow["creation_time"], + creation_time=datetime.min.strftime("%Y-%m-%d %H:%M:%S") if not workflow.get("creation_time") else workflow["creation_time"], request=request, response=workflow["response"], service_retry=workflow["service_retry"], diff --git a/app/models/workflow.py b/app/models/workflow.py index cb56e4f..e54e95d 100644 --- a/app/models/workflow.py +++ b/app/models/workflow.py @@ -1,4 +1,4 @@ -import datetime +from datetime import datetime import pytz from pydantic import BaseModel, Field, ValidationError, validator from enum import Enum @@ -158,7 +158,7 @@ class WorkflowDBSchema(BaseModel): """The DB model of a workflow object""" key: str = "" fingerprint: str = "" - creation_time: datetime.datetime = datetime.datetime.now(datetime.timezone.utc) + creation_time: str = datetime.now().strftime("%Y-%m-%d %H:%M:%S") request: WorkflowRequestSchema response: WorkflowStatusResponseSchema service_retry: int = 5