Changeset 9c3e77f for fedd


Ignore:
Timestamp:
Apr 13, 2012 6:08:12 PM (12 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, master
Children:
934dd99
Parents:
66795cf0
Message:

Add information about the project and experiment into the experiment
description

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    r66795cf0 r9c3e77f  
    1111import subprocess
    1212import traceback
     13import socket
    1314
    1415from threading import *
     
    8990        self.portal_startcommand = config.get("access", "portal_startcommand")
    9091        self.node_startcommand = config.get("access", "node_startcommand")
     92
     93        self.uri = 'https://%s:%d' % (socket.getfqdn(),
     94                self.get_port(config.get("globals", "services", "23235")))
    9195
    9296        self.federation_software = self.software_list(self.federation_software)
     
    172176        self.call_SetValue = service_caller('SetValue')
    173177        self.call_GetValue = service_caller('GetValue', log=self.log)
     178
     179    @staticmethod
     180    def get_port(ps):
     181        '''
     182        Take a fedd service string and return the first port.  Used in
     183        creating the testbed uri identifier.
     184        '''
     185        p = ps.split(',')
     186        smallport = p[0].split(':')
     187        try:
     188            rv = int(smallport[0])
     189        except ValueError:
     190            rv = 23235
     191        return rv
    174192
    175193    @staticmethod
     
    818836        the response that may need to be replayed, and return the response.
    819837        """
     838        def get_localnames(t):
     839            names = [ ]
     840            for e in t.elements:
     841                if isinstance(e, topdl.Computer):
     842                    n = e.get_attribute('testbed')
     843                    if n is not None and n not in names:
     844                        names.append(n)
     845            return names
    820846        i = 0
    821847        t = topo.clone()
     
    824850        # sorry)
    825851        self.state_lock.acquire()
     852        # Put information about this testbed into the topdl
     853        tb = topdl.Testbed(self.uri, "deter",
     854                localname=get_localnames(t),
     855                attribute=[
     856                    {
     857                        'attribute': 'project',
     858                        'value': self.allocation[aid]['project']
     859                    },
     860                    {
     861                        'attribute': 'experiment',
     862                        'value': self.allocation[aid]['experiment']
     863                    }])
     864        t.elements.append(tb)
    826865        logv = "".join(self.allocation[aid]['log'])
    827866        # It's possible that the StartSegment call gets retried (!).
Note: See TracChangeset for help on using the changeset viewer.