예제 #1
0
def dump_h5(filename, server, port=11211):
    client = pymemcache.client.Client((server, port))
    stats = client.stats("slabs")
    slab_index = set(int(k.split(b":")[0]) for k in stats if b":" in k)
    print(slab_index)
    with h5py.File(filename, "w") as h5:
        entry = h5.require_group(get_isotime())
        for idx in slab_index:
            keys = stats.get(b"%i:cmd_set" % idx, 0)
            print("Slab #%s: %s keys" % (idx, keys))
            if keys:
                for key in client.stats("cachedump", str(idx), str(keys)):
                    ukey = key.decode()
                    print("    " + ukey)
                    entry[ukey] = numpy.frombuffer(client.get(key),
                                                   dtype="uint8")
예제 #2
0
파일: test_io.py 프로젝트: silx-kit/pyFAI
 def test_from(self):
     t0 = time.perf_counter()
     isotime = io.get_isotime(t0)
     self.assertTrue(
         abs(t0 - io.from_isotime(isotime)) < 1,
         "timing are precise to the second")
예제 #3
0
파일: test_io.py 프로젝트: silx-kit/pyFAI
 def test_get(self):
     self.assertTrue(len(io.get_isotime()), 25)
예제 #4
0
파일: test_io.py 프로젝트: vallsv/pyFAI
 def test_from(self):
     t0 = time.time()
     isotime = io.get_isotime(t0)
     self.assertTrue(abs(t0 - io.from_isotime(isotime)) < 1, "timing are precise to the second")
예제 #5
0
파일: test_io.py 프로젝트: vallsv/pyFAI
 def test_get(self):
     self.assertTrue(len(io.get_isotime()), 25)
예제 #6
0
파일: test_io.py 프로젝트: dkarkoulis/pyFAI
 def test_from(self):
     t0 = time.time()
     isotime = io.get_isotime(t0)
     self.assert_(
         abs(t0 - io.from_isotime(isotime)) < 1,
         "timing are precise to the second")