/usr/share/pyshared/pebl/taskcontroller/base.py is in python-pebl 1.0.2-2.
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 | import copy
#
# Tasks and their results
#
class Task(object):
def run(self): pass
def split(self, count):
return [self] + [copy.deepcopy(self) for i in xrange(count-1)]
class DeferredResult(object):
def __init__(self, **kw):
self.__dict__.update(kw)
@property
def result(self): pass
@property
def finished(self): pass
#
# Base Controllers
#
class _BaseController(object):
def __init__(self, *args, **kwargs): pass
def run(self, tasks): pass
# For synchronous task controllers (like serial and multiprocess), submit
# simply runs (blocking). Since the result of submit is a real result and
# not a deferred result, retrieve simply returns the results that were
# passed in. This let's synchronous and asynchronous task controllers have
# the same interface.
def submit(self, tasks):
return self.run(tasks)
def retrieve(self, deferred_results):
return deferred_results
class _BaseSubmittingController(_BaseController):
def submit(self, tasks): pass
def retrieve(self, deferred_results): pass
def run(self, tasks):
return self.retrieve(self.submit(tasks))
|