Ejemplo n.º 1
0
def get_ms_handle(host=None):
    if not host:
        host = ro.get_myhost()

    # Create a handle to the manager service
    ms = ro.remoteObjectClient(host, ro.managerServicePort)
    
    return ms
Ejemplo n.º 2
0
def main(options, args):

    # Create top level logger.
    logger = ssdlog.make_logger('names', options)

    try:
        myhost = ro.get_myhost()

    except Exception, e:
        raise nameServiceError("Can't get my own hostname: %s" % str(e))
Ejemplo n.º 3
0
    def __init__(self, fv):
        # superclass defines some variables for us, like logger
        super(ANA, self).__init__(fv)

        # Find out what proposal ID we are logged in under
        self.propid = None
        username = pwd.getpwuid(os.getuid()).pw_name
        match = re.match(r'^[uo](\d{5})$', username)
        if match:
            self.propid = 'o' + match.group(1)
        else:
            if os.path.exists(propid_file):
                try:
                    with open(propid_file, 'r') as in_f:
                        self.propid = in_f.read().strip()
                except Exception:
                    pass
        if self.propid is None:
            raise AnaError("Unable to determine prop-id for ANA operation")
        match = re.match(r'^o(\d{5})$', self.propid)
        if not match:
            raise AnaError(
                "PROP-ID ({}) doesn't match expected format (oNNMMM)")

        # find out our hostname
        self.host = ro.get_myhost(short=True)
        self.ro_host = os.environ['GEN2HOST']

        ro.init([self.ro_host])

        # construct our service name
        self.svcname = "ANA-{}-{}".format(self.propid, self.host)

        # for looking up instrument names
        self.insconfig = INSconfig.INSdata()

        self.data_dir = os.path.join('/data', self.propid)

        # make a name and port for our monitor
        mymonname = '{}.mon'.format(self.svcname)
        self.monport = 10000 + int(self.propid[-3:])
        self.port = 9000 + int(self.propid[-3:])
        #self.channels = ['g2task']

        threadPool = self.fv.get_threadPool()

        # Create a local pub sub instance
        self.monitor = Monitor.Monitor(mymonname,
                                       self.logger,
                                       threadPool=threadPool,
                                       ev_quit=self.fv.ev_quit)

        # some of the other plugins expect this handle to be available
        # via fv
        self.fv.controller = self
Ejemplo n.º 4
0
def main(options, args, ui):

    myhost = ro.get_myhost(short=False)

    basename = 'g2disp-%s' % (myhost.replace('.', '_'))
    logger = ssdlog.make_logger(basename, options)

    # Make our callback object
    mobj = g2Disp(logger=logger, basename=basename)

    ui.ui(mobj)
Ejemplo n.º 5
0
def main(options, args):

    # Create top level logger.
    logger = ssdlog.make_logger("mgrsvc", options)

    # Get the names of the nodes in this cluster and remove our name.  The
    # result is the list of hosts running name servers that we need to
    # synchronize with.
    try:
        myhost = ro.get_myhost(short=True)

    except Exception, e:
        raise managerSvcError("Can't get my own hostname: %s" % str(e))