Skip to content

Commit

Permalink
Add workflow loggers
Browse files Browse the repository at this point in the history
  • Loading branch information
cxnt committed Aug 26, 2024
1 parent 8bb5633 commit 83c6f70
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/compute/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def main(
if not g.pipeline_running:
return

logger.info("DTL started")
logger.info("Pipeline started")
helper = DtlHelper()

try:
Expand Down Expand Up @@ -113,12 +113,12 @@ def main(

except CustomException as e:
circle_progress.hide()
# logger.error("Error occurred on DTL-graph initialization step!")
# logger.error("Error occurred on Pipeline graph initialization step!")
# e.log()
raise e
except Exception as e:
circle_progress.hide()
# logger.error("Error occurred on DTL-graph initialization step!", exc_info=str(e))
# logger.error("Error occurred on Pipeline graph initialization step!", exc_info=str(e))
raise e

total = net.get_total_elements()
Expand Down Expand Up @@ -187,7 +187,7 @@ def main(
return

logger.info(
"DTL finished",
"Pipeline finished",
extra={"event_type": EventType.DTL_APPLIED, "new_proj_size": results_counter},
)
total_pipeline_time_end = time()
Expand All @@ -200,4 +200,4 @@ def main(
if __name__ == "__main__":
if os.getenv("DEBUG_LOG_TO_FILE", None):
sly_logger.add_default_logging_into_file(logger, DtlPaths().debug_dir)
logging_utils.main_wrapper("DTL", main)
logging_utils.main_wrapper("Pipeline", main)
3 changes: 3 additions & 0 deletions src/ui/tabs/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ def _run():
results.show()
circle_progress.set_status("success")

# ---------------------------------------- Workflow ---------------------------------------------- #
sly.logger.info(f"Workflow started. Workflow ID: {g.WORKFLOW_ID}")
# ---------------------------------------- Workflow Input ---------------------------------------- #
w.workflow_input(g.api, data_layers)
# ----------------------------------------------- - ---------------------------------------------- #
Expand All @@ -258,6 +260,7 @@ def _run():
job_layers=labeling_job_layers,
file_infos=file_infos,
)
sly.logger.info(f"Workflow finished. Next workflow ID: {g.WORKFLOW_ID}")
# ----------------------------------------------- - ---------------------------------------------- #

except CustomException as e:
Expand Down
2 changes: 2 additions & 0 deletions src/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def upload_workflow_preset():
with open(src_path, "w") as f:
json.dump(dtl_json, f, indent=4)

sly.logger.info(f"Uploading workflow preset file to: '{dst_path}'")
file_info = g.api.file.upload(g.TEAM_ID, src_path, dst_path)
sly.logger.info("Workflow preset file uploaded successfully")
g.WORKFLOW_ID += 1
return file_info

Expand Down

0 comments on commit 83c6f70

Please sign in to comment.