import GanetiCluster, paramiko, os
class JustSendFiles(object):
def __init__(self):
eucacluster = GanetiCluster.GanetiCluster('Coordinator.properties')
instances = eucacluster.describe_instances()
i = 0
for instance in instances:
ssh = paramiko.SSHClient()
transport = paramiko.Transport((instance.ip_address, 22))
transport.connect(username = 'root', password = 'secretpw')
transport.open_channel("session", instance.ip_address, "localhost")
sftp = paramiko.SFTPClient.from_transport(transport)
if i==0: #master
experiment_assets = [os.path.join(root, name) for root, dirs, files in os.walk("./templates/gstar_master") for name in files]
else: #worker
experiment_assets = [os.path.join(root, name) for root, dirs, files in os.walk("./templates/gstar") for name in files]
for expasset in experiment_assets:
sftp.put(expasset,expasset.replace("./templates","/root"))
sftp.close()
i = i+1
if __name__ == "__main__":
sendthem = JustSendFiles()