Skip to content

Commit

Permalink
fix: handle private repo (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickcom007 authored Jun 27, 2024
1 parent 374aa06 commit 8fa9c7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/core/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
import sys


def handle_os_error(e: OSError):
def handle_os_error(e: OSError, assignment_id: str, client: FedLedger):
if "No space left on device" in str(e):
logger.error("No more disk space, exiting with code 101")
sys.exit(101)
elif "not a valid model identifier" in str(e):
logger.error("Not able to access the model, will mark the assignment as failed")
client.mark_assignment_as_failed(assignment_id)
else:
logger.error("Unknown OSError detected, exiting with code 100, will restart...")
logger.error(
f"Unknown OSError detected, exiting with code 100, will restart... {e}"
)
sys.exit(100)


Expand All @@ -25,7 +30,7 @@ def handle_runtime_error(e: RuntimeError, assignment_id: str, client: FedLedger)
client.mark_assignment_as_failed(assignment_id)
else:
logger.error(
"Unknown RuntimeError detected, exiting with code 100, will restart..."
f"Unknown RuntimeError detected, exiting with code 100, will restart... {e}"
)
sys.exit(100)

Expand All @@ -38,6 +43,6 @@ def handle_value_error(e: ValueError, assignment_id: str, client: FedLedger):
sys.exit(101)
else:
logger.error(
"Unknown ValueError detected, exiting with code 100, will restart..."
f"Unknown ValueError detected, exiting with code 100, will restart... {e}"
)
sys.exit(100)
2 changes: 1 addition & 1 deletion src/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def loop(validation_args_file: str, task_id: str = None, auto_clean_cache: bool
# directly terminate the process if keyboard interrupt
sys.exit(1)
except OSError as e:
handle_os_error(e)
handle_os_error(e, assignment_id, fed_ledger)
except RuntimeError as e:
handle_runtime_error(e, assignment_id, fed_ledger)
except ValueError as e:
Expand Down

0 comments on commit 8fa9c7e

Please sign in to comment.