Commit 0a78cd22 authored by Matthieu Dorier's avatar Matthieu Dorier

this should make py-bake compile with intel compiler

parent 39fd738b
...@@ -6,26 +6,30 @@ import pymargo ...@@ -6,26 +6,30 @@ import pymargo
from pybake.target import BakeTargetID from pybake.target import BakeTargetID
def make_pool(name, size, mode): def make_pool(name, size, mode):
_pybakeserver.make_pool(name, size, mode) _pybakeserver.make_pool(name, size, mode)
class BakeProvider(pymargo.Provider): class BakeProvider(pymargo.Provider):
def __init__(self, mid, provider_id): def __init__(self, mid, provider_id):
super(BakeProvider, self).__init__(mid, provider_id) super(BakeProvider, self).__init__(mid, provider_id)
self._provider = _pybakeserver.register(mid._mid, provider_id) self._provider = _pybakeserver.register(mid._mid, provider_id)
def add_storage_target(self, name): def add_storage_target(self, name):
tid = _pybakeserver.add_storage_target(self._provider, name) tid = _pybakeserver.add_storage_target(self._provider, name)
return BakeTargetID(tid) return BakeTargetID(tid)
def remove_storage_target(self, target): def remove_storage_target(self, target):
return _pybakeserver.remove_storage_target(self._provider, target._tid) return _pybakeserver.remove_storage_target(self._provider, target._tid)
def remove_all_storage_targets(self): def remove_all_storage_targets(self):
return _pybakeserver.remove_all_storage_targets(self._provider) return _pybakeserver.remove_all_storage_targets(self._provider)
def count_storage_targets(self): def count_storage_targets(self):
return _pybakeserver.count_storage_targets(self._provider) return _pybakeserver.count_storage_targets(self._provider)
def list_storage_targets(self): def list_storage_targets(self):
return _pybakeserver.list_storage_targets(self._provider) l = _pybakeserver.list_storage_targets(self._provider)
if(l is None):
return []
else:
return [ BakeTargetID(tid) for tid in l ]
...@@ -47,10 +47,14 @@ static py11::object pybake_region_id_from_string(const py11::bytes& bregion_str) ...@@ -47,10 +47,14 @@ static py11::object pybake_region_id_from_string(const py11::bytes& bregion_str)
PYBIND11_MODULE(_pybaketarget, m) PYBIND11_MODULE(_pybaketarget, m)
{ {
py11::class_<bake_target_id_t>(m,"bake_target_id") py11::class_<bake_target_id_t>(m,"bake_target_id");
.def("__str__", pybake_target_id_to_string); // now done at Python level
// .def("__str__", pybake_target_id_to_string);
m.def("target_id_to_string", pybake_target_id_to_string);
m.def("target_id_from_string", pybake_target_id_from_string); m.def("target_id_from_string", pybake_target_id_from_string);
py11::class_<bake_region_id_t>(m,"bake_region_id") py11::class_<bake_region_id_t>(m,"bake_region_id");
.def("__str__", pybake_region_id_to_string); // now done at Python level
m.def("region_id_from_string", pybake_region_id_from_string); // .def("__str__", pybake_region_id_to_string);
m.def("region_id_from_string", pybake_region_id_from_string);
m.def("region_id_to_string", pybake_region_id_to_string);
} }
...@@ -22,7 +22,9 @@ class BakeTargetID(): ...@@ -22,7 +22,9 @@ class BakeTargetID():
""" """
Converts the BakeTargetID into a string. Converts the BakeTargetID into a string.
""" """
return str(self._tid) if(self._tid is None):
return str(None)
return _pybaketarget.target_id_to_string(self._tid)
@staticmethod @staticmethod
def from_str(string): def from_str(string):
...@@ -58,7 +60,10 @@ class BakeRegionID(): ...@@ -58,7 +60,10 @@ class BakeRegionID():
""" """
Converts the BakeRegionID into a string. Converts the BakeRegionID into a string.
""" """
return base64.b64encode(str(self._rid)) if(self._rid is None):
return str(None)
a = _pybaketarget.region_id_to_string(self._rid)
return base64.b64encode(a)
@staticmethod @staticmethod
def from_str(string): def from_str(string):
......
# (C) 2018 The University of Chicago # (C) 2018 The University of Chicago
# See COPYRIGHT in top-level directory. # See COPYRIGHT in top-level directory.
import sys import sys
sys.path.append('.')
sys.path.append('build/lib.linux-x86_64-2.7')
from pymargo import MargoInstance from pymargo import MargoInstance
from pybake.target import BakeRegionID from pybake.target import BakeRegionID
from pybake.client import * from pybake.client import *
......
# (C) 2018 The University of Chicago # (C) 2018 The University of Chicago
# See COPYRIGHT in top-level directory. # See COPYRIGHT in top-level directory.
import sys
sys.path.append('.')
sys.path.append('build/lib.linux-x86_64-2.7')
from pymargo import MargoInstance from pymargo import MargoInstance
import pybake import pybake
import pybake.server import pybake.server
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment