/usr/lib/python2.7/dist-packages/pebl/taskcontroller/ec2.py is in python-pebl 1.0.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | """Classes and functions for running tasks on Amazon's EC2"""
import time
import os.path
import shutil
import tempfile
import sys
from pebl import config, result
from pebl.taskcontroller.ipy1 import IPython1Controller, IPython1DeferredResult
from pebl.taskcontroller import ec2ipy1
class EC2DeferredResult(IPython1DeferredResult):
pass
class EC2Controller(IPython1Controller):
_params = (
config.StringParameter(
'ec2.config',
'EC2 config file',
default=''
),
config.IntParameter(
'ec2.min_count',
'Minimum number of EC2 instances to create (default=1).',
default=1
),
config.IntParameter(
'ec2.max_count',
"""Maximum number of EC2 instances to create
(default=0 means the same number as ec2.min_count).""",
default=0
)
)
def __init__(self, **options):
config.setparams(self, options)
self.ec2 = ec2ipy1.EC2Cluster(self.config)
self.start()
def __del__(self):
self.stop()
def start(self):
self.ec2.create_instances(self.min_count, self.max_count)
print "Updating pebl on worker nodes"
self.ec2.remote_all("cd /usr/local/src/pebl; svn update; python setup.py install")
self.ec2.start_ipython1(engine_on_controller=True)
self.ipy1taskcontroller = IPython1Controller(self.ec2.task_controller_url)
def stop(self):
self.ec2.terminate_instances()
def submit(self, tasks):
return self.ipy1taskcontroller.submit(tasks)
def retrieve(self, deferred_results):
return self.ipy1taskcontroller.retrieve(deferred_results)
def run(self, tasks):
return self.ipy1taskcontroller.run(tasks)
|