Beispiel #1
0
 def test_with_data(self):
   """Translate to and from json_object"""
   j = Jobj(json_str)
   self.assertEqual(
       j.as_str(),
       json_str
       )
Beispiel #2
0
    def from_event(cls, flux_handle, json_str):
        if isinstance(flux_handle, core.Flux):
            flux_handle = flux_handle.handle

        j = Jobj(json_str)
        return cls(
            flux_handle,
            handle=lib.flux_mrpc_create_fromevent(
                flux_handle, j.get(), ), )
Beispiel #3
0
    def from_event(cls, flux_handle, json_str):
        if isinstance(flux_handle, core.Flux):
            flux_handle = flux_handle.handle

        j = Jobj(json_str)
        return cls(
            flux_handle,
            handle=lib.flux_mrpc_create_fromevent(
                flux_handle,
                j.get(),
            ),
        )
Beispiel #4
0
 def test_create_empty(self):
   """Create an empty json object"""
   j = Jobj()
   self.assertEqual(j.as_str(), '')
Beispiel #5
0
 def outarg(self, json_str):
     j = Jobj(json_str)
     self.pimpl.put_outarg(j.get())
Beispiel #6
0
 def outarg(self, nodeid):
     j = Jobj()
     err = self.pimpl.get_outarg(nodeid, j.get_as_dptr())
     if err != 0 or j.get() == ffi.NULL:
         raise RuntimeError("MRPC error: {}".format(err))
     return j.as_str()
Beispiel #7
0
 def inarg(self, json_str):
     j = Jobj(json_str)
     self.pimpl.put_inarg(j.get())
Beispiel #8
0
 def inarg(self):
     j = Jobj()
     err = self.pimpl.get_inarg(j.get_as_dptr())
     if err != 0 or j.get() == ffi.NULL:
         raise RuntimeError("MRPC error: {}".format(err))
     return j.as_str()
Beispiel #9
0
 def outarg(self, json_str):
     j = Jobj(json_str)
     self.pimpl.put_outarg(j.get())
Beispiel #10
0
 def outarg(self, nodeid):
     j = Jobj()
     err = self.pimpl.get_outarg(nodeid, j.get_as_dptr())
     if err != 0 or j.get() == ffi.NULL:
         raise RuntimeError("MRPC error: {}".format(err))
     return j.as_str()
Beispiel #11
0
 def inarg(self, json_str):
     j = Jobj(json_str)
     self.pimpl.put_inarg(j.get())
Beispiel #12
0
 def inarg(self):
     j = Jobj()
     err = self.pimpl.get_inarg(j.get_as_dptr())
     if err != 0 or j.get() == ffi.NULL:
         raise RuntimeError("MRPC error: {}".format(err))
     return j.as_str()