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

Commit

Permalink
Bug: throw error if submitting before master elected (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
jafreck authored Apr 5, 2018
1 parent 82ad029 commit a59fe8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions aztk/spark/helpers/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import List
import yaml
import azure.batch.models as batch_models
from aztk.error import AztkError
from aztk.utils import constants, helpers
from aztk.utils.command_builder import CommandBuilder

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

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

0 comments on commit a59fe8b

Please sign in to comment.