From 1f2fc3b56a62b29548c0a10664a44654372e41ea Mon Sep 17 00:00:00 2001 From: Gaetan Lepage <gaetan.lepage@inria.fr> Date: Tue, 6 Jul 2021 10:25:34 +0200 Subject: [PATCH] minor things --- percu/config/__init__.py | 2 +- percu/config/defaults.py | 16 ++++++++-------- percu/core.py | 6 +++--- percu/remote.py | 5 ++--- pylintrc | 3 ++- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/percu/config/__init__.py b/percu/config/__init__.py index 3daeb63..28a7e56 100644 --- a/percu/config/__init__.py +++ b/percu/config/__init__.py @@ -160,7 +160,7 @@ class Config: # pylint: disable=too-few-public-methods @staticmethod def get() -> 'Config': - # TODO change this for a single Singleton ? + # TODO change this for a conventional Singleton ? global _CONFIG # pylint: disable=global-statement if _CONFIG is None: _CONFIG = Config._create() diff --git a/percu/config/defaults.py b/percu/config/defaults.py index 871a78d..ce84b57 100644 --- a/percu/config/defaults.py +++ b/percu/config/defaults.py @@ -10,16 +10,16 @@ import yaml from ..utils import prompt_user, print_info, print_warning -def create_default_project(path: str): +def create_default_project(): """ Generate the des TODO """ dot_percu: str = '.percu/' - configs_file = join(dot_percu, 'configs.yaml') + config_file = join(dot_percu, 'configs.yaml') config: dict[str, Any] = {} - if not isfile(configs_file): - print_info("Generating configurations") + if not isfile(config_file): + print_info("Generating configuration file") cwd: str = basename(getcwd()) config['project_name'] = input(f"Project name [{cwd}]: ").strip() or cwd config['username'] = input("Inria username: ").strip() @@ -96,20 +96,20 @@ def create_default_project(path: str): mkdir(dot_percu) # Then, dump the config to the config file if it doesn't already exists - if not isfile(configs_file): - with open(configs_file, 'w') as file_stream: + if not isfile(config_file): + with open(config_file, 'w') as file_stream: yaml.dump(data=config, stream=file_stream, default_flow_style=False, sort_keys=False) else: - print_info(f'Config file (`{configs_file}`) already exists: skipping.') + print_info(f'Config file (`{config_file}`) already exists: skipping.') exclude_file = join(dot_percu, 'exclude.txt') with open(join(dot_percu, '.gitignore'), 'a') as gitignore: gitignore.write('*') - gitignore.write(configs_file) + gitignore.write(config_file) gitignore.write(exclude_file) if not isfile(exclude_file): diff --git a/percu/core.py b/percu/core.py index b73a7ec..6cb9a3b 100644 --- a/percu/core.py +++ b/percu/core.py @@ -158,16 +158,16 @@ def clean(directory: str, def init() -> None: """ - Create the default project. Generate the configuration files. + Initialize the project in the current working directory. Generate the configuration files. """ print_info(text='Creating a brand new percu project.', bold=True) - create_default_project(path='.') + create_default_project() def setup(hostname: str) -> None: """ - Sync the project, update packages. + Set up remote project location and install virtual environment if any. Args: hostname (str): The hostname of the remote computer. diff --git a/percu/remote.py b/percu/remote.py index f3be09a..0d43ef7 100644 --- a/percu/remote.py +++ b/percu/remote.py @@ -53,9 +53,8 @@ def remote(sub_command: str, if container_path != '': cmd.append(container_path) - cmd += ['--nv'] - - cmd += [config.singularity.output_sif_name] + # Enable GPU support and provide the path to the container image + cmd += ['--nv', config.singularity.output_sif_name] # Enable virtual environment if any. elif config.virtual_env is not None and config.virtual_env.enabled: diff --git a/pylintrc b/pylintrc index 87c4fad..8849d8b 100644 --- a/pylintrc +++ b/pylintrc @@ -140,7 +140,8 @@ disable=print-statement, exception-escape, comprehension-escape, missing-function-docstring, - too-many-branches + too-many-branches, + too-many-statements # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option -- GitLab