Ignore:
Timestamp:
Apr 7, 2010 1:53:58 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
7fe81be
Parents:
3e3a5de
Message:

Two changes at once

Remove master and export project from the create request and rename the splitter external interface into a translation interface. The export_project pseudo service is staring.

Also start removeing some deprecated fields.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • fedd/federation/ns2topdl.py

    r3e3a5de r5f6929a  
    2020fl.addHandler(nullHandler())
    2121
    22 class split_local:
     22class ns2topdl_local:
    2323    def __init__(self, config=None, auth=None):
    2424        """
    2525        Intialize the various attributes, most from the config object
    2626        """
    27         self.debug = config.getboolean("splitter", "debug")
    28         self.muxmax = config.getint("splitter", "muxmax", 3)
    29         self.tclsh = config.get("splitter", "tclsh",
     27        self.debug = config.getboolean("ns2topdl", "debug")
     28        self.muxmax = config.getint("ns2topdl", "muxmax", 3)
     29        self.tclsh = config.get("ns2topdl", "tclsh",
    3030                "/usr/local/bin/otclsh")
    31         self.tcl_splitter = config.get("splitter", "tcl_splitter",
     31        self.tcl_splitter = config.get("ns2topdl", "tcl_splitter",
    3232                "/usr/testbed/lib/ns2ir/parse.tcl")
    33         access_db = config.get("splitter", "accessdb", None)
    34         allow_any = config.getboolean("splitter", "allow_any", False)
     33        access_db = config.get("ns2topdl", "accessdb", None)
     34        allow_any = config.getboolean("ns2topdl", "allow_any", False)
    3535
    36         self.log = logging.getLogger("fedd.splitter")
    37         set_log_level(config, "splitter", self.log)
     36        self.log = logging.getLogger("fedd.ns2topdl")
     37        set_log_level(config, "ns2topdl", self.log)
    3838        self.trace_file = sys.stderr
    3939
    40         set_log_level(config, "splitter", self.log)
     40        set_log_level(config, "ns2topdl", self.log)
    4141
    4242        if auth:
     
    4444        else:
    4545            self.auth = authorizer()
    46             self.log.warning("[splitter] No authorizer passed in, " +\
     46            self.log.warning("[ns2topdl] No authorizer passed in, " +\
    4747                    "using local one")
    4848
     
    5050            raise service_error(service_error.internal,
    5151                    "Cannot specify both an access database and allow_any " +\
    52                             "for splitter")
     52                            "for ns2topdl")
    5353       
    5454        if access_db:
    5555            try:
    56                 read_simple_accessdb(access_db, self.auth, 'split')
     56                read_simple_accessdb(access_db, self.auth, 'ns2topdl')
    5757            except IOError, e:
    5858                raise service_error(service_error.internal,
     
    6161                raise service_error(service_error.internal, "%s" % e)
    6262        elif allow_any:
    63             auth.set_global_attribute("split")
     63            auth.set_global_attribute("ns2topdl")
    6464
    6565
    6666        # Dispatch tables
    6767        self.soap_services = {\
    68                 'Ns2Split': soap_handler("Ns2Split", self.run_splitter),
     68                'Ns2Topdl': soap_handler("Ns2Topdl", self.run_ns2topdl),
    6969        }
    7070
    7171        self.xmlrpc_services = {\
    72                 'Ns2Split': xmlrpc_handler('Ns2Split', self.run_splitter),
     72                'Ns2Topdl': xmlrpc_handler('Ns2Topdl', self.run_ns2topdl),
    7373        }
    7474
    75     def run_splitter(self, req, fid):
     75    def run_ns2topdl(self, req, fid):
    7676        """
    77         The external interface to experiment creation called from the
    78         dispatcher.
     77        The external interface to tcl to topdl translation.
    7978
    80         Creates a working directory, splits the incoming description using the
    81         splitter script and parses out the avrious subsections using the
    82         lcasses above.  Once each sub-experiment is created, use pooled threads
    83         to instantiate them and start it all up.
     79        Creates a working directory, translates the incoming description using
     80        the tcl script.
    8481        """
    8582
    86         if not self.auth.check_attribute(fid, 'split'):
     83        if not self.auth.check_attribute(fid, 'ns2topdl'):
    8784            raise service_error(service_error.access, "Access Denied")
    8885
    8986        try:
    90             tmpdir = tempfile.mkdtemp(prefix="split-")
     87            tmpdir = tempfile.mkdtemp(prefix="ns2topdl-")
    9188        except IOError:
    9289            raise service_error(service_error.internal, "Cannot create tmp dir")
     
    9693        gid = "dummy"
    9794        eid = "dummy"
     95        master = "dummy"
    9896
    99         req = req.get('Ns2SplitRequestBody', None)
     97        req = req.get('Ns2TopdlRequestBody', None)
    10098        if not req:
    10199            raise service_error(service_error.req,
    102                     "Bad request format (no Ns2SplitRequestBody)")
     100                    "Bad request format (no Ns2TopdlRequestBody)")
    103101        # The tcl parser needs to read a file so put the content into that file
    104102        descr=req.get('description', None)
     
    119117            raise service_error(service_error.req, "No description")
    120118
    121         master = req.get('master', None)
    122         if master == None:
    123             raise service_error(service_error.req, "No master testbed label")
    124        
    125         include_fedkit = req.get('include_fedkit', None)
    126         if include_fedkit == None:
    127             raise service_error(service_error.req,
    128                     "No federation kit inclusion directive")
    129        
    130119       
    131120        tclcmd = [self.tclsh, self.tcl_splitter, '-t', '-x',
    132121            str(self.muxmax), '-m', master]
    133         if include_fedkit: tclcmd.append('-k')
    134122        tclcmd.extend([pid, gid, eid, tclfile])
    135123        self.log.debug("Calling splitter %s" % " ".join(tclcmd))
Note: See TracChangeset for help on using the changeset viewer.