In [1]:
from CompasAzure import prepareCommands
from azureJobManager import AzureJobManager
from compasJob import CompasJob

In [2]:
commands = prepareCommands()

jobs = []
for i,command in enumerate(commands):
    j = CompasJob()
    j.initialise(i,command,'.','/home/jbarrett/COMPAS/COMPAS/COMPAS')
    jobs.append(j)

In [3]:
ajm = AzureJobManager('qwerty1234567',3,jobs,verbose=True,sleepTime=30)


Now creating a resource group with command az group create --name qwerty1234567 -l centralus

In [ ]:
ajm.run()


now launching VM with nameqwerty1234567vm0
now launching VM with the command;
az vm create --storage-sku Standard_LRS --ssh-key-value ~/.ssh/id_rsa.pub --size Basic_A0 --image UbuntuLTS --name qwerty1234567vm0 --admin-username ops --resource-group qwerty1234567 --location centralus 
VM launched with nameqwerty1234567vm0
found public IP address: 52.176.60.6
copying file with command scp -o 'StrictHostKeyChecking no' /home/jbarrett/COMPAS/COMPAS/COMPAS ops@52.176.60.6:.
copying file with command scp -o 'StrictHostKeyChecking no' bashFile0.bash ops@52.176.60.6:.
sending command via the full command 
ssh -o 'StrictHostKeyChecking no' ops@52.176.60.6 'chmod 744 bashFile0.bash'
completed...
copying file with command scp -o 'StrictHostKeyChecking no' pythonFile0.py ops@52.176.60.6:.
sending command via the full command 
ssh -o 'StrictHostKeyChecking no' ops@52.176.60.6 'python pythonFile0.py'
completed...
now launching VM with nameqwerty1234567vm1
now launching VM with the command;
az vm create --storage-sku Standard_LRS --ssh-key-value ~/.ssh/id_rsa.pub --size Basic_A0 --image UbuntuLTS --name qwerty1234567vm1 --admin-username ops --resource-group qwerty1234567 --location centralus 
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-4-d9535cd1c992> in <module>()
----> 1 ajm.run()

/home/jbarrett/AzureJobManager/azureJobManager.pyc in run(self)
    137         for vm in self._virtualMachines:
    138 
--> 139             vm.launch()
    140             self._activeJobs.append(self._idleJobs[0])
    141             self._idleJobs[0].activate(vm)

/home/jbarrett/AzureJobManager/virtualMachine.pyc in launch(self)
    104             self.verbosePrint(command)
    105 
--> 106             vmDetails = sp.check_output(command,shell=True)
    107             vmDetails = vmDetails.split('\n')
    108 

/usr/lib/python2.7/subprocess.pyc in check_output(*popenargs, **kwargs)
    565         raise ValueError('stdout argument not allowed, it will be overridden.')
    566     process = Popen(stdout=PIPE, *popenargs, **kwargs)
--> 567     output, unused_err = process.communicate()
    568     retcode = process.poll()
    569     if retcode:

/usr/lib/python2.7/subprocess.pyc in communicate(self, input)
    789                 self.stdin.close()
    790             elif self.stdout:
--> 791                 stdout = _eintr_retry_call(self.stdout.read)
    792                 self.stdout.close()
    793             elif self.stderr:

/usr/lib/python2.7/subprocess.pyc in _eintr_retry_call(func, *args)
    474     while True:
    475         try:
--> 476             return func(*args)
    477         except (OSError, IOError) as e:
    478             if e.errno == errno.EINTR:

KeyboardInterrupt: 

In [ ]:
ajm.cleanUp()

In [ ]:
import subprocess as sp

In [ ]:
sp.Popen()