From d69e493686c3e566a30eb2ff7e8631178f79e64b Mon Sep 17 00:00:00 2001 From: Simon Gurcke Date: Wed, 19 Jun 2019 16:44:54 +1000 Subject: [PATCH] Be less verbose when getting files --- pachypy/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pachypy/client.py b/pachypy/client.py index 629a834..3ccc0eb 100644 --- a/pachypy/client.py +++ b/pachypy/client.py @@ -504,7 +504,7 @@ def get_file_content(self, repo: str, path: str, branch: Optional[str] = 'master return content def get_files(self, repo: str, glob: str = '**', branch: Optional[str] = 'master', commit: Optional[str] = None, - path: str = '/', destination: Union[str, Path] = '.', ignore_existing: bool = False) -> None: + path: str = '/', destination: Union[str, Path] = '.', ignore_existing: bool = False, verbose: bool = False) -> None: """Retrieves multiple files from a repository in PFS and writes them to a local directory. Args: @@ -515,6 +515,7 @@ def get_files(self, repo: str, glob: str = '**', branch: Optional[str] = 'master path: Path within repository in PFS to retrieve files from. destination: Local path to write files to. Must be a directory. Will be created if it doesn't exist. ignore_existing: Whether to ignore or overwrite files that already exist locally. + verbose: Whether to log which files where downloaded. """ path = '/' + path.strip('/') glob = path + '/' + glob @@ -527,7 +528,8 @@ def get_files(self, repo: str, glob: str = '**', branch: Optional[str] = 'master continue os.makedirs(local_path.parent, exist_ok=True) self.get_file(repo, path=row['path'], commit=row['commit'], destination=local_path) - self.logger.info(f"Downloaded '{os.path.basename(row['path'])}' to '{local_path.parent}'") + if verbose: + self.logger.info(f"Downloaded '{os.path.basename(row['path'])}' to '{local_path.parent}'") def create_pipelines(self, pipelines: WildcardFilter = '*', pipeline_specs: Optional[List[dict]] = None, recreate: bool = False, build_options: Optional[dict] = None) -> PipelineChanges: