if q is not None: q.load() for x in q.entries: if x.get_target().name and 'OnTargetFocus' in x.get_target().name: q.clear() logger.info('rts2af_fwhm: cleared queue: {}'.format(args.queue)) break else: proxy=JSONProxy(url=rt.cfg['URL'],username=rt.cfg['RTS2_HTTPD_USERNAME'],password=rt.cfg['PASSWORD']) try: proxy.refresh() except Exception, e: logger.warn('rts2af_fwhm: JSON proxy connection failed: {}, exiting'.format(e)) sys.exit(1) tarType = proxy.getSingleValue('EXEC','current_type') tarName = proxy.getSingleValue('EXEC','current_name') if 'GLORIA teleoperation' in tarName: # reserved observing time logger.info('rts2af_fwhm: there is a ongoing GLORIA teleoperation, no focus run queued') elif 'G' in tarType: # it is a GRB logger.info('rts2af_fwhm: there is now a GRB target selected, no focus run queued') else: q = None rts2.createProxy(url=rt.cfg['URL'], username=rt.cfg['RTS2_HTTPD_USERNAME'], password=rt.cfg['PASSWORD']) try: q = rts2.Queue(rts2.json.getProxy(), args.queue) except Exception, e: logger.error('rts2af_fwhm: no queue named: {0}, doing nothing'.format(args.queue)) if q is not None:
logger.info('rts2af_fwhm: cleared queue: {}'.format( args.queue)) break else: proxy = JSONProxy(url=rt.cfg['URL'], username=rt.cfg['USERNAME'], password=rt.cfg['PASSWORD']) try: proxy.refresh() except Exception, e: logger.warn( 'rts2af_fwhm: JSON proxy connection failed: {}, exiting'. format(e)) sys.exit(1) tarType = proxy.getSingleValue('EXEC', 'current_type') tarName = proxy.getSingleValue('EXEC', 'current_name') if 'GLORIA teleoperation' in tarName: # reserved observing time logger.info( 'rts2af_fwhm: there is a ongoing GLORIA teleoperation, no focus run queued' ) elif 'G' in tarType: # it is a GRB logger.info( 'rts2af_fwhm: there is now a GRB target selected, no focus run queued' ) else: q = None rts2.createProxy(url=rt.cfg['URL'], username=rt.cfg['USERNAME'], password=rt.cfg['PASSWORD'])