Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

Commit a59fe8b

Browse files
authored
Bug: throw error if submitting before master elected (#479)
1 parent 82ad029 commit a59fe8b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

aztk/spark/helpers/submit.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import List
44
import yaml
55
import azure.batch.models as batch_models
6+
from aztk.error import AztkError
67
from aztk.utils import constants, helpers
78
from aztk.utils.command_builder import CommandBuilder
89

@@ -104,6 +105,8 @@ def generate_task(spark_client, container_id, application):
104105

105106
def affinitize_task_to_master(spark_client, cluster_id, task):
106107
cluster = spark_client.get_cluster(cluster_id)
108+
if cluster.master_node_id is None:
109+
raise AztkError("Master has not yet been selected. Please wait until the cluster is finished provisioning.")
107110
master_node = spark_client.batch_client.compute_node.get(pool_id=cluster_id, node_id=cluster.master_node_id)
108111
task.affinity_info = batch_models.AffinityInformation(affinity_id=master_node.affinity_id)
109112
return task

0 commit comments

Comments
 (0)