server.py 1001 Bytes
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1 2
# (C) 2018 The University of Chicago
# See COPYRIGHT in top-level directory.
Matthieu Dorier's avatar
Matthieu Dorier committed
3 4 5 6 7 8
from pymargo import MargoInstance
import pybake
import pybake.server
from pybake.server import BakeProvider

mid = MargoInstance('tcp')
Matthieu Dorier's avatar
Matthieu Dorier committed
9
mid.enable_remote_shutdown()
Matthieu Dorier's avatar
Matthieu Dorier committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
mplex_id = 42
print "Server running at address "+str(mid.addr())+"with mplex_id="+str(mplex_id)

provider = BakeProvider(mid, mplex_id)
target   = provider.add_storage_target("/dev/shm/baketarget")
print "target id is "+str(target)
print "number of targets: "+str(provider.count_storage_targets())

pybake.server.make_pool("/dev/shm/baketarget2", 2*8388608, 0664)
target = provider.add_storage_target("/dev/shm/baketarget2")
print "target id is "+str(target)
print "number of targets: "+str(provider.count_storage_targets())

print "storage targets: "
targets = provider.list_storage_targets()
for t in targets:
  print str(t)

28 29
#provider.remove_all_storage_targets()
#print "number of targets: "+str(provider.count_storage_targets())
Matthieu Dorier's avatar
Matthieu Dorier committed
30 31

mid.wait_for_finalize()