From dc29e4fbac247b08e7205865de2615c5bf5a0743 Mon Sep 17 00:00:00 2001 From: acbaez9 <97056049+acbaez9@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:39:22 -0700 Subject: [PATCH] can pass in env variables manually --- distributask/distributask.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/distributask/distributask.py b/distributask/distributask.py index a978184..8c4ce16 100644 --- a/distributask/distributask.py +++ b/distributask/distributask.py @@ -33,9 +33,9 @@ def __init__( hf_repo_id=os.getenv("HF_REPO_ID"), hf_token=os.getenv("HF_TOKEN"), vast_api_key=os.getenv("VAST_API_KEY"), - redis_host=os.getenv("REDIS_HOST", "nohost"), + redis_host=os.getenv("REDIS_HOST", "localhost"), redis_password=os.getenv("REDIS_PASSWORD", ""), - redis_port=os.getenv("REDIS_PORT", 6666), + redis_port=os.getenv("REDIS_PORT", 6379), redis_username=os.getenv("REDIS_USER", "default"), broker_pool_limit=os.getenv("BROKER_POOL_LIMIT", 1), ) -> None: @@ -518,7 +518,7 @@ def search_offers(self, max_price: float) -> List[Dict]: raise def create_instance( - self, offer_id: str, image: str, module_name: str, command: str = None + self, offer_id: str, image: str, module_name: str, settings: Dict = None, command: str = None ) -> Dict: """ Create an instance on the Vast.ai platform. @@ -543,10 +543,13 @@ def create_instance( if command is None: command = f"celery -A {module_name} worker --loglevel=info --concurrency=1 --without-heartbeat" + if settings is None: + settings = self.settings + json_blob = { "client_id": "me", "image": image, - "env": self.settings, + "env": settings, "disk": 32, # Set a non-zero value for disk "onstart": f"export PATH=$PATH:/ && cd ../ && {command}", "runtype": "ssh ssh_proxy",