Skip to content

Commit

Permalink
Ensure proper conversion of 'cache_docker_images_locally' to boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
TaekyungHeo committed Jun 4, 2024
1 parent 967e7d7 commit bce3c2a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cloudai/parser/system_parser/slurm_system_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def safe_int(value):
except ValueError:
return None

def str_to_bool(value: str) -> bool:
return value.lower() in ("true", "1", "yes")

name = data.get("name")
if not name:
raise ValueError("Missing mandatory field: 'name'")
Expand Down Expand Up @@ -78,7 +81,7 @@ def safe_int(value):
gpus_per_node = safe_int(data.get("gpus_per_node"))
ntasks_per_node = safe_int(data.get("ntasks_per_node"))

cache_docker_images_locally = data.get("cache_docker_images_locally", False)
cache_docker_images_locally = str_to_bool(data.get("cache_docker_images_locally", "False"))

nodes_dict: Dict[str, SlurmNode] = {}
updated_partitions: Dict[str, List[SlurmNode]] = {}
Expand Down

0 comments on commit bce3c2a

Please sign in to comment.