From edd58a121ca15684fa9e64fdbc92485b112d6049 Mon Sep 17 00:00:00 2001 From: burnout87 Date: Thu, 5 Oct 2023 10:51:43 +0200 Subject: [PATCH] progress logging --- cdci_data_analysis/analysis/renku_helper.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cdci_data_analysis/analysis/renku_helper.py b/cdci_data_analysis/analysis/renku_helper.py index 7d4cc9380..24191f6de 100644 --- a/cdci_data_analysis/analysis/renku_helper.py +++ b/cdci_data_analysis/analysis/renku_helper.py @@ -7,7 +7,7 @@ import giturlparse import copy -from git import Repo, Actor +from git import Repo, Actor, RemoteProgress from configparser import ConfigParser from ..app_logging import app_logging @@ -16,6 +16,13 @@ from .hash import make_hash logger = app_logging.getLogger('renku_helper') +progress_logger = app_logging.getLogger('progress_git_commands_renku_helper') + + +class MyProgressPrinter(RemoteProgress): + def update(self, op_code, cur_count, max_count=None, message=""): + message = message or "NO MESSAGE" + progress_logger.info(f"op_code: {op_code}, cur_count: {cur_count}, max_count: {max_count}, message: {message}") def push_api_code(api_code, @@ -161,7 +168,7 @@ def clone_renku_repo(renku_repository_url, repo_dir=None, renku_gitlab_ssh_key_p # TODO or store known hosts on build/boot git_ssh_cmd = f'ssh -i {renku_gitlab_ssh_key_path} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' - repo = Repo.clone_from(renku_repository_url, repo_dir, branch='master', env=dict(GIT_SSH_COMMAND=git_ssh_cmd)) + repo = Repo.clone_from(renku_repository_url, repo_dir, branch='master', env=dict(GIT_SSH_COMMAND=git_ssh_cmd), progress=MyProgressPrinter()) logger.info(f'repository {renku_repository_url} successfully cloned')