casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
Classes | Functions | Variables
pCASA Namespace Reference

Classes

class  pCASA
class  subMS
class  multiMS

Functions

def _load
def is_mms
def list
def create
def add
def remove
def _ip
def _launch
def _poor_mans_wait
def execute

Variables

 debug
tuple pc

Detailed Description

This module adds multiMS support to CASA tasks.

Example usage:

    1) Create the multiMS on disk. This will eventually be done by a
    parallel filler.

      pCASA.create("my.ms")
      pCASA.add("my.ms", "spw0.ms", "some_hostname")
      pCASA.add("my.ms", "spw1.ms", "some_hostname")
      pCASA.add("my.ms", "spw2.ms", "some_other_hostname")
      pCASA.add("my.ms", "spw3.ms")

   When no hostname is given (spw3.ms), the MS is assumed to be available
   from localhost. When finished, the contents of the multiMS can be shown
   with

      pCASA.list("my.ms")

   Named subMS entries can be removed with pCASA.remove()

   2) Now the following

      flagdata("my.ms", <parameters>)

   will have the effect of running

      flagdata("spw0.ms", <parameters>)
      flagdata("spw1.ms", <parameters>)
      flagdata("spw2.ms", <parameters>)
      flagdata("spw3.ms", <parameters>)

   on the given hosts, using parallel_go. This will also work in a single-
   machine (multi-core) environment. In a multi-host environment, notice
   that parallel_go requires password-less ssh in order to connect to the
   remote hosts.

   The user does not have to explicitly define the available hosts
   or the number of engines per host. The number of engines per host is
   determined (automatically) from the number of CPU cores on the
   local host. The available hosts are determined from the contents of
   the multiMS.

   It is possible (and a recommended way to avoid scheduling bottlenecks)
   to wrap more subMSs into one multiMS than the number of parallel engines
   (for example 20 subMSs on a single 8-core machine). The parallel engines
   are assigned and reassigned to individual subMSs on the fly, as they
   become idle.

Function Documentation

def pCASA._ip (   host) [private]
Returns a unique IP address of the given hostname,
i.e. not 127.0.0.1 for localhost but localhost's global IP

Definition at line 201 of file pCASA.py.

Referenced by execute(), and pCASA.pCASA.start().

def pCASA._launch (   engine,
  taskname,
  ms,
  parameters 
) [private]
Launches a job

Definition at line 219 of file pCASA.py.

Referenced by execute().

def pCASA._load (   mms_name) [private]
Returns the multiMS object, or throws
an exception if the file could not be loaded as
a multiMS

Definition at line 108 of file pCASA.py.

Referenced by add(), execute(), is_mms(), list(), and remove().

def pCASA._poor_mans_wait (   engines,
  taskname 
) [private]
Returns engine id and any exception thrown by the job.
The return value of the job is not made available.

Each pending job is polled once per second; this is inefficient
and should be replaced with a 'wait' call that blocks
until any job terminates and returns the ID of the job that
terminated. But that 'wait' function does not seem to exist.

Definition at line 242 of file pCASA.py.

Referenced by execute().

def pCASA.add (   mms_name,
  subms_name,
  hostname = "localhost" 
)
Add a subMS entry to a multiMS

Definition at line 167 of file pCASA.py.

References _load().

Referenced by tests.test_pcasa.pcasa_test.test1().

def pCASA.create (   mms_name)
Create an empty multiMS

Definition at line 155 of file pCASA.py.

Referenced by tests.test_pcasa.pcasa_test.test1().

def pCASA.execute (   taskname,
  parameters 
)
Runs the given task on the given multiMS.
If any of the jobs throw an exception, execution stops, and the
first exception that happened is rethrown by this function

Definition at line 277 of file pCASA.py.

References _ip(), _launch(), _load(), and _poor_mans_wait().

Referenced by task_flagdata.flagdata().

def pCASA.is_mms (   mms_name)
Returns true if and only if
the file with the given name contains a multiMS object

Definition at line 133 of file pCASA.py.

References _load().

Referenced by task_flagdata.flagdata().

def pCASA.list (   mms_name)
Prints the contents of the given multiMS

Definition at line 143 of file pCASA.py.

References _load().

Referenced by tests.test_pcasa.pcasa_test.test1().

def pCASA.remove (   mms_name,
  subms_name,
  hostname = "" 
)
Remove subMS entries from the multiMS

If the hostname is not given, all subMSs with the given name will
be removed. Otherwise only matching subMSs on the given host are
removed. 

Definition at line 180 of file pCASA.py.

References _load().

Referenced by asap.customgui_base.NotationWindowCommon._remove_seltext(), cleanhelper.cleanhelper.makemultifieldmask2(), and tests.test_pcasa.pcasa_test.test1().


Variable Documentation

Definition at line 59 of file pCASA.py.

tuple pCASA.pc

Definition at line 458 of file pCASA.py.