コード例 #1
0
ファイル: deploy_test2.py プロジェクト: willmore/D2C
def main(argv=None):
    '''
    End-to-End integration test of deployment lifecycle.
    Uses one micro, EBS-backed instance,   
    '''
    
    SQLITE_FILE = "%s/.d2c_test/deploy_test.sqlite" % os.path.expanduser('~') 
    if os.path.exists(SQLITE_FILE):
        print "Deleting existing DB"
        os.unlink(SQLITE_FILE)
    dao = DAO(SQLITE_FILE)
    
    conf = TestConfig("/home/willmore/test.conf")
        
    dao.saveConfiguration(conf)
    
    ec2ConnFactory = EC2ConnectionFactory(conf.awsCred.access_key_id, 
                                          conf.awsCred.secret_access_key, 
                                          StdOutLogger())
    
    #credStore = CredStore(dao)
    
    testDir = "/tmp/d2c/%s/" % random.randint(0, 1000)
    
    sshCred = SSHCred('dirac', '/home/willmore/dirac.id_rsa')
    
    deployment = Deployment("dummyDep", 
                            ec2ConnFactory, 
                            roles=[
                                   Role("dummyDep", "loner", 
                                        ami=AMI(amiId="ami-1396a167"), 
                                        count=1, 
                                        instanceType=InstanceType.M1_LARGE,
                                        startActions=[Action(command="echo howdy > /tmp/howdy.txt", 
                                                             sshCred=sshCred)],
                                        finishedChecks=[FileExistsFinishedCheck(fileName="/tmp/howdy.txt", 
                                                                                sshCred=sshCred)],
                                        #stopActions=[Action(command="sudo service collectd stop", 
                                        #                    sshCred=sshCred)],
                                        dataCollectors=[DataCollector(source="/tmp/howdy.txt", 
                                                                      destination=testDir + "howdy.txt",
                                                                      sshCred=sshCred),
                                                        DataCollector(source="/opt/collectd/var/lib/collectd", 
                                                                      destination=testDir + "collectd_stats",
                                                                      sshCred=sshCred)])])
    
    class Listener:  
        def notify(self, event):
            print "Deployment state changed to: " + event.newState
    
    deployment.addAnyStateChangeListener(Listener())
        
    thread = Thread(target=deployment.run)
    thread.start()
    thread.join()
コード例 #2
0
ファイル: 22_py_run.py プロジェクト: willmore/D2C-Experiments
def main(argv=None):
    
    conf = TestConfig("/home/willmore/test.conf")
    StdOutLogger().write("test123")        
    ec2ConnFactory = EC2ConnectionFactory(conf.awsCred.access_key_id, 
                                          conf.awsCred.secret_access_key, 
                                          StdOutLogger())
        
    masterOutDir = "./master/"
    
    sshCred = SSHCred('dirac', '/home/willmore/dirac.id_rsa')
    
    numHosts = 4
    script = "/home/dirac/amAu111BF4/22.py"
    doneFile = "/tmp/done.txt"
    startCmd = "nohup mpirun -np %d -hostfile /tmp/d2c.context gpaw-python %s &> experiment.out || true && date > %s &" % (numHosts, script, doneFile)


    instanceType = InstanceType("m1.xlarge", 2, 7500, 850, [])


    deployment = Deployment("22_py", 
                            ec2ConnFactory, 
                            roles=[
                                   Role("22_py", "master", 
                                        ami=AMI(amiId="ami-1396a167"), 
					count=1, 
                                        instanceType=instanceType,
					contextCred=sshCred,
                                        startActions=[Action(command=startCmd, 
                                                             sshCred=sshCred)],
                                        finishedChecks=[FileExistsFinishedCheck(fileName=doneFile, 
                                                                                sshCred=sshCred)],
                            
                                        dataCollectors=[DataCollector(source="/home/dirac", 
                                                                      destination=masterOutDir + "home_dir",
                                                                      sshCred=sshCred),
                                                        DataCollector(source="/opt/collectd/var/lib/collectd", 
                                                                      destination=masterOutDir + "collectd_stats",
                                                                      sshCred=sshCred)])])
    
    class Listener:  
        def notify(self, event):
            print "Deployment state changed to: " + event.newState
    
    deployment.addAnyStateChangeListener(Listener())
        
    thread = Thread(target=deployment.run)
    thread.start()
    thread.join()
コード例 #3
0
def main(argv=None):
    
    '''
    Executes the HPCC test suite on fout m1.xlarge instances.
    Total cores = 16
    Total memory = 60GB
    HPCC N = sqrt(60000000 / 8) * .8 = 2190
    '''
    
    
    conf = FileConfiguration("/home/willmore/test.conf")
    ec2ConnFactory = EC2ConnectionFactory(conf.awsCred.access_key_id, 
                                          conf.awsCred.secret_access_key, 
                                          StdOutLogger())
        
    masterRole = "master"
    slaveRole = "slave"
    masterOutDir = "./results/master/"
    slaveOutDir = "./results/slave/"    
    sshCred = SSHCred('hpcc-user', '/home/willmore/.ssh/id_rsa_nopw')
    
    numCores = 16 
    doneFile = "/tmp/done.txt"
    startCmd = "mpirun -np %d -hostfile /tmp/d2c.context hpcc > experiment.out 2>&1; date > %s" % (numCores, doneFile)
    

    instanceType = InstanceType("m1.xlarge", 4, 7500, 1500, [])

    cloudHppcAMI = AMI(amiId="ami-295e685d")

    collectdSrc = "/var/lib/collectd/rrd/cloud-hpcc"

    deployment = Deployment("cloud_hpcc", 
                            ec2ConnFactory, 
                            roles=[
                                   Role(masterRole, "master", 
                                        ami=cloudHppcAMI, 
					                    count=1, 
                                        instanceType=instanceType,
					                    contextCred=sshCred,
                                        startActions=[UploadAction(source="./input/hpccinf.txt", 
                                                                   destination="/home/hpcc-user/hpccinf.txt", 
                                                                   sshCred=sshCred),
                                                      AsyncAction(command=startCmd, 
                                                                  sshCred=sshCred)],
                                        finishedChecks=[FileExistsFinishedCheck(fileName=doneFile,
                                                                                sshCred=sshCred)],
                            
                                        dataCollectors=[DataCollector(source="/home/hpcc-user", 
                                                                      destination=masterOutDir + "home_dir",
                                                                      sshCred=sshCred),
                                                        DataCollector(source=collectdSrc, 
                                                                      destination=masterOutDir + "collectd_stats",
                                                                      sshCred=sshCred)]),
				                    Role(slaveRole, "slave",
                                         ami=cloudHppcAMI,
                                         count=3,
                                         instanceType=instanceType,
                                         contextCred=sshCred,
                                         dataCollectors=[DataCollector(source="/home/hpcc-user",
                                                                      destination=slaveOutDir + "home_dir",
                                                                      sshCred=sshCred),
                                                         DataCollector(source=collectdSrc,
                                                                      destination=slaveOutDir + "collectd_stats",
                                                                      sshCred=sshCred)])

				])
    
    class Listener:  
        def notify(self, event):
            print "Deployment state changed to: " + event.newState
    
    deployment.addAnyStateChangeListener(Listener())
        
    deployment.run()
コード例 #4
0
ファイル: 34_py_run.py プロジェクト: willmore/D2C-Experiments
def main(argv=None):
    
    conf = TestConfig("/home/willmore/test.conf")
    ec2ConnFactory = EC2ConnectionFactory(conf.awsCred.access_key_id, 
                                          conf.awsCred.secret_access_key, 
                                          StdOutLogger())
        
    masterRole = "master"
    slaveRole = "slave"
    masterOutDir = "./results/master/"
    slaveOutDir = "./results/slave/"    
    sshCred = SSHCred('dirac', '/home/willmore/dirac.id_rsa')
    
    numHosts = 32
    script = "/home/dirac/amAu111BF4/34.py"
    doneFile = "/tmp/done.txt"
    startCmd = "mpirun -np %d -hostfile /tmp/d2c.context gpaw-python %s > experiment.out 2>&1; date > %s" % (numHosts, script, doneFile)


    instanceType = InstanceType("m1.xlarge", 2, 7500, 850, [])
    fixSSHCmd = "echo \"Host *\n   StrictHostKeyChecking no\" > .ssh/config"

    deployment = Deployment("34_py", 
                            ec2ConnFactory, 
                            roles=[
                                   Role(masterRole, "master", 
                                        ami=AMI(amiId="ami-1396a167"), 
					count=1, 
                                        instanceType=instanceType,
					contextCred=sshCred,
                                        startActions=[Action(command=fixSSHCmd,
							     sshCred=sshCred),
							AsyncAction(command=startCmd, 
                                                             sshCred=sshCred)],
                                        finishedChecks=[FileExistsFinishedCheck(fileName=doneFile,
                                                                                sshCred=sshCred)],
                            
                                        dataCollectors=[DataCollector(source="/home/dirac", 
                                                                      destination=masterOutDir + "home_dir",
                                                                      sshCred=sshCred),
                                                        DataCollector(source="/opt/collectd/var/lib/collectd", 
                                                                      destination=masterOutDir + "collectd_stats",
                                                                      sshCred=sshCred)]),
				    Role(slaveRole, "slave",
                                        ami=AMI(amiId="ami-1396a167"),
                                        count=7,
                                        instanceType=instanceType,
                                        contextCred=sshCred,
                                        dataCollectors=[DataCollector(source="/home/dirac",
                                                                      destination=slaveOutDir + "home_dir",
                                                                      sshCred=sshCred),
                                                        DataCollector(source="/opt/collectd/var/lib/collectd",
                                                                      destination=slaveOutDir + "collectd_stats",
                                                                      sshCred=sshCred)])

				])
    
    class Listener:  
        def notify(self, event):
            print "Deployment state changed to: " + event.newState
    
    deployment.addAnyStateChangeListener(Listener())
        
    deployment.run()
コード例 #5
0
ファイル: test.py プロジェクト: willmore/D2C-Experiments
def main(argv=None):
    '''
    End-to-End integration test of deployment lifecycle.
    Uses one micro, EBS-backed instance,   
    '''
    
    SQLITE_FILE = "%s/.d2c_test/deploy_test.sqlite" % os.path.expanduser('~') 
    if os.path.exists(SQLITE_FILE):
        print "Deleting existing DB"
        os.unlink(SQLITE_FILE)
    dao = DAO(SQLITE_FILE)
    
    conf = TestConfig("/home/willmore/test.conf")
        
    dao.saveConfiguration(conf)
    
    ec2ConnFactory = EC2ConnectionFactory(conf.awsCred.access_key_id, 
                                          conf.awsCred.secret_access_key, 
                                          StdOutLogger())
    
    credStore = CredStore(dao)
    
    ec2Cred = credStore.getDefaultEC2Cred()
    
    testDir = "/tmp/d2c/%s" % random.randint(0, 1000)
    
    sshCred = SSHCred('ec2-user', '/home/willmore/cert/cloudeco.pem')
    
    
    deployment = Deployment("dummyDep", 
                            ec2ConnFactory, 
                            roles=[
                                   Role("dummyDep", "loner", 
                                        ami=AMI(amiId="ami-47cefa33"), 
                                        count=1, 
                                        launchCred=ec2Cred,
                                        instanceType=InstanceType.T1_MICRO,
                                        
                                        startActions=[Action(command="echo howdy > /tmp/howdy.txt", 
                                                             sshCred=sshCred)],
                                        
                                        finishedChecks=[FileExistsFinishedCheck(fileName="/tmp/howdy.txt", 
                                                                                sshCred=sshCred)],
                                        
                                        stopActions=[Action(command="echo adios > /tmp/adios.txt", 
                                                             sshCred=sshCred)],
                                        
                                        dataCollectors=[DataCollector(source="/tmp/howdy.txt", 
                                                                      destination=testDir,
                                                                      sshCred=sshCred),
                                                        DataCollector(source="/tmp/adios.txt", 
                                                                      destination=testDir,
                                                                      sshCred=sshCred),
                                                        DataCollector(source="/tmp/d2c.context", 
                                                                      destination=testDir,
                                                                      sshCred=sshCred)])])
    
    class Listener:  
        def notify(self, event):
            print "Deployment state changed to: " + event.newState
    
    deployment.addAnyStateChangeListener(Listener())
        
    thread = Thread(target=deployment.run)
    thread.start()
    thread.join()
    
    print "howdy.txt fetch = %s" % str(os.path.exists(testDir + "/howdy.txt"))
    print "adios.txt fetch = %s" % str(os.path.exists(testDir + "/adios.txt"))
    print "d2c.context fetch = %s" % str(os.path.exists(testDir + "/d2c.context"))