Changeset 2627eb3 for fedd


Ignore:
Timestamp:
Dec 12, 2010 9:51:41 AM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
e83f2f2
Parents:
9973d57
Message:

Fail if software not available before allocations are made.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    r9973d57 r2627eb3  
    13751375            topo[tb].make_indices()
    13761376
     1377    def confirm_software(self, top):
     1378        """
     1379        Make sure that the software to be loaded in the topo is all available
     1380        before we begin making access requests, etc.  This is a subset of
     1381        wrangle_software.
     1382        """
     1383        pkgs = set([ d for i, d in self.fedkit + self.gatewaykit ])
     1384        pkgs.update([x.location for e in top.elements for x in e.software])
     1385
     1386        for pkg in pkgs:
     1387            loc = pkg
     1388
     1389            scheme, host, path = urlparse(loc)[0:3]
     1390            dest = os.path.basename(path)
     1391            if not scheme:
     1392                if not loc.startswith('/'):
     1393                    loc = "/%s" % loc
     1394                loc = "file://%s" %loc
     1395            # NB: if scheme was found, loc == pkg
     1396            try:
     1397                u = urlopen(loc)
     1398                u.close()
     1399            except Exception, e:
     1400                raise service_error(service_error.req,
     1401                        "Cannot open %s: %s" % (loc, e))
     1402        return True
     1403
    13771404    def wrangle_software(self, expid, top, topo, tbparams):
    13781405        """
     
    13871414        softdir ="%s/%s" % ( self.repodir, linkpath)
    13881415        softmap = { }
    1389         # These are in a list of tuples format (each kit).  This comprehension
    1390         # unwraps them into a single list of tuples that initilaizes the set of
    1391         # tuples.
    1392         pkgs = set([ t for l in [self.fedkit, self.gatewaykit] \
    1393                 for p, t in l ])
    1394         pkgs.update([x.location for e in top.elements \
    1395                 for x in e.software])
     1416
     1417        # self.fedkit and self.gateway kit are lists of tuples of
     1418        # (install_location, download_location) this extracts the download
     1419        # locations.
     1420        pkgs = set([ d for i, d in self.fedkit + self.gatewaykit ])
     1421        pkgs.update([x.location for e in top.elements for x in e.software])
    13961422        try:
    13971423            os.makedirs(softdir)
     
    14101436                    loc = "/%s" % loc
    14111437                loc = "file://%s" %loc
     1438            # NB: if scheme was found, loc == pkg
    14121439            try:
    14131440                u = urlopen(loc)
     
    19461973
    19471974            top = self.get_topology(req, tmpdir)
     1975            self.confirm_software(top)
    19481976            # Assign the IPs
    19491977            hosts, ip_allocator = self.allocate_ips_to_topo(top)
     
    19641992            connInfo = { }          # Connection information
    19651993
     1994            self.split_topology(top, topo, testbeds)
     1995
    19661996            self.get_access_to_testbeds(testbeds, fid, allocated,
    19671997                    tbparams, masters, tbmap, expid, expcert_file)
    1968 
    1969             self.split_topology(top, topo, testbeds)
    19701998
    19711999            attrs = self.generate_keys_and_hosts(tmpdir, expid, hosts, tbparams)
Note: See TracChangeset for help on using the changeset viewer.