Changeset ca489e8 for fedd


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.

Location:
fedd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd_client.py

    r65f3f29 rca489e8  
    157157                help="data to extract")
    158158
     159class fedd_terminate_opts(fedd_exp_data_opts):
     160    def __init__(self):
     161        fedd_exp_data_opts.__init__(self)
     162        self.add_option("--force", dest="force",
     163                action="store_true", default=False,
     164                help="Force termination if experiment is in strange state")
     165
    159166class fedd_multi_exp_data_opts(fedd_client_opts):
    160167    def __init__(self):
     
    10241031        """
    10251032        # Process the options using the customized option parser defined above
    1026         parser = fedd_exp_data_opts()
     1033        parser = fedd_terminate_opts()
    10271034
    10281035        (opts, args) = parser.parse_args()
     
    10611068                    "--experiment_name");
    10621069
    1063         req = { 'experiment': exp_id }
     1070        req = { 'experiment': exp_id, 'force': opts.force }
    10641071
    10651072        try:
  • 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
  • fedd/wsdl/fedd_types.xsd

    r65f3f29 rca489e8  
    595595    <xsd:sequence>
    596596      <xsd:element name="experiment" type="tns:IDType"/>
     597      <xsd:element name="force" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
    597598    </xsd:sequence>
    598599  </xsd:complexType>
Note: See TracChangeset for help on using the changeset viewer.