Changeset ca489e8 for fedd/federation


Ignore:
Timestamp:
Jul 27, 2009 9:41:25 AM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
8f32dc0
Parents:
65f3f29
Message:

Add override fedids that can access all experiments. These are admins,
basically.

Also add a force parameter to terminate requests, to force the termination (and
really deletion of internal state) for experiments in odd states or with
internal misconfigurations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    r65f3f29 rca489e8  
    252252        # NB for internal master/slave ops, not experiment setup
    253253        self.ssh_type = config.get("experiment_control", "sshkeytype", "rsa")
     254
     255        self.overrides = set([])
     256        ovr = config.get('experiment_control', 'overrides')
     257        if ovr:
     258            for o in ovr.split(","):
     259                o = o.strip()
     260                if o.startswith('fedid:'): o = o[len('fedid:'):]
     261                self.overrides.add(fedid(hexstr=o))
     262
    254263        self.state = { }
    255264        self.state_lock = Lock()
     
    408417                            if f.has_key('fedid') ]:
    409418                    self.auth.set_attribute(self.state[k]['owner'], eid)
     419                    # allow overrides to control experiments as well
     420                    for o in self.overrides:
     421                        self.auth.set_attribute(o, eid)
    410422            except KeyError, e:
    411423                self.log.warning("[read_state]: State ownership or identity " +\
     
    20092021        self.auth.set_attribute(fid, expid)
    20102022        self.auth.set_attribute(expid, expid)
     2023        # Override fedids can manipulate state as well
     2024        for o in self.overrides:
     2025            self.auth.set_attribute(o, expid)
    20112026
    20122027        # Create a logger that logs to the experiment's state object as well as
     
    22702285            raise service_error(service_error.req,
    22712286                    "Bad request format (no TerminateRequestBody)")
     2287        force = req.get('force', False)
    22722288        exp = req.get('experiment', None)
    22732289        if exp:
     
    22982314            if status:
    22992315                if status == 'starting':
    2300                     self.state_lock.release()
    2301                     raise service_error(service_error.partial,
    2302                             'Experiment still being created')
     2316                    if not force:
     2317                        self.state_lock.release()
     2318                        raise service_error(service_error.partial,
     2319                                'Experiment still being created')
     2320                    else:
     2321                        self.log.warning('Experiment in starting state ' + \
     2322                                'being terminated by admin.')
    23032323            else:
    23042324                # No status??? trouble
     
    23612381
    23622382            # release the allocations (failed experiments have done this
    2363             # already)
    2364             if status != 'failed':
     2383            # already, and starting experiments may be in odd states, so we
     2384            # ignore errors releasing those allocations
     2385            try:
    23652386                for tb in tbparams.keys():
    23662387                    self.release_access(tb, tbparams[tb]['aid'])
     2388            except service_error, e:
     2389                if status != 'failed' and not force:
     2390                    raise e
    23672391
    23682392            # Remove the terminated experiment
Note: See TracChangeset for help on using the changeset viewer.