lint and update background task period to 5 for demo

This commit is contained in:
burnettk 2022-09-21 19:42:46 -04:00
parent e6e2967621
commit 4bcc72c9e4
2 changed files with 7 additions and 8 deletions

View File

@ -2,11 +2,10 @@
import os
from typing import Any
import sqlalchemy
import connexion # type: ignore
import flask.app
import flask.json
import sqlalchemy
from apscheduler.schedulers.background import BackgroundScheduler # type: ignore
from flask_bpmn.api.api_error import api_error_blueprint
from flask_bpmn.models.db import db
@ -31,15 +30,15 @@ class MyJSONEncoder(flask.json.JSONEncoder):
"""Default."""
if hasattr(obj, "serialized"):
return obj.serialized
elif isinstance(obj, sqlalchemy.engine.row.Row):
elif isinstance(obj, sqlalchemy.engine.row.Row): # type: ignore
return_dict = {}
for row_key in obj.keys():
row_value = obj[row_key]
if (hasattr(row_value, '__dict__')):
if hasattr(row_value, "__dict__"):
return_dict.update(row_value.__dict__)
else:
return_dict.update({ row_key: row_value })
return_dict.pop('_sa_instance_state')
return_dict.update({row_key: row_value})
return_dict.pop("_sa_instance_state")
return return_dict
return super().default(obj)
@ -55,7 +54,7 @@ def start_scheduler(app: flask.app.Flask) -> None:
scheduler.add_job(
BackgroundProcessingService(app).run,
"interval",
seconds=30,
seconds=5,
)
scheduler.start()

View File

@ -176,7 +176,7 @@ class DBHandler(logging.Handler):
bpmn_process_identifier = record.workflow # type: ignore
spiff_task_guid = str(record.task_id) # type: ignore
bpmn_task_identifier = str(record.task_spec) # type: ignore
bpmn_task_type = record.task_type if hasattr(record, 'task_type') else None # type: ignore
bpmn_task_type = record.task_type if hasattr(record, "task_type") else None # type: ignore
timestamp = record.created
message = record.msg if hasattr(record, "msg") else None
current_user_id = record.current_user_id if hasattr(record, "current_user_id") else None # type: ignore