Skip to content

Commit

Permalink
fix json data
Browse files Browse the repository at this point in the history
  • Loading branch information
luiztauffer committed Sep 21, 2023
1 parent 970413d commit bfb0e78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion rest/clients/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from sqlalchemy.orm import sessionmaker
from contextlib import contextmanager
import ast
import json

from db.models import User, DataSource, Run

Expand Down Expand Up @@ -108,7 +109,7 @@ def get_run_info(self, run_id):
"lastRun": obj.last_run,
"status": obj.status,
"dataSourceName": data_source.name,
"metadata": ast.literal_eval(obj.metadata_),
"metadata": json.loads(obj.metadata_),
"logs": obj.logs,
"outputPath": obj.output_path
}
Expand Down
9 changes: 6 additions & 3 deletions rest/routes/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ async def route_run_sorting(data: SortingData, background_tasks: BackgroundTasks
run_identifier = datetime.now().strftime("%Y%m%d%H%M%S")
else:
run_identifier = data.run_identifier
payload = data.dict()
try:
# Create Database entries
db_client = DatabaseClient(connection_string=settings.DB_CONNECTION_STRING)
Expand All @@ -67,13 +66,17 @@ async def route_run_sorting(data: SortingData, background_tasks: BackgroundTasks
status="running",
data_source_id=data_source.id,
user_id=user.id,
metadata=str(payload),
metadata=str(data.json()),
output_destination=data.output_destination,
output_path=data.output_path,
)

# Run sorting job
background_tasks.add_task(sorting_background_task, payload, run_identifier=run_identifier)
background_tasks.add_task(
sorting_background_task,
payload=data.dict(),
run_identifier=run_identifier
)

except Exception as e:
print(e)
Expand Down

0 comments on commit bfb0e78

Please sign in to comment.