зеркало из https://github.com/Azure/aztk.git
Fix broken code after CR
This commit is contained in:
Родитель
27b14e6adc
Коммит
8f5757cea3
|
@ -70,7 +70,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# get ssh command
|
# get ssh command
|
||||||
clusterlib.ssh(
|
clusterlib.ssh(
|
||||||
pool_id = pool_id,
|
cluster_id = pool_id,
|
||||||
masterui = masterui,
|
masterui = masterui,
|
||||||
webui = webui,
|
webui = webui,
|
||||||
jupyter = jupyter,
|
jupyter = jupyter,
|
||||||
|
|
|
@ -81,13 +81,13 @@ def generate_cluster_start_task(
|
||||||
|
|
||||||
|
|
||||||
def create_cluster(
|
def create_cluster(
|
||||||
custom_script:str,
|
custom_script: str,
|
||||||
cluster_id:str,
|
cluster_id: str,
|
||||||
vm_count,
|
vm_count,
|
||||||
vm_low_pri_count,
|
vm_low_pri_count,
|
||||||
vm_size,
|
vm_size,
|
||||||
username:str,
|
username: str,
|
||||||
password:str,
|
password: str,
|
||||||
wait=True):
|
wait=True):
|
||||||
"""
|
"""
|
||||||
Create a spark cluster
|
Create a spark cluster
|
||||||
|
@ -257,7 +257,13 @@ def delete_cluster(cluster_id: str):
|
||||||
|
|
||||||
# job id is equal to pool id
|
# job id is equal to pool id
|
||||||
job_id = pool_id
|
job_id = pool_id
|
||||||
job_exists = batch_client.job.exists(job_id)
|
job_exists = True
|
||||||
|
|
||||||
|
try:
|
||||||
|
batch_client.job.get(job_id)
|
||||||
|
except:
|
||||||
|
job_exists = False
|
||||||
|
|
||||||
pool_exists = batch_client.pool.exists(pool_id)
|
pool_exists = batch_client.pool.exists(pool_id)
|
||||||
|
|
||||||
if job_exists:
|
if job_exists:
|
||||||
|
@ -269,6 +275,7 @@ def delete_cluster(cluster_id: str):
|
||||||
if job_exists or pool_exists:
|
if job_exists or pool_exists:
|
||||||
print("Deleting cluster {0}".format(cluster_id))
|
print("Deleting cluster {0}".format(cluster_id))
|
||||||
|
|
||||||
|
|
||||||
def ssh(
|
def ssh(
|
||||||
cluster_id: str,
|
cluster_id: str,
|
||||||
username: str=None,
|
username: str=None,
|
||||||
|
@ -296,6 +303,7 @@ def ssh(
|
||||||
remote_login_settings = batch_client.compute_node.get_remote_login_settings(
|
remote_login_settings = batch_client.compute_node.get_remote_login_settings(
|
||||||
cluster_id, master_node_id)
|
cluster_id, master_node_id)
|
||||||
|
|
||||||
|
master_node_ip = remote_login_settings.remote_login_ip_address
|
||||||
master_node_port = remote_login_settings.remote_login_port
|
master_node_port = remote_login_settings.remote_login_port
|
||||||
|
|
||||||
ssh_command = CommandBuilder('ssh')
|
ssh_command = CommandBuilder('ssh')
|
||||||
|
@ -308,7 +316,7 @@ def ssh(
|
||||||
ssh_command.add_option("-L", "{0}:localhost:{1}".format(port[0], port[1]))
|
ssh_command.add_option("-L", "{0}:localhost:{1}".format(port[0], port[1]))
|
||||||
|
|
||||||
user = username if username is not None else '<username>'
|
user = username if username is not None else '<username>'
|
||||||
ssh_command.add_argument("{0}@{1} -p {2}".format(user, master_node_id, master_node_port))
|
ssh_command.add_argument("{0}@{1} -p {2}".format(user, master_node_ip, master_node_port))
|
||||||
|
|
||||||
command = ssh_command.to_str()
|
command = ssh_command.to_str()
|
||||||
ssh_command_array = command.split()
|
ssh_command_array = command.split()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче