Skip to content

Commit

Permalink
fix(ray): fix missing default resource value (#129)
Browse files Browse the repository at this point in the history
Because

- Missing default value might cause to the model to become unschedulable

This commit

- add default resource value if not presented
  • Loading branch information
heiruwu authored Mar 28, 2024
1 parent 9ead421 commit b2f564a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions instill/helpers/ray_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def __init__(self, deployable: Deployment) -> None:
num_of_cpus = os.getenv(ENV_NUM_OF_CPUS)
if num_of_cpus is not None and num_of_cpus != "":
self.update_num_cpus(float(num_of_cpus))
else:
self.update_num_cpus(1)

memory = os.getenv(ENV_MEMORY)
if memory is not None and memory != "":
Expand All @@ -48,10 +50,14 @@ def __init__(self, deployable: Deployment) -> None:
num_of_min_replicas = os.getenv(ENV_NUM_OF_MIN_REPLICAS)
if num_of_min_replicas is not None and num_of_min_replicas != "":
self.update_min_replicas(int(num_of_min_replicas))
else:
self.update_min_replicas(0)

num_of_max_replicas = os.getenv(ENV_NUM_OF_MAX_REPLICAS)
if num_of_max_replicas is not None and num_of_max_replicas != "":
self.update_max_replicas(int(num_of_max_replicas))
else:
self.update_max_replicas(1)

vram = os.getenv(ENV_TOTAL_VRAM)
if vram is not None and vram != "":
Expand Down

0 comments on commit b2f564a

Please sign in to comment.