mirror of
https://github.com/wassname/ray.git
synced 2026-08-04 13:14:14 +08:00
[Autoscaler] Fix resource passing bug fix (#10397)
This commit is contained in:
@@ -8,6 +8,7 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import json
|
||||
|
||||
from ray.autoscaler.docker import check_docker_running_cmd, \
|
||||
check_docker_image, \
|
||||
@@ -81,18 +82,9 @@ def _with_environment_variables(cmd: str,
|
||||
automatically be converted to a one line yaml string.
|
||||
"""
|
||||
|
||||
def dict_as_one_line_yaml(d):
|
||||
items = []
|
||||
for key, val in d.items():
|
||||
item_str = "{}: {}".format(quote(str(key)), quote(str(val)))
|
||||
items.append(item_str)
|
||||
|
||||
return "{" + ",".join(items) + "}"
|
||||
|
||||
as_strings = []
|
||||
for key, val in environment_variables.items():
|
||||
if isinstance(val, dict):
|
||||
val = dict_as_one_line_yaml(val)
|
||||
val = json.dumps(val, separators=(",", ":"))
|
||||
s = "export {}={};".format(key, quote(val))
|
||||
as_strings.append(s)
|
||||
all_vars = "".join(as_strings)
|
||||
@@ -102,7 +94,6 @@ def _with_environment_variables(cmd: str,
|
||||
def _with_interactive(cmd):
|
||||
force_interactive = ("true && source ~/.bashrc && "
|
||||
"export OMP_NUM_THREADS=1 PYTHONWARNINGS=ignore && ")
|
||||
|
||||
return ["bash", "--login", "-c", "-i", quote(force_interactive + cmd)]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user