Skip to content

Commit a936deb

Browse files
authored
Merge pull request #44 from dotmesh-io/43-dont-assume-https-deployments
#43: use DOTSCIENCE_MODEL_URL_SCHEME to configure if deployment urls …
2 parents feac003 + e6018e6 commit a936deb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

dotscience/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,10 @@ def _build_docker_image_on_hub(self):
739739

740740
return self._docker_image
741741

742+
def _get_deployment_url(self, host):
743+
scheme = os.getenv('DOTSCIENCE_MODEL_URL_SCHEME', default="https")
744+
return scheme+"://"+host+"/v1/models/model"
745+
742746
def _deploy_to_kube(self):
743747
# TODO: support specifying the deployer
744748
deployers = requests.get(self._hostname+"/v2/deployers", auth=self._auth).json()
@@ -773,7 +777,7 @@ def _deploy_to_kube(self):
773777
auth=self._auth,
774778
)
775779
self._deployment = deployment.json()
776-
return "https://"+deployment.json()["host"]+"/v1/models/model:predict"
780+
return self._get_deployment_url(deployment.json()["host"]) + ":predict"
777781

778782
def _wait_active(self):
779783
if self._deployment is None:
@@ -783,7 +787,7 @@ def _wait_active(self):
783787
while attempt < 120:
784788
attempt += 1
785789
try:
786-
resp = requests.get("https://"+self._deployment["host"]+"/v1/models/model")
790+
resp = requests.get(self._get_deployment_url(self._deployment["host"]))
787791
if resp.status_code != 200:
788792
raise Exception("status code %s" % (resp.status_code,))
789793
return

0 commit comments

Comments
 (0)