Skip to content

Commit

Permalink
return partial logs if all logs couldn't be retrieved
Browse files Browse the repository at this point in the history
(with a warning log)

This allows to specify a larger number of logs if the exact one is not
known and still get logs when number of tries is reached
  • Loading branch information
jcuquemelle committed Nov 21, 2024
1 parent 746f864 commit 919e4f5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cluster_pack/skein/skein_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ def get_application_logs(
wait_for_nb_logs: Optional[int] = None,
log_tries: int = 15
) -> Optional[skein.model.ApplicationLogs]:
nb_keys = 0
logs = []
for ind in range(log_tries):
try:
logs = client.application_logs(app_id)
Expand All @@ -234,6 +236,10 @@ def get_application_logs(
logger.warning(
f"Cannot collect logs (attempt {ind+1}/{log_tries})")
time.sleep(3)
if nb_keys >= 1:
logger.warning(
f"Only {nb_keys} logs retrieved instead of {wait_for_nb_logs} requested")
return logs
return None


Expand Down

0 comments on commit 919e4f5

Please sign in to comment.