Commit f32e4dbdee0249760f10c353eb50b6b7308f1b5c

Authored by Thanasis Naskos
1 parent ec4e01244c
Exists in master

send files to nodes

Showing 2 changed files with 40 additions and 3 deletions

GstarCluster.py View file @ f32e4db
... ... @@ -117,12 +117,12 @@
117 117 stdin, stdout, stderr = ssh.exec_command('mount /media/datasets')
118 118  
119 119 # sending experiment execution files
120   - stdin, stdout, stderr = ssh.exec_command('mkdir /root/gstar')
  120 + stdin, stdout, stderr = ssh.exec_command('mkdir /root/gstar_master')
121 121 transport = paramiko.Transport((node.ip_address, 22))
122 122 transport.connect(username = 'root', password = 'secretpw')
123 123 transport.open_channel("session", node.ip_address, "localhost")
124 124 sftp = paramiko.SFTPClient.from_transport(transport)
125   - experiment_assets = [os.path.join(root, name) for root, dirs, files in os.walk("./templates/gstar") for name in files]
  125 + experiment_assets = [os.path.join(root, name) for root, dirs, files in os.walk("./templates/gstar_master") for name in files]
126 126 for expasset in experiment_assets:
127 127 sftp.put(expasset,expasset.replace("./templates","/root"))
128 128 sftp.close()
... ... @@ -134,7 +134,17 @@
134 134 # Make a /etc/hosts file as you go
135 135 hosts.write(node.ip_address + "\t" + host_template + str(i) +"\n")
136 136  
137   -
  137 + # sending experiment execution files
  138 + stdin, stdout, stderr = ssh.exec_command('mkdir /root/gstar')
  139 + transport = paramiko.Transport((node.ip_address, 22))
  140 + transport.connect(username = 'root', password = 'secretpw')
  141 + transport.open_channel("session", node.ip_address, "localhost")
  142 + sftp = paramiko.SFTPClient.from_transport(transport)
  143 + experiment_assets = [os.path.join(root, name) for root, dirs, files in os.walk("./templates/gstar") for name in files]
  144 + for expasset in experiment_assets:
  145 + sftp.put(expasset,expasset.replace("./templates","/root"))
  146 + sftp.close()
  147 +
138 148 # Set hostname on the machine
139 149 stdin, stdout, stderr = ssh.exec_command('echo \"'+host_template+str(i)+"\" > /etc/hostname")
140 150 stdin, stdout, stderr = ssh.exec_command('hostname \"'+host_template+str(i)+"\"")
JustSendFiles.py View file @ f32e4db
  1 +import GanetiCluster, paramiko, os
  2 +
  3 +
  4 +class JustSendFiles(object):
  5 +
  6 + def __init__(self):
  7 + eucacluster = GanetiCluster.GanetiCluster('Coordinator.properties')
  8 + instances = eucacluster.describe_instances()
  9 + i = 0
  10 + for instance in instances:
  11 + ssh = paramiko.SSHClient()
  12 + transport = paramiko.Transport((instance.ip_address, 22))
  13 + transport.connect(username = 'root', password = 'secretpw')
  14 + transport.open_channel("session", instance.ip_address, "localhost")
  15 + sftp = paramiko.SFTPClient.from_transport(transport)
  16 + if i==0: #master
  17 + experiment_assets = [os.path.join(root, name) for root, dirs, files in os.walk("./templates/gstar_master") for name in files]
  18 + else: #worker
  19 + experiment_assets = [os.path.join(root, name) for root, dirs, files in os.walk("./templates/gstar") for name in files]
  20 + for expasset in experiment_assets:
  21 + sftp.put(expasset,expasset.replace("./templates","/root"))
  22 + sftp.close()
  23 + i = i+1
  24 +
  25 +
  26 +if __name__ == "__main__":
  27 + sendthem = JustSendFiles()