From c4b43f3737466d54091c2f4f2cbbf8875dbdb55c Mon Sep 17 00:00:00 2001 From: Faiz Surani Date: Wed, 28 Aug 2024 12:53:09 -0700 Subject: [PATCH] Fix rl job list bug --- rl/cli/main.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rl/cli/main.py b/rl/cli/main.py index 506859b..74c16e7 100644 --- a/rl/cli/main.py +++ b/rl/cli/main.py @@ -137,9 +137,7 @@ def wrapper(*args, **kwargs): @click.option( "--partition", "-p", - help="Partition. If 'owners' specified, will create a batch job then ssh into it", - default=CURRENT_GROUP, - show_default=True, + help=f"Partition. Default is {CURRENT_GROUP}. If 'owners' specified, will create a batch job then ssh into it", type=str, ) @click.option( @@ -210,7 +208,7 @@ def wrapper(*args, **kwargs): ) @_must_run_on_sherlock def job( - partition: str, + partition: str | None, name: str, gpus: int, gpu_constraint: str, @@ -232,6 +230,12 @@ def job( case _: pass + # We don't set the click default because we don't want the default partition + # value when the user does rl job list, so we just set it after checking + # that the user isn't running list + if not partition: + partition = CURRENT_GROUP + LOG_DIR.mkdir(exist_ok=True, parents=True) common_args = [ @@ -318,7 +322,7 @@ def create_batch_job(sbatch_args, name, job_time): ] subprocess.run(sbatch_args, check=True) - curr_job: JobInfo + curr_job: JobInfo | None with rich.progress.Progress(transient=True) as progress: # noinspection PyTypeChecker task = progress.add_task(