Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Private Member Functions
Bio.PopGen.Async.Async Class Reference
Inheritance diagram for Bio.PopGen.Async.Async:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def run_program
def get_result

Public Attributes

 running
 waiting
 done
 id
 hooks
 access_ds

Private Member Functions

def _run_program

Detailed Description

Abstract Asynchronous execution class.

   This is the top abstract class.
   Concrete classes must implement the _run_program method.

Definition at line 16 of file __init__.py.


Constructor & Destructor Documentation

Async constructor.

   Initializes the queues, among other things.
   Of notice, is the access_ds lock for controlling exclusive
       access to this object.

Definition at line 23 of file __init__.py.

00023 
00024     def __init__(self):
00025         '''Async constructor.
00026 
00027            Initializes the queues, among other things.
00028            Of notice, is the access_ds lock for controlling exclusive
00029                access to this object.
00030         '''
00031         self.running = {}
00032         self.waiting = []
00033         self.done = {}
00034         self.id = 0
00035         self.hooks = {}
00036         self.access_ds = thread.allocate_lock()


Member Function Documentation

def Bio.PopGen.Async.Async._run_program (   self,
  id,
  program,
  parameters,
  input_files 
) [private]
Actually run the program, handled by a subclass (PRIVATE).

This method should be replaced by any derived class to do
something useful. It will be called by the run_program method.

Reimplemented in Bio.PopGen.Async.Local.Local.

Definition at line 62 of file __init__.py.

00062 
00063     def _run_program(self, id, program, parameters, input_files):
00064         """Actually run the program, handled by a subclass (PRIVATE).
00065 
00066         This method should be replaced by any derived class to do
00067         something useful. It will be called by the run_program method.
00068         """
00069         raise NotImplementedError("This object should be subclassed")

Here is the caller graph for this function:

def Bio.PopGen.Async.Async.get_result (   self,
  id 
)
Returns the results for a certain Id, the info for that Id is
    forgotten.

    parameters:
    id Id of the task.

    returns:
    (return_code, output_files) return code and file access
    object.

    The output_files hash key is a relative file name, and the value a
    output stream.

Definition at line 70 of file __init__.py.

00070 
00071     def get_result(self, id):
00072         ''' Returns the results for a certain Id, the info for that Id is
00073             forgotten.
00074 
00075             parameters:
00076             id Id of the task.
00077 
00078             returns:
00079             (return_code, output_files) return code and file access
00080             object.
00081 
00082             The output_files hash key is a relative file name, and the value a
00083             output stream.
00084         '''
00085         self.access_ds.acquire()
00086         if id in self.done:
00087             returnCode, fileObject = self.done[id]
00088             del self.done[id]
00089             self.access_ds.release()
00090         else:
00091             self.access_ds.release()
00092             return None

def Bio.PopGen.Async.Async.run_program (   self,
  program,
  parameters,
  input_files 
)
Runs a program.

   Real _run_program to be implemented by concrete classes.

   parameters:
   program String identifying program.
   parameters List of String parameters.
   input_files Hash of Input file descriptors.

   returns:
   Task Id.

   The input_files hash key is the path that is passed
   to the program. It should always be relative.
   Value is a stream.

Definition at line 37 of file __init__.py.

00037 
00038     def run_program(self, program, parameters, input_files):
00039         '''Runs a program.
00040         
00041            Real _run_program to be implemented by concrete classes.
00042 
00043            parameters:
00044            program String identifying program.
00045            parameters List of String parameters.
00046            input_files Hash of Input file descriptors.
00047 
00048            returns:
00049            Task Id.
00050 
00051            The input_files hash key is the path that is passed
00052            to the program. It should always be relative.
00053            Value is a stream.
00054         '''
00055         if program in self.hooks:
00056             self.access_ds.acquire()
00057             self.id += 1
00058             id = self.id
00059             self.access_ds.release()
00060             self._run_program(id, self.hooks[program], parameters, input_files)
00061             return id

Here is the call graph for this function:


Member Data Documentation

Definition at line 35 of file __init__.py.

Definition at line 32 of file __init__.py.

Definition at line 34 of file __init__.py.

Definition at line 33 of file __init__.py.

Definition at line 30 of file __init__.py.

Definition at line 31 of file __init__.py.


The documentation for this class was generated from the following file: