Skip to content

Commit

Permalink
Correct param_decls arg to click.Option
Browse files Browse the repository at this point in the history
Previously was calling `click.Option` with `param_decls` specified
incorrectly. The option name was being provided correctly, but the name
of the option as an argument was being provided as a seperate arg
(unclear which though).
  • Loading branch information
TimothyWillard committed Nov 7, 2024
1 parent 1641f58 commit 3d3f2cc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 41 deletions.
59 changes: 20 additions & 39 deletions flepimop/gempyor_pkg/src/gempyor/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,90 +561,78 @@ def _resolve_batch_system(
+ list(config_file_options.values())
+ [
click.Option(
["--simulations"],
"simulations",
param_decls=["--simulations", "simulations"],
default=None,
type=click.IntRange(min=1),
help="The number of simulations per a job.",
),
click.Option(
["--blocks"],
"blocks",
param_decls=["--blocks", "blocks"],
default=None,
type=click.IntRange(min=1),
help="The number of sequential blocks to run per a job.",
),
click.Option(
["--batch-system"],
"batch_system",
param_decls=["--batch-system", "batch_system"],
default=None,
type=click.Choice(("aws", "local", "slurm"), case_sensitive=False),
help="The name of the batch system being used.",
),
click.Option(
["--aws"],
"aws",
param_decls=["--aws", "aws"],
default=False,
type=bool,
is_flag=True,
help="A flag indicating this is being run on AWS.",
),
click.Option(
["--local"],
"local",
param_decls=["--local", "local"],
default=False,
type=bool,
is_flag=True,
help="A flag indicating this is being run local.",
),
click.Option(
["--slurm"],
"slurm",
param_decls=["--slurm", "slurm"],
default=False,
type=bool,
is_flag=True,
help="A flag indicating this is being run on slurm.",
),
click.Option(
["--flepi-path"],
"flepi_path",
param_decls=["--flepi-path", "flepi_path"],
envvar="FLEPI_PATH",
type=click.Path(exists=True, path_type=Path),
required=True,
help="Path to the flepiMoP directory being used.",
),
click.Option(
["--project-path"],
"project_path",
param_decls=["--project-path", "project_path"],
envvar="PROJECT_PATH",
type=click.Path(exists=True, path_type=Path),
required=True,
help="Path to the project directory being used.",
),
click.Option(
["--partition"],
"partition",
param_decls=["--partition", "partition"],
type=str,
default=None,
help="The slurm partition to submit the job to.",
),
click.Option(
["--simulation-time"],
"simulation_time",
param_decls=["--simulation-time", "simulation_time"],
type=NONNEGATIVE_DURATION,
default="3min",
help="The time limit per a simulation.",
),
click.Option(
["--initial-time"],
"initial_time",
param_decls=["--initial-time", "initial_time"],
type=NONNEGATIVE_DURATION,
default="20min",
help="The initialization time limit.",
),
click.Option(
["--cluster"],
"cluster",
param_decls=["--cluster", "cluster"],
type=str,
default=None,
help=(
Expand All @@ -653,23 +641,20 @@ def _resolve_batch_system(
),
),
click.Option(
["--conda-env"],
"conda_env",
param_decls=["--conda-env", "conda_env"],
type=str,
default="flepimop-env",
help="The name of the conda environment being used for this batch run.",
),
click.Option(
["--debug"],
"debug",
param_decls=["--debug", "debug"],
type=bool,
default=False,
is_flag=True,
help="Flag to enable debugging in batch submission scripts.",
),
click.Option(
["--config-out"],
"config_out",
param_decls=["--config-out", "config_out"],
type=click.Path(path_type=Path),
default=None,
help=(
Expand All @@ -678,31 +663,27 @@ def _resolve_batch_system(
),
),
click.Option(
["--nthin"],
"nthin",
param_decls=["--nthin", "nthin"],
type=click.IntRange(min=5),
default=5,
help="The number of samples to thin.",
),
click.Option(
["--id", "--run-id"],
"run_id",
param_decls=["--id", "--run-id", "run_id"],
envvar="FLEPI_RUN_INDEX",
type=str,
default=None,
help="Unique identifier for this run.",
),
click.Option(
["--prefix"],
"prefix",
param_decls=["--prefix", "prefix"],
envvar="FLEPI_PREFIX",
type=str,
default=None,
help="Unique prefix for this run.",
),
click.Option(
["--email"],
"email",
param_decls=["--email", "email"],
type=str,
default=None,
help="Optionally an email that can be notified on job begin and end.",
Expand All @@ -715,7 +696,7 @@ def _click_batch(ctx: click.Context = mock_context, **kwargs) -> None:
"""Submit batch jobs"""
# Generic setup
now = datetime.now(timezone.utc)
logger = get_script_logger(__name__, kwargs.get("verbosity", 0))
logger = get_script_logger(__name__, kwargs["verbosity"])
log_cli_inputs(kwargs)
cfg = parse_config_files(config, ctx, **kwargs)

Expand Down
4 changes: 2 additions & 2 deletions flepimop/gempyor_pkg/src/gempyor/shared_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ def cli(ctx: click.Context) -> None:

verbosity_options = {
"verbosity": click.Option(
["-v", "--verbose"],
param_decls=["-v", "--verbose", "verbosity"],
count=True,
help="The verbosity level to use for this command.",
),
"dry_run": click.Option(
["--dry-run"],
param_decls=["--dry-run", "dry_run"],
type=bool,
default=False,
is_flag=True,
Expand Down

0 comments on commit 3d3f2cc

Please sign in to comment.