Skip to content

Commit

Permalink
Adds co-hosting back to helm_client.
Browse files Browse the repository at this point in the history
  • Loading branch information
pritchardn committed Mar 14, 2022
1 parent 700a7b9 commit 9e7d82c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions daliuge-engine/dlg/deploy/helm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ def __init__(self, deploy_name, chart_name="daliuge-daemon", deploy_dir="./",
else:
shutil.copytree(os.path.join(library_root, 'daliuge-k8s', 'helm'), self._deploy_dir)

def _set_physical_graph(self, physical_graph_content):
def _set_physical_graph(self, physical_graph_content, co_host=True):
self._physical_graph_file = physical_graph_content
self._islands, self._nodes = _find_resources(
self._physical_graph_file)
self._num_machines = _num_deployments_required(self._islands,
self._nodes)
self._nodes) - (1 if co_host else 0)

def _find_pod_details(self):
# NOTE: +1 for the master.
Expand All @@ -149,15 +149,15 @@ def _find_pod_details(self):
'svc': service_ips[-1]}
logger.debug(f'Pod details: {self._pod_details}')

def create_helm_chart(self, physical_graph_content):
def create_helm_chart(self, physical_graph_content, co_host=True):
"""
Translates a physical graph to a kubernetes helm chart.
For now, it will just try to run everything in a single container.
"""
if not self._k8s_access:
raise RuntimeError("Cannot access k8s")
# Add charts
self._set_physical_graph(physical_graph_content)
self._set_physical_graph(physical_graph_content, co_host)
_write_chart(self._chart_dir, 'Chart.yaml', self._chart_name, self._chart_version,
dlg_version,
self._chart_vars['home'], self._chart_vars['description'],
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/deploy/start_helm_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def start_helm(physical_graph_template, num_nodes: int, deploy_dir: str):
chart_name='daliuge-daemon',
deploy_dir=deploy_dir
)
helm_client.create_helm_chart(json.dumps(pgt))
helm_client.create_helm_chart(json.dumps(pgt), co_host=True)
try:
helm_client.launch_helm()
helm_client.submit_pgt()
Expand Down
4 changes: 2 additions & 2 deletions daliuge-engine/test/deploy/test_helm_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_create_single_node_helm_chart(self):
drop["island"] = "127.0.0.1"
with tempfile.TemporaryDirectory() as tmp_dir:
helm_client = HelmClient(deploy_dir=tmp_dir, deploy_name='dlg-test')
helm_client.create_helm_chart(json.dumps(pg))
helm_client.create_helm_chart(json.dumps(pg), co_host=False)
self.assertEqual(pg, json.loads(helm_client._physical_graph_file))
self.assertEqual(1, helm_client._num_machines)

Expand Down Expand Up @@ -105,7 +105,7 @@ def test_create_multi_node_helm_chart(self):
]
with tempfile.TemporaryDirectory() as tmp_dir:
helm_client = HelmClient(deploy_dir=tmp_dir, deploy_name='dlg_test')
helm_client.create_helm_chart(json.dumps(pg))
helm_client.create_helm_chart(json.dumps(pg), co_host=False)
# TODO: Assert translation works
self.assertEqual(2, helm_client._num_machines)

Expand Down
2 changes: 1 addition & 1 deletion daliuge-translator/dlg/dropmake/web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ async function helmDeploy() {
.catch(function (error) {
alert(error + "\nUnable to contiune!");
});

//alert("Chart deployed, check the dashboard of your k8s cluster for status updates.")
console.log("deploy graph response", deploy_graph);
// Open DIM session page in new tab
// Until we have somewhere else to re-direct helm deployments. This is probably for the best.
Expand Down

0 comments on commit 9e7d82c

Please sign in to comment.