示例#1
0
def get_snap_api():
    trace('get_snap_api()',level=-1)
    global SNAP_ALLOWED
    if SNAP_ALLOWED is True:
      try:
          from PyTangoArchiving import snap
          #from PyTangoArchiving.widget.snaps import *
          db = fandango.get_database()
          assert list(db.get_device_exported_for_class('SnapManager'))
          SNAP_ALLOWED = snap.SnapAPI()
          
      except Exception,e:
          trace('PyTangoArchiving.Snaps not available: HISTORY VIEWER DISABLED: '+traceback.format_exc(),'WARNING',-1)
          SNAP_ALLOWED = None
示例#2
0
def prepare_api():
    """Prepare api opbjects"""
    global alarms
    global snap_api
    global api_loc
    with api_loc:
        if alarms is None:
            alarms = alarmapi.api()
        # check if SNAP is available
        if snap_api is None:
            try:
                db = alarmapi._TANGO  # fandango.get_database()
                assert list(db.get_device_exported_for_class('SnapManager'))
                snap_api = snap.SnapAPI()
            except Exception, e:
                logging.warning(
                    'PyTangoArchiving.Snaps not available: '
                    'History synchronization is disabld: \n %s \n' % e.message)
                snap_api = None