just my own test if work on external computer


In [1]:
%%bash
. ~/.bashrc
pip install  --upgrade git+https://git@github.com/JonasWallin/linkingEC2


Collecting git+https://git@github.com/JonasWallin/linkingEC2
  Cloning https://git@github.com/JonasWallin/linkingEC2 to /var/folders/ct/zpjk2t696k5bv03sqq9xrpd00000gn/T/pip-O55g_K-build
Requirement already up-to-date: boto in /Users/jonaswallin/anaconda/lib/python2.7/site-packages (from linkingEC2==0.1)
Installing collected packages: linkingEC2
  Found existing installation: linkingEC2 0.1
    Uninstalling linkingEC2-0.1:
      Successfully uninstalled linkingEC2-0.1
  Running setup.py install for linkingEC2
Successfully installed linkingEC2-0.1

In [2]:
## short tutorial on running MPI4py on EC2 

from ConfigParser import ConfigParser
config = ConfigParser()
starfigconfig_folder = "/Users/jonaswallin/.starcluster/"
config.read(starfigconfig_folder + "config")

acess_key_id     = config.get('aws info', 'aws_access_key_id'    , 0)
aws_secret_key   = config.get('aws info', 'aws_secret_access_key', 0)
aws_region_name  = config.get('aws info', 'aws_region_name'      , 0)
my_key_loc       = config.get('key mykeyABC', 'key_location',0)
from linkingEC2 import LinkingHandler
linker = LinkingHandler(aws_secret_access_key = aws_secret_key,
                        aws_access_key_id     = acess_key_id,
                        aws_region_name       = aws_region_name,
                        key_location          = my_key_loc,
                        key_name              = 'mykeyABC')
linker.start_cluster('ami-d05e75b8', 't2.micro', ['linking_EC2'],1)


waiting for instances 0  to be running: 
******

checking if ssh into node001 works:
*
collecting node001 number of processes:done
copying ~/.ssh/mykeyABC.rsa to external ~/.ssh/id_rsa
copying files to node001 done
disable StrictHostKeyChecking  in node001:appending to ~/nodefile in node001 done
appending to /etc/hosts in node001 done

In [5]:
import time
PACKAGES_APT = ['python-dev', 'openmpi-bin', 'libopenmpi-dev', 'python-numpy','git']
PACKAGES_PIP = ['mpi4py','cython']
time_in = time.time()
linker.apt_install(PACKAGES_APT)
linker.pip_install(PACKAGES_PIP)
time_out = time.time()
import os
os.system('say "your packages is downloaded"')
print('it took {time:.2f} sec'.format(time = time_out - time_in))


installing the packages : python-dev openmpi-bin libopenmpi-dev python-numpy git

installing the packages : mpi4py cython

installing package for node001
node001 is done
it took 91.04 sec
installing package for node001
node001 is done

In [28]:
linker.pip_install(["-e 'git+https://git@github.com/JonasWallin/rtnorm.git#egg=rtnorm&subdirectory=python/rtnorm' "])


installing the packages : -e git+https://git@github.com/JonasWallin/rtnorm.git#egg=rtnorm&subdirectory=python/rtnorm/

installing package for node001
node001 is done
Out[28]:
0

In [29]:
print( linker.get_ssh_login() ) # print( linker.get_ssh_login(1) )


ssh  -i ~/.ssh/mykeyABC.rsa -o 'StrictHostKeyChecking no'  ubuntu@ec2-54-210-56-27.compute-1.amazonaws.com

In [ ]: