Skip to content

Commit

Permalink
update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
almazgimaev committed Oct 25, 2023
1 parent 9275350 commit 4d7d92a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions supervisely/train/src/sly_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ def train(api: sly.Api, task_id, context, state, app_logger):
upload_artifacts(g.local_artifacts_dir, g.remote_artifacts_dir)
set_task_output()
except Exception as e:
my_app.show_modal_window(f"Something went wrong. Find more info in the app logs. {repr(e)}", level="error")
msg = f"Something went wrong. Find more info in the app logs. {repr(e)}"
my_app.show_modal_window(msg, level="error")
sly.logger.error(msg, exc_info=True, extra={ 'exc_str': str(e)})
api.app.set_field(task_id, "state.started", False)

# stop application
Expand All @@ -150,7 +152,13 @@ def main():
my_app.compile_template(g.root_source_dir)

# init data for UI widgets
ui.init(data, state)
try:
ui.init(data, state)
except Exception as e:
msg = f"Data initialization error. Check your project and try again. {repr(e)}"
my_app.show_modal_window(msg, level="error")
sly.logger.error(msg, exc_info=True, extra={ 'exc_str': str(e)})
g.api.app.set_field(task_id, "state.started", False)

my_app.run(data=data, state=state)

Expand Down

0 comments on commit 4d7d92a

Please sign in to comment.