Changeset 63a35b7 for fedd/federation


Ignore:
Timestamp:
Nov 3, 2009 11:52:28 AM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-2.00, version-3.01, version-3.02
Children:
1da94bc
Parents:
6409cc5
Message:

Correctly track testbed allocations (slivers or sub experiments). This is
still kludgier than I'd like, but produces the correct operations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    r6409cc5 r63a35b7  
    24192419                if id.has_key('localname'): ids.append(id['localname'])
    24202420
    2421             # Collect the allocation/segment ids
    2422             for fed in fed_exp.get('federant', []):
     2421            # Collect the allocation/segment ids into a dict keyed by the fedid
     2422            # of the allocation (or a monotonically increasing integer) that
     2423            # contains a tuple of uri, aid (which is a dict...)
     2424            for i, fed in enumerate(fed_exp.get('federant', [])):
    24232425                try:
    2424                     tb = fed['uri']
    2425                     aid = fed['allocID']
     2426                    uri = fed['uri']
     2427                    aid = fed['allocID']
     2428                    k = fed['allocID'].get('fedid', i)
    24262429                except KeyError, e:
    24272430                    continue
    2428                 tbparams[tb] = aid
     2431                tbparams[k] = (uri, aid)
    24292432            fed_exp['experimentStatus'] = 'terminating'
    24302433            if self.state_filename: self.write_state()
     
    24362439            if len(tbparams) > 0:
    24372440                thread_pool = self.thread_pool(self.nthreads)
    2438                 for tb in tbparams.keys():
     2441                for k in tbparams.keys():
    24392442                    # Create and start a thread to stop the segment
    24402443                    thread_pool.wait_for_slot()
    2441                     #uri = self.tbmap.get(tb, None)
    2442                     uri = tb
     2444                    uri, aid = tbparams[k]
    24432445                    t  = self.pooled_thread(\
    24442446                            target=self.terminate_segment(log=dealloc_log,
    2445                                 testbed=tb,
     2447                                testbed=uri,
    24462448                                cert_file=self.cert_file,
    24472449                                cert_pwd=self.cert_pwd,
    24482450                                trusted_certs=self.trusted_certs,
    24492451                                caller=self.call_TerminateSegment),
    2450                             args=(uri, tbparams[tb]), name=tb,
     2452                            args=(uri, aid), name=k,
    24512453                            pdata=thread_pool, trace_file=self.trace_file)
    24522454                    t.start()
     
    24582460            # ignore errors releasing those allocations
    24592461            try:
    2460                 for tb in tbparams.keys():
     2462                for k in tbparams.keys():
    24612463                    # This releases access by uri
    2462                     self.release_access(None, tbparams[tb], uri=tb)
     2464                    uri, aid = tbparams[k]
     2465                    self.release_access(None, aid, uri=uri)
    24632466            except service_error, e:
    24642467                if status != 'failed' and not force:
Note: See TracChangeset for help on using the changeset viewer.