Skip to content

Commit

Permalink
fix datetime for existing records
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Jan 29, 2024
1 parent c552b64 commit b6e77ce
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Settings(BaseSettings):
pflink_mongodb: MongoDsn = 'mongodb://localhost:27017'
version: str = "3.8.4"
version: str = "3.8.5"
mongo_username: str = "admin"
mongo_password: str = "admin"
log_level: str = "DEBUG"
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/subprocesses/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def workflow_retrieve_helper(workflow: dict) -> WorkflowDBSchema:
return WorkflowDBSchema(
key=workflow["_id"],
fingerprint=workflow["fingerprint"],
creation_time=datetime.min.strftime("%Y-%m-%d %H:%M:%S") 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 str(workflow["creation_time"]),
request=request,
response=workflow["response"],
service_retry=workflow["service_retry"],
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/workflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import datetime
from datetime import datetime

from pymongo import MongoClient, TEXT
import json
Expand Down Expand Up @@ -148,8 +148,9 @@ def create_new_workflow(
test: bool = False,
) -> WorkflowDBSchema:
"""Create a new workflow object and add it to the database"""
creation_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
response = WorkflowStatusResponseSchema()
new_workflow = WorkflowDBSchema(key=key, fingerprint=fingerprint, request=request, response=response)
new_workflow = WorkflowDBSchema(key=key, fingerprint=fingerprint, creation_time=creation_time, request=request, response=response)
workflow = add_workflow(new_workflow, test)
pretty_response = pprint.pformat(workflow.response.__dict__)
logger.info(f"New workflow record created.", extra=d)
Expand Down
2 changes: 1 addition & 1 deletion app/models/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class WorkflowDBSchema(BaseModel):
"""The DB model of a workflow object"""
key: str = ""
fingerprint: str = ""
creation_time: str = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
creation_time: str = ""
request: WorkflowRequestSchema
response: WorkflowStatusResponseSchema
service_retry: int = 5
Expand Down

0 comments on commit b6e77ce

Please sign in to comment.