示例#1
0
def main(argv=None):
    start_time = time.time()

    if argv is None:
        argv = sys.argv
    argv = list(argv)

    try:
        argv.remove('-n')
        new_server = True
    except ValueError:
        new_server = False

    try:
        # initialize logging as soon as possible
        initialize_logging(argv)

        # if querying list of instances, just return
        if len(argv) < 2 or argv[1] == '-?':
            util = tango.Util(argv)
            # no need since tango exits the process when it finds '-?'
            # (tango is not actually a library :-)
            return

        axes, axes_classes = __recreate(new_server=new_server)
        del axes

        util = tango.Util(argv)
        db = util.get_database()

    except tango.DevFailed:
        print traceback.format_exc()
        elog.exception("Error in server initialization")
        sys.exit(0)

    klasses = [BlissAxisManager] + axes_classes

    dt = time.time() - start_time
    elog.info('server configured (took %6.3fs)' % dt)

    from tango import GreenMode
    from tango.server import run
    run(klasses, green_mode=GreenMode.Gevent)
示例#2
0
def main():
    try:
        py = tango.Util(sys.argv)
        py.add_TgClass(NanodacClass, Nanodac, 'Nanodac')
        U = tango.Util.instance()
        U.server_init()
        U.server_run()
    except:
        import traceback
        traceback.print_exc()
示例#3
0
def main(*args, **kwargs):
    try:
        tango_util = tango.Util(sys.argv)
        if tango.Release.version_number <= 711:
            tango_util.add_TgClass(BCMRFEClass, BCMRFE, 'BCMRFE')
        else:
            tango_util.add_class(BCMRFEClass, BCMRFE)
        util_instance = tango.Util.instance()
        util_instance.server_init()
        util_instance.server_run()
    except tango.DevFailed as e:
        print('-------> Received a DevFailed exception:', str(e))
    except Exception as e:
        print('-------> An unforeseen exception occurred....', str(e))
示例#4
0
 def tango_util(self):
     if self.__util is None:
         import tango
         self.__util = tango.Util(self.__build_args())
         self._phase = Server.Phase1
     return self.__util