예제 #1
0
 def release(self):
     output('++ Destructing DIC info service[%d]: %s\n' % (
         self.svcID,
         self.service,
     ))
     pydim.dic_release_service(self.svcID)
     self.svcID = None
예제 #2
0
def main():
  #if not pydim.dis_get_dns_node():
  #  print "Please set the environment variable DIM_DNS_NODE (aldaqecs)"
  #  #sys.exit(1)
  #res= pydim.dic_cmnd_service("TTCMI/MICLOCK_SET", arg, "C")
  if len(sys.argv)>1:
    shift= getShift(sys.argv[1])
    print shift
    return
  while True:
    a= raw_input("get, q to quit:")
    if a=='q': break
    if a=='g' or a=='get':
      sid=8
      if os.getenv("HOSTNAME")[:6] != "alidcs":
        print "not in the pit"
        continue
      pydim.dic_set_dns_node("alidcsdimdns.cern.ch")
      #os.environ['DIM_DNS_NODE']="alidcsdimdns"
      print "dns: alidcsdimdns"
      sid= pydim.dic_info_service("PHASE_SHIFT_BPTX1", "F:1", 
        callback1, service_type=pydim.ONCE_ONLY)
      #cshift= pydim.dic_sync_info_service("PHASE_SHIFT_BPTX1", "F:1")
      #print "cshift:",cshift
      if not sid:
        print "Error registering with info_service"
        break
      sid2= pydim.dic_info_service("TIMESTAMP_PHASE_SHIFT_BPTX1", "I:1", 
        callback1, service_type=pydim.ONCE_ONLY)
      if not sid2:
        print "Error registering with TIMESTAMP info_service"
        break
      time.sleep(1); 
      pydim.dic_release_service(sid)
      pydim.dic_release_service(sid2)
예제 #3
0
def main():
  ddnode= pydim.dis_get_dns_node()
  print "DIM_DNS_NODE:", ddnode
  if not ddnode:
    print "Please set the environment variable DIM_DNS_NODE (aldaqecs)"
    sys.exit(1)
  #sid = pydim.dic_info_service("PHASE_SHIFT_BPTX1", "F", callback1)
  try:
    #sid = pydim.dic_info_service("PHASE_SHIFT_BPTX1", "F", callback1)
    sid = pydim.dic_info_service("TTCMI/SHIFT", "C", callbackC,
      service_type=pydim.ONCE_ONLY)
    sid = pydim.dic_info_service("TTCMI/MICLOCK", "C", callback2,
      service_type=pydim.ONCE_ONLY)
  except:
    print "sys.exc_info:",sys.exc_info()[0]
    sid=None
  if not sid:
    print "Error registering with info_services"
    sys.exit(1)
  print "sid:",sid
  #res= pydim.dic_cmnd_service("TTCMI/MICLOCK_SET", arg, "C")
  while True:
    a= raw_input("q to quit:")
    if a=='q': break
  pydim.dic_release_service(sid)
예제 #4
0
def main():
  #if not pydim.dis_get_dns_node():
  #  print "Please set the environment variable DIM_DNS_NODE (aldaqecs)"
  #  #sys.exit(1)
  #res= pydim.dic_cmnd_service("TTCMI/MICLOCK_SET", arg, "C")
  if len(sys.argv)>1:
    shift= getShift()
    print shift
    return
  print """
 trying pydim.dic_info_service_stamped() -unsuccessfully
  """
  while True:
    a= raw_input("get, q to quit:")
    if a=='q': break
    if a=='g' or a=='get':
      sid=8
      pydim.dic_set_dns_node("alidcsdimdns.cern.ch")
      #os.environ['DIM_DNS_NODE']="alidcsdimdns"
      print "dns: alidcsdimdns"
      #sid= pydim.dic_info_service("PHASE_SHIFT_BPTX1", "F:1", callback1, service_type=pydim.ONCE_ONLY)
      sid= pydim.dic_info_service_stamped("PHASE_SHIFT_BPTX1", "F:1", 
        callback2) #, pydim.ONCE_ONLY)
      #cshift= pydim.dic_sync_info_service("PHASE_SHIFT_BPTX1", "F:1")
      #print "cshift:",cshift
      if not sid:
        print "Error registering with info_service"
        break
      #timestamp= pydim.dic_get_timestamp(sid)   #, secs, msecs)
      #print "timestamp:",timestamp, type(timestamp)
      time.sleep(2); pydim.dic_release_service(sid)
예제 #5
0
 def finalize(self):
     if self.state() != State.READY:
         return
     # Send reset to all moore tasks and wait for them to finalize.
     self.__send_command(self.utgid(), "reset")
     self.set_state(State.NOT_READY)
     # Disconnect from DIM services
     for svc in self.__dim_svc:
         pydim.dic_release_service(svc)
         self.__dim_svc = []
예제 #6
0
DEBUG=6    
def stress_callback( *args):
    global i
    if i % 10000 == 0:        
       print "stress_callback: %d" % i
    i += 1

def service_callback(tag):
    global i
    if i % 10000 == 0:
        print "stress service updated: %d" % i
    return (i,)    
      
if __name__=='__main__':
    import sys
    n = 500000
    if len(sys.argv) > 1: n = int(sys.argv[1])
    si = dic_info_service("STRESS_SVC", "I", stress_callback)
    s = dis_add_service("PYSTRESS_SVC", "I", service_callback, 0)
    dis_start_serving("PYSTRESS") 
    while i < n or n == 0:
        res = dic_cmnd_service('STRESS_CMD', ('STRESSYOU!\0',), "C")
        dis_update_service(s)
        sleep(0.001)
    print "Stopping stress serving"
    dis_stop_serving()
    print "Stopping subscription"
    dic_release_service(si)
    print "Waiting for cleanup"
    sleep(5)
예제 #7
0
파일: dimBurst.py 프로젝트: nlurkin/Other
	def stop(self):
		pydim.dic_release_service(self.SOB)
		pydim.dic_release_service(self.EOB)