Skip to content

Commit

Permalink
Filter in jinja
Browse files Browse the repository at this point in the history
  • Loading branch information
romilbhardwaj committed Jun 10, 2024
1 parent 4b35903 commit fde60da
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 0 additions & 7 deletions sky/backends/backend_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,13 +867,6 @@ 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
2 changes: 1 addition & 1 deletion sky/templates/kubernetes-ray.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ available_node_types:
skypilot-user: {{ user }}
# Custom tags for the pods
{%- for label_key, label_value in labels.items() %}
{{ label_key }}: {{ label_value }}
{{ label_key }}: {{ label_value|tojson }}
{%- endfor %}
{% if k8s_fuse_device_required %}
annotations:
Expand Down

0 comments on commit fde60da

Please sign in to comment.