Changeset a3ad8bd for fedd/federation
- Timestamp:
- Dec 4, 2009 2:21:11 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- c17efe6
- Parents:
- 4ac0a41
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/experiment_control.py
r4ac0a41 ra3ad8bd 332 332 # Dispatch tables 333 333 self.soap_services = {\ 334 'New': soap_handler('New', self.new_experiment), 334 335 'Create': soap_handler('Create', self.create_experiment), 335 336 'Vtopo': soap_handler('Vtopo', self.get_vtopo), … … 342 343 343 344 self.xmlrpc_services = {\ 345 'New': xmlrpc_handler('New', self.new_experiment), 344 346 'Create': xmlrpc_handler('Create', self.create_experiment), 345 347 'Vtopo': xmlrpc_handler('Vtopo', self.get_vtopo), … … 498 500 for fid in self.accessdb.keys(): 499 501 self.auth.set_attribute(fid, 'create') 502 self.auth.set_attribute(fid, 'new') 500 503 501 504 def read_mapdb(self, file): … … 868 871 } 869 872 870 871 873 def release_access(self, tb, aid, uri=None): 872 874 """ … … 1214 1216 1215 1217 1216 def create_experiment_state(self, fid, req, expid, expcert): 1218 def create_experiment_state(self, fid, req, expid, expcert, 1219 state='starting'): 1217 1220 """ 1218 1221 Create the initial entry in the experiment's state. The expid and … … 1221 1224 includes a suggested local name that is used if possible. If the local 1222 1225 name is already taken by an experiment owned by this user that has 1223 failed, it is overwri utten. Otherwise new letters are added until a1226 failed, it is overwritten. Otherwise new letters are added until a 1224 1227 valid localname is found. The generated local name is returned. 1225 1228 """ … … 1250 1253 'experimentID' : \ 1251 1254 [ { 'localname' : eid }, {'fedid': expid } ], 1252 'experimentStatus': 'starting',1255 'experimentStatus': state, 1253 1256 'experimentAccess': { 'X509' : expcert }, 1254 1257 'owner': fid, … … 1271 1274 'experimentID' : \ 1272 1275 [ { 'localname' : eid }, {'fedid': expid } ], 1273 'experimentStatus': 'starting',1276 'experimentStatus': state, 1274 1277 'experimentAccess': { 'X509' : expcert }, 1275 1278 'owner': fid, … … 1858 1861 1859 1862 1863 def new_experiment(self, req, fid): 1864 """ 1865 The external interface to empty initial experiment creation called from 1866 the dispatcher. 1867 1868 Creates a working directory, splits the incoming description using the 1869 splitter script and parses out the avrious subsections using the 1870 lcasses above. Once each sub-experiment is created, use pooled threads 1871 to instantiate them and start it all up. 1872 """ 1873 if not self.auth.check_attribute(fid, 'new'): 1874 raise service_error(service_error.access, "New access denied") 1875 1876 try: 1877 tmpdir = tempfile.mkdtemp(prefix="split-") 1878 except IOError: 1879 raise service_error(service_error.internal, "Cannot create tmp dir") 1880 1881 try: 1882 access_user = self.accessdb[fid] 1883 except KeyError: 1884 raise service_error(service_error.internal, 1885 "Access map and authorizer out of sync in " + \ 1886 "create_experiment for fedid %s" % fid) 1887 1888 pid = "dummy" 1889 gid = "dummy" 1890 1891 req = req.get('NewRequestBody', None) 1892 if not req: 1893 raise service_error(service_error.req, 1894 "Bad request format (no NewRequestBody)") 1895 1896 # Generate an ID for the experiment (slice) and a certificate that the 1897 # allocator can use to prove they own it. We'll ship it back through 1898 # the encrypted connection. 1899 (expid, expcert) = generate_fedid("test", dir=tmpdir, log=self.log) 1900 1901 #now we're done with the tmpdir, and it should be empty 1902 if self.cleanup: 1903 self.log.debug("[new_experiment]: removing %s" % tmpdir) 1904 os.rmdir(tmpdir) 1905 else: 1906 self.log.debug("[new_experiment]: not removing %s" % tmpdir) 1907 1908 eid = self.create_experiment_state(fid, req, expid, expcert, 1909 state='empty') 1910 1911 # Let users touch the state 1912 self.auth.set_attribute(fid, expid) 1913 self.auth.set_attribute(expid, expid) 1914 # Override fedids can manipulate state as well 1915 for o in self.overrides: 1916 self.auth.set_attribute(o, expid) 1917 1918 rv = { 1919 'experimentID': [ 1920 {'localname' : eid }, { 'fedid': copy.copy(expid) } 1921 ], 1922 'experimentStatus': 'empty', 1923 'experimentAccess': { 'X509' : expcert } 1924 } 1925 1926 return rv 1927 1928 1860 1929 def create_experiment(self, req, fid): 1861 1930 """
Note: See TracChangeset
for help on using the changeset viewer.