Blame view

JustSendFiles.py 1.01 KB
f32e4dbde   Thanasis Naskos   send files to nodes
1
2
3
4
5
6
7
8
  import GanetiCluster, paramiko, os
  
  
  class JustSendFiles(object):
      
  	def __init__(self):
  		eucacluster = GanetiCluster.GanetiCluster('Coordinator.properties')
  		instances = eucacluster.describe_instances()
f32e4dbde   Thanasis Naskos   send files to nodes
9
  		for instance in instances:
1f630f3b1   Thanasis Naskos   bug fixes
10
  			
f32e4dbde   Thanasis Naskos   send files to nodes
11
12
13
14
15
  			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)
1f630f3b1   Thanasis Naskos   bug fixes
16
  			if instance.ip_address == "192.168.1.74": #master
f32e4dbde   Thanasis Naskos   send files to nodes
17
18
19
20
21
22
  				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()
f32e4dbde   Thanasis Naskos   send files to nodes
23
24
25
26
  
  
  if __name__ == "__main__":
  	sendthem = JustSendFiles()