Skip to content

Commit

Permalink
Add quotes for labels dumped to cluster yaml.
Browse files Browse the repository at this point in the history
  • Loading branch information
romilbhardwaj committed Jun 6, 2024
1 parent e620ccc commit 4b35903
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sky/backends/backend_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,13 @@ def write_cluster_config(
if to_provision.labels:
labels.update(to_provision.labels)

# Prepare labels to be dumped into the yaml file - add quotes to the values
# to enforce str type for label values. Unquoted strings may get parsed as
# bool by yaml.safe_load (E.g., 'True' without quotes gets parsed as bool),
# which may cause issues with downstream code (e.g., Kubernetes python API
# does not accept bool values for labels).
labels = {k: f'\'{v}\'' for k, v in labels.items()}

# Dump the Ray ports to a file for Ray job submission
dump_port_command = (
f'{constants.SKY_PYTHON_CMD} -c \'import json, os; json.dump({constants.SKY_REMOTE_RAY_PORT_DICT_STR}, '
Expand Down

0 comments on commit 4b35903

Please sign in to comment.