Skip to content

Commit

Permalink
Replace memory option IntRange with MEMORY_MB
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyWillard committed Nov 14, 2024
1 parent 0746db1 commit 66ab33d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions flepimop/gempyor_pkg/src/gempyor/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .logging import get_script_logger
from .utils import _format_cli_options, _git_checkout, _git_head, _shutil_which, config
from .shared_cli import (
MEMORY_MB,
NONNEGATIVE_DURATION,
cli,
config_files_argument,
Expand Down Expand Up @@ -970,7 +971,7 @@ def _submit_scenario_job(
),
click.Option(
param_decls=["--memory", "memory"],
type=click.IntRange(min=1),
type=MEMORY_MB,
default=None,
help="Override for the amount of memory per node to use in MB.",
),
Expand Down Expand Up @@ -1125,12 +1126,19 @@ def _click_submit(ctx: click.Context = mock_context, **kwargs: Any) -> None:
logger.info("Setting a total job time limit of %s minutes", job_time_limit.format())

# Job resources
memory = None if kwargs["memory"] is None else math.ceil(kwargs["memory"])
if memory != kwargs["memory"]:
logger.warning(
"The requested memory of %.3fMB has been rounded up to %uMB for submission",
kwargs["memory"],
memory,
)
job_resources = JobResources.from_presets(
job_size,
inference_method,
nodes=kwargs["nodes"],
cpus=kwargs["cpus"],
memory=kwargs["memory"],
memory=memory,
)
logger.info("Requesting the resources %s for this job.", job_resources)

Expand Down

0 comments on commit 66ab33d

Please sign in to comment.