Ignore:
Timestamp:
Oct 5, 2011 5:11:01 PM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, info-ops, master
Children:
b6a6206
Parents:
53b5c18
git-author:
Ted Faber <faber@…> (10/05/11 17:10:01)
git-committer:
Ted Faber <faber@…> (10/05/11 17:11:01)
Message:

Simple support for experiments in groups. Closes #32

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    r53b5c18 rf3898f7  
    937937        vchars_re = '[^' + string.ascii_letters + string.digits  + '-]'
    938938
     939        self.state_lock.acquire()
     940        if aid in self.allocation:
     941            proj = self.allocation[aid].get('project', None)
     942            if not proj:
     943                proj = self.allocation[aid].get('sproject', None)
     944        self.state_lock.release()
     945
     946        if not proj:
     947            raise service_error(service_error.internal,
     948                    "Can't find project for %s" %aid)
     949
    939950        for a in attrs:
    940951            if a['attribute'] in configs:
     
    954965                ename = a['value']
    955966
    956         # Names longer than the emulab max are discarder
    957         if ename and len(ename) <= self.max_name_len:
     967        # Names longer than the emulab max are discarded
     968        # Projects with a group require nonce experiment names as well
     969        if ename and len(ename) <= self.max_name_len and '/' not in proj:
    958970            # Clean up the experiment name so that emulab will accept it.
    959971            ename = re.sub(vchars_re, '-', ename)
     
    976988        self.state_lock.acquire()
    977989        if aid in self.allocation:
    978             proj = self.allocation[aid].get('project', None)
    979             if not proj:
    980                 proj = self.allocation[aid].get('sproject', None)
    981990            user = self.allocation[aid].get('user', None)
    982991            self.allocation[aid]['experiment'] = ename
     
    9951004            self.write_state()
    9961005        self.state_lock.release()
    997 
    998         if not proj:
    999             raise service_error(service_error.internal,
    1000                     "Can't find project for %s" %aid)
    10011006
    10021007        if not user:
     
    10951100                            certfile, tmpdir)
    10961101
     1102            if '/' in proj: proj, gid = proj.split('/')
     1103            else: gid = None
     1104
     1105
    10971106            # Set up userconf and seer if needed
    10981107            self.configure_userconf(services, tmpdir)
     
    11121121                    debug=self.create_debug, log=alloc_log, boss=self.boss,
    11131122                    cert=self.xmlrpc_cert)
    1114             rv = starter(self, ename, proj, user, expfile, tmpdir)
     1123            rv = starter(self, ename, proj, user, expfile, tmpdir, gid=gid)
    11151124        except service_error, e:
    11161125            err = e
     
    11641173            raise service_error(service_error.internal,
    11651174                    "Can't find project for %s" % aid)
     1175        else:
     1176            if '/' in proj: proj, gid = proj.split('/')
     1177            else: gid = None
    11661178
    11671179        if not user:
     
    11731185        stopper = self.stop_segment(keyfile=self.ssh_privkey_file,
    11741186                debug=self.create_debug, boss=self.boss, cert=self.xmlrpc_cert)
    1175         stopper(self, user, proj, ename)
     1187        stopper(self, user, proj, ename, gid)
    11761188        return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
Note: See TracChangeset for help on using the changeset viewer.