Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1f2fc3b5 authored by LEPAGE Gaetan's avatar LEPAGE Gaetan
Browse files

minor things

parent f7670ae3
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
......@@ -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):
......
......@@ -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.
......
......@@ -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:
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment