Skip to content

Commit

Permalink
fix exception logging
Browse files Browse the repository at this point in the history
  • Loading branch information
abyesilyurt committed Oct 11, 2024
1 parent edd7686 commit dd2dcf3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions syftbox/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
import sys
import time
import traceback
import types
from dataclasses import dataclass
from datetime import datetime
Expand Down Expand Up @@ -170,8 +169,7 @@ def run_plugin(plugin_name, *args, **kwargs):
module = app.loaded_plugins[plugin_name].module
module.run(app.shared_state, *args, **kwargs)
except Exception as e:
traceback.logger.info_exc()
logger.info("error", e)
logger.exception(e)


def start_plugin(app: CustomFastAPI, plugin_name: str):
Expand Down
16 changes: 8 additions & 8 deletions syftbox/client/plugins/sync.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import traceback
from collections import defaultdict
from datetime import datetime
from threading import Event
Expand Down Expand Up @@ -652,33 +651,34 @@ def do_sync(shared_state):
try:
create_datasites(shared_state.client_config)
except Exception as e:
traceback.logger.info_exc()
logger.info("failed to get_datasites", e)
logger.error("failed to get_datasites", e)
logger.exception(e)

try:
if SYNC_UP_ENABLED:
num_changes += sync_up(shared_state.client_config)
else:
logger.info("❌ Sync Up Disabled")
except Exception as e:
traceback.logger.info_exc()
logger.info("failed to sync up", e)
logger.error("failed to sync up", e)
logger.exception(e)

try:
if SYNC_DOWN_ENABLED:
num_changes += sync_down(shared_state.client_config)
else:
logger.info("❌ Sync Down Disabled")
except Exception as e:
traceback.logger.info_exc()
logger.info("failed to sync down", e)
logger.error("failed to sync down", e)
logger.exception(e)
if num_changes == 0:
if event_length:
logger.info(f"✅ Synced {event_length} File Events")
else:
logger.info("✅ Synced due to Timer")
except Exception as e:
logger.info("Failed to run plugin", e)
logger.error("Failed to run plugin")
logger.exception(e)


FLUSH_SYNC_TIMEOUT = 0.5
Expand Down

0 comments on commit dd2dcf3

Please sign in to comment.