Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions instill/helpers/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class VisualQuestionAnsweringInput:
ENV_MEMORY = "RAY_MEMORY"
ENV_TOTAL_VRAM = "RAY_TOTAL_VRAM"
ENV_RAY_ACCELERATOR_TYPE = "RAY_ACCELERATOR_TYPE"
ENV_RAY_CUSTOM_RESOURCE = "RAY_CUSTOM_RESOURCE"
ENV_NUM_OF_GPUS = "RAY_NUM_OF_GPUS"
ENV_NUM_OF_CPUS = "RAY_NUM_OF_CPUS"
ENV_NUM_OF_MIN_REPLICAS = "RAY_NUM_OF_MIN_REPLICAS"
Expand Down
9 changes: 7 additions & 2 deletions instill/helpers/ray_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ENV_NUM_OF_MAX_REPLICAS,
ENV_NUM_OF_MIN_REPLICAS,
ENV_RAY_ACCELERATOR_TYPE,
ENV_RAY_CUSTOM_RESOURCE,
ENV_TOTAL_VRAM,
RAM_MINIMUM_RESERVE,
RAM_UPSCALE_FACTOR,
Expand Down Expand Up @@ -48,6 +49,10 @@ def __init__(self, deployable: Deployment) -> None:
if accelerator_type is not None and accelerator_type != "":
self._update_accelerator_type(accelerator_type)

custom_resource = os.getenv(ENV_RAY_CUSTOM_RESOURCE)
if custom_resource is not None and custom_resource != "":
self._update_custom_resource(custom_resource)

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))
Expand Down Expand Up @@ -132,10 +137,10 @@ def _update_accelerator_type(self, accelerator_type: str):

return self

def _update_num_custom_resource(self, resource_name: str, num: float):
def _update_custom_resource(self, resource_name: str):
if self._deployment.ray_actor_options is not None:
self._deployment.ray_actor_options.update(
{"resources": {resource_name: num}}
{"resources": {resource_name: 0.001}}
)

return self
Expand Down