Skip to content

Commit a30e840

Browse files
committed
fix minor bugs found around the code
1 parent 433a64d commit a30e840

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

lab-sdk/src/lab/lab_facade.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2230,9 +2230,17 @@ def on_save(self, args, state, control, **kwargs):
22302230
# Find the most recent checkpoint
22312231
if os.path.exists(args.output_dir):
22322232
checkpoints = [d for d in os.listdir(args.output_dir) if d.startswith("checkpoint-")]
2233+
2234+
def _checkpoint_step(name: str) -> int:
2235+
# Names are normally "checkpoint-<step>", but guard against
2236+
# non-numeric suffixes (e.g. "checkpoint-final") so sorting
2237+
# never raises ValueError.
2238+
suffix = name.split("-", 1)[1] if "-" in name else ""
2239+
return int(suffix) if suffix.isdigit() else -1
2240+
22332241
if checkpoints:
22342242
# Sort by checkpoint number
2235-
checkpoints.sort(key=lambda x: int(x.split("-")[1]))
2243+
checkpoints.sort(key=_checkpoint_step)
22362244
latest_checkpoint = checkpoints[-1]
22372245
checkpoint_dir = os.path.join(args.output_dir, latest_checkpoint)
22382246

src/renderer/components/Team/ProviderDetailsModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,8 @@ export default function ProviderDetailsModal({
384384
if (slurmMode === 'ssh') {
385385
configObj.ssh_host = slurmSshHost;
386386
configObj.ssh_user = slurmSshUser;
387-
configObj.ssh_port = parseInt(slurmSshPort, 10) || 22;
387+
const parsedSshPort = parseInt(slurmSshPort, 10);
388+
configObj.ssh_port = Number.isNaN(parsedSshPort) ? 22 : parsedSshPort;
388389
if (slurmSshKeyPath) {
389390
configObj.ssh_key_path = slurmSshKeyPath;
390391
}

src/renderer/components/User/ProviderSettingsSection.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ export default function ProviderSettingsSection() {
323323
<Stack gap={1}>
324324
{(settings.custom_sbatch_flags || '')
325325
.split('\n')
326-
.filter((_, idx, arr) => arr.length === 1 || true)
327326
.map((rawLine, idx, arr) => {
328327
const value = rawLine;
329328
return (

0 commit comments

Comments
 (0)