Beispiel #1
0
           inq.empty(),
           inq.qsize(),
           inq.full(),
           strftime("%Y-%m-%d %H:%M:%S"),
           sum([reader.is_alive() for reader in readers]),
           "q.size():",
           q.qsize(),
           file=sys.stderr,
           sep="\t")
     sys.stderr.flush()
     sys.stdout.flush()
 except Exception as e:
     print(e, file=sys.stderr)
     if args.top:
         print("queue get timed out",
               [reader.cpu_percent() for reader in reader_procs],
               [worker.cpu_percent() for worker in worker_procs])
     #print("#timed out",inq.empty())
     print("#read from queue timed out:",
           inq.empty(),
           inq.qsize(),
           inq.full(),
           strftime("%Y-%m-%d %H:%M:%S"),
           sum([reader.is_alive() for reader in readers]),
           file=sys.stderr,
           sep="\t")
     sys.stderr.flush()
     continue
 if args.debug: print("got")
 if not scaffold in pair_buffer:
     pair_buffer[scaffold] = []
     pair_buffer={}
     scaffold_count={}
#     while (not inq.empty()) or sum( [reader.is_alive() for reader in readers] )>0:
     while True:
          if args.debug: print("get")
          try:
               procid,scaffold,pairs = inq.get()
#               procid,scaffold,pairs = inq.get(True,10)
               #print("#got data:",procid,scaffold,len(pairs))
               print("#got data from inq:",procid,scaffold,len(pairs),inq.empty(),inq.qsize(),inq.full(),strftime("%Y-%m-%d %H:%M:%S"),sum( [reader.is_alive() for reader in readers] ),"q.size():",q.qsize(),file=sys.stderr,sep="\t")
               sys.stderr.flush()
               sys.stdout.flush()
          except Exception as e:
               print(e,file=sys.stderr)
               if args.top:
                    print("queue get timed out",[reader.cpu_percent() for reader in reader_procs],[worker.cpu_percent() for worker in worker_procs])
               #print("#timed out",inq.empty())
               print("#read from queue timed out:",inq.empty(),inq.qsize(),inq.full(),strftime("%Y-%m-%d %H:%M:%S"),sum( [reader.is_alive() for reader in readers] ),file=sys.stderr,sep="\t")
               sys.stderr.flush()
               continue
          if args.debug: print("got")
          if not scaffold in pair_buffer:
               pair_buffer[scaffold]=[]
          pair_buffer[scaffold] += pairs
          scaffold_count[scaffold] = scaffold_count.get(scaffold,0)+1
#          print("#:",scaffold,scaffold_count[scaffold])
          if scaffold=="DONE": 
               print("#seen DONE {} times.".format(scaffold_count.get(scaffold,0)),strftime("%Y-%m-%d %H:%M:%S"),file=sys.stderr,sep="\t")
               if scaffold_count[scaffold] == nbams:
                    print("#done. calling task_done:",strftime("%Y-%m-%d %H:%M:%S"),file=sys.stderr,sep="\t")
                    sys.stderr.flush()