Additioanl fixes regarding error catching and reporting at ATEapi related jobs

This commit is contained in:
Kikimanox
2022-12-23 18:10:00 +01:00
parent 44d4e58ec3
commit 90adc995b1
2 changed files with 4 additions and 0 deletions
@@ -20,6 +20,8 @@ ATEapi_endpoint = "http://ate-api:5000/predict"
def do_izlusci(conllus, prepovedane_besede): def do_izlusci(conllus, prepovedane_besede):
tmp_file_path = "" tmp_file_path = ""
if prepovedane_besede is None:
prepovedane_besede = []
try: try:
big_conllu = cl_utils.multipla_conllus_to_one_from_conllus_arr(conllus) big_conllu = cl_utils.multipla_conllus_to_one_from_conllus_arr(conllus)
tmp_file_path = create_random_file_in_tmp_folder(big_conllu, ".conllu") tmp_file_path = create_random_file_in_tmp_folder(big_conllu, ".conllu")
@@ -448,6 +448,8 @@ def execute_ateapi_job(job: Job, sem: threading.Semaphore):
_res = do_izlusci(info['conllus'], info['prepovedane_besede']) _res = do_izlusci(info['conllus'], info['prepovedane_besede'])
if type(_res) is tuple: if type(_res) is tuple:
ret_json = _res[0] ret_json = _res[0]
if _res[1] != 200:
ret_json = f'ERROR - {ret_json}'
else: else:
try: try:
if type(_res.response) is dict: if type(_res.response) is dict: