Exemple #1
0
def _get_app_logs(
        client: skein.Client, app: skein.ApplicationClient,
        wait_for_nb_logs: int) -> Optional[skein.model.ApplicationLogs]:
    for ind in range(YARN_LOG_TRIES):
        try:
            logs = client.application_logs(app.id)
            nb_keys = len(logs.keys())
            logger.info(f"Got {nb_keys}/{wait_for_nb_logs} log files")
            if nb_keys == wait_for_nb_logs:
                return logs
        except Exception:
            logger.warn(
                f"Cannot collect logs (attempt {ind+1}/{YARN_LOG_TRIES})",
                exc_info=True)
        time.sleep(3)
    return None
Exemple #2
0
def get_application_logs(
        client: skein.Client,
        app_id: str,
        wait_for_nb_logs: Optional[int] = None,
        log_tries: int = 15) -> Optional[skein.model.ApplicationLogs]:
    for ind in range(log_tries):
        try:
            logs = client.application_logs(app_id)
            nb_keys = len(logs.keys())
            logger.info(f"Got {nb_keys}/{wait_for_nb_logs} log files")
            if not wait_for_nb_logs or nb_keys == wait_for_nb_logs:
                return logs
        except Exception:
            logger.warning(
                f"Cannot collect logs (attempt {ind+1}/{log_tries})")
        time.sleep(3)
    return None