- Timestamp:
- Jun 25, 2010 3:11:30 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 1027cf7
- Parents:
- e11f4e0
- Location:
- fedd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_create.py
re11f4e0 rfd07c48 28 28 type="string", default=[], 29 29 help="Service description name:exporters:importers:attrs") 30 self.add_option("--map", dest="map", action="append", 31 type="string", default=[], 32 help="Explicit map from testbed label to URI - " + \ 33 "deter:https://users.isi.deterlab/net:13232") 30 34 31 35 def parse_service(svc): … … 102 106 for l in lines if service_re.match(l)]) 103 107 108 # Create a testbed map if one is specified 109 tbmap = { } 110 for m in opts.map: 111 i = m.find(":") 112 if i != -1: tbmap[m[0:i]] = m[i+1:] 113 else: sys.exit("Bad mapping argument: %s" %m ) 114 115 104 116 if not svcs: 105 117 print >>sys.stderr, "Warning:Neither master/project nor services requested" … … 147 159 sys.exit("New did not return an experiment ID??") 148 160 161 if tbmap: 162 msg['testbedmap'] = [ { 'testbed': t, 'uri': u } for t, u in tbmap.items() ] 163 149 164 if opts.debug > 1: print >>sys.stderr, msg 150 165 -
fedd/federation/experiment_control.py
re11f4e0 rfd07c48 815 815 else: return None 816 816 817 def get_access(self, tb, nodes, tbparam, access_user, masters ):817 def get_access(self, tb, nodes, tbparam, access_user, masters, tbmap): 818 818 """ 819 819 Get access to testbed through fedd and set the parameters for that tb … … 835 835 "More than one project export is not supported") 836 836 837 uri = self.tbmap.get(testbed_base(tb), None)837 uri = tbmap.get(testbed_base(tb), None) 838 838 if not uri: 839 839 raise service_error(service_error.server_config, … … 971 971 self.log.error("Bad attribute in response: %s" % a) 972 972 973 def release_access(self, tb, aid, uri=None):973 def release_access(self, tb, aid, tbmap=None, uri=None): 974 974 """ 975 975 Release access to testbed through fedd 976 976 """ 977 977 978 if not uri :979 uri = self.tbmap.get(tb, None)978 if not uri and tbmap: 979 uri = tbmap.get(tb, None) 980 980 if not uri: 981 981 raise service_error(service_error.server_config, … … 1115 1115 def allocate_resources(self, allocated, masters, eid, expid, 1116 1116 tbparams, top, topo, tmpdir, alloc_log=None, log_collector=None, 1117 attrs=None, connInfo={} ):1117 attrs=None, connInfo={}, tbmap=None): 1118 1118 1119 1119 started = { } # Testbeds where a sub-experiment started … … 1122 1122 # XXX 1123 1123 fail_soft = False 1124 1125 if tbmap is None: tbmap = { } 1124 1126 1125 1127 log = alloc_log or self.log … … 1134 1136 tb_attrs = copy.copy(attrs) 1135 1137 thread_pool.wait_for_slot() 1136 uri = tbparams[tb].get('uri', \ 1137 self.tbmap.get(testbed_base(tb), None)) 1138 uri = tbparams[tb].get('uri', tbmap.get(testbed_base(tb), None)) 1138 1139 base, suffix = split_testbed(tb) 1139 1140 if suffix: … … 1214 1215 # release the allocations 1215 1216 for tb in tbparams.keys(): 1216 self.release_access(tb, tbparams[tb]['allocID'], 1217 tb params[tb].get('uri', None))1217 self.release_access(tb, tbparams[tb]['allocID'], 1218 tbmap=tbmap, uri=tbparams[tb].get('uri', None)) 1218 1219 # Remove the placeholder 1219 1220 self.state_lock.acquire() … … 1406 1407 1407 1408 def get_access_to_testbeds(self, testbeds, access_user, allocated, 1408 tbparams, masters ):1409 tbparams, masters, tbmap): 1409 1410 """ 1410 1411 Request access to the various testbeds required for this instantiation … … 1414 1415 """ 1415 1416 for tb in testbeds: 1416 self.get_access(tb, None, tbparams, access_user, masters )1417 self.get_access(tb, None, tbparams, access_user, masters, tbmap) 1417 1418 allocated[tb] = 1 1418 1419 … … 1610 1611 self.check_experiment_access(fid, key) 1611 1612 1613 # Install the testbed map entries supplied with the request into a copy 1614 # of the testbed map. 1615 tbmap = dict(self.tbmap) 1616 for m in req.get('testbedmap', []): 1617 if 'testbed' in m and 'uri' in m: 1618 tbmap[m['testbed']] = m['uri'] 1619 1612 1620 try: 1613 1621 tmpdir = tempfile.mkdtemp(prefix="split-") … … 1755 1763 1756 1764 self.get_access_to_testbeds(testbeds, access_user, allocated, 1757 tbparams, masters )1765 tbparams, masters, tbmap) 1758 1766 1759 1767 self.split_topology(top, topo, testbeds) … … 1791 1799 self.auth.set_attribute(asignee, "%s/%s" % (configpath, f)) 1792 1800 1793 part = experiment_partition(self.auth, self.store_url, self.tbmap,1801 part = experiment_partition(self.auth, self.store_url, tbmap, 1794 1802 self.muxmax, self.direct_transit) 1795 1803 part.add_portals(top, topo, eid, pmasters, tbparams, ip_allocator, … … 1893 1901 args=(allocated, masters, eid, expid, tbparams, 1894 1902 top, topo, tmpdir, alloc_log, alloc_collector, attrs, 1895 connInfo ),1903 connInfo, tbmap), 1896 1904 name=eid) 1897 1905 t.start()
Note: See TracChangeset
for help on using the changeset viewer.