Skip to content

Commit

Permalink
Improve endpoints feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-piles committed Jul 1, 2024
1 parent f8749eb commit d4cfb41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ async def get_xml():

@app.post("/xml_to_train/{tenant}/{extractor_id}")
async def to_train_xml_file(tenant, extractor_id, file: UploadFile = File(...)):
print(to_train_xml_file, tenant, extractor_id)
print("received file to train", tenant, extractor_id)
return "xml_to_train saved"


@app.post("/xml_to_predict/{tenant}/{extractor_id}")
async def to_predict_xml_file(tenant, extractor_id, file: UploadFile = File(...)):
print(to_predict_xml_file, tenant, extractor_id)
print("received file to predict", tenant, extractor_id)
return "xml_to_train saved"


Expand Down
6 changes: 3 additions & 3 deletions worker_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def __init__(self):

def process(self, id, message, rc, ts):
task = TranslationTaskMessage(**message)
print(task.dict())
print(task.model_dump())

translations: list[Translation] = [self.get_translation(task, language) for language in task.languages_to]
response = TranslationResponseMessage(
**task.dict(),
**task.model_dump(),
translations=translations,
)

self.results_queue.sendMessage(delay=5).message(response.dict()).execute()
self.results_queue.sendMessage(delay=5).message(response.model_dump()).execute()
return True

def subscribe_to_tasks_queue(self):
Expand Down

0 comments on commit d4cfb41

Please sign in to comment.