예제 #1
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def recvUsrData(self, buf_size):
     """Receive data from the front-end."""
     udata = create_string_buffer(buf_size)
     lmon.call(self.lib.LMON_be_recvUsrData, cast(udata, c_void_p))
     if self.amIMaster():
         return lmon.udata_unserialize(udata.raw)
     return None
예제 #2
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def getProctable(self, session, maxsize):
     """Return the process table and its size with LMON_fe_getProctable."""
     proctab_type = lmon.MPIR_PROCDESC_EXT * maxsize
     proctab = proctab_type()
     size = c_uint()
     lmon.call(self.lib.LMON_fe_getProctable, session, byref(proctab), byref(size), c_uint(maxsize))
     return proctab, size.value
예제 #3
0
    def attachAndSpawnDaemons(self, session, hostname, pid, daemon, d_argv,
                              febe_data, befe_data):
        """Invoke LMON_fe_attachAndSpawnDaemons.

        See the manpages. d_argv is a list.
        befe_data is the size of the desired buffer or None.

        """
        # Need a trailing null entry on the array.
        d_argv += [None]
        _d_argv = lmon.create_array(c_char_p, d_argv)
        if febe_data is not None:
            _febe_data = lmon.udata_serialize(febe_data)
        else:
            _febe_data = cast(None, c_void_p)
        buf = None
        if befe_data is not None:
            buf = create_string_buffer(befe_data)
            _befe_data = cast(buf, c_void_p)
        else:
            _befe_data = cast(None, c_void_p)
        lmon.call(self.lib.LMON_fe_attachAndSpawnDaemons, session, hostname,
                  pid, daemon, _d_argv, _febe_data, _befe_data)
        if befe_data:
            return lmon.udata_unserialize(buf.value)
        else:
            return None
예제 #4
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def recvUsrData(self, buf_size):
     """Receive data from the front-end."""
     udata = create_string_buffer(buf_size)
     lmon.call(self.lib.LMON_be_recvUsrData, cast(udata, c_void_p))
     if self.amIMaster():
         return lmon.udata_unserialize(udata.raw)
     return None
예제 #5
0
파일: lmonfe.py 프로젝트: ctanis/PGDB
    def attachAndSpawnDaemons(self, session, hostname, pid, daemon, d_argv,
                              febe_data, befe_data):
        """Invoke LMON_fe_attachAndSpawnDaemons.

        See the manpages. d_argv is a list.
        befe_data is the size of the desired buffer or None.

        """
        # Need a trailing null entry on the array.
        d_argv += [None]
        _d_argv = lmon.create_array(c_char_p, d_argv)
        if febe_data is not None:
            _febe_data = lmon.udata_serialize(febe_data)
        else:
            _febe_data = cast(None, c_void_p)
        buf = None
        if befe_data is not None:
            buf = create_string_buffer(befe_data)
            _befe_data = cast(buf, c_void_p)
        else:
            _befe_data = cast(None, c_void_p)
        lmon.call(self.lib.LMON_fe_attachAndSpawnDaemons, session, hostname,
                  pid, daemon, _d_argv, _febe_data, _befe_data)
        if befe_data:
            return lmon.udata_unserialize(buf.value)
        else:
            return None
예제 #6
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def getMyProctab(self, maxsize):
     """Return the process table and size for this process."""
     proctab_type = lmon.MPIR_PROCDESC_EXT * maxsize
     proctab = proctab_type()
     size = c_int()
     lmon.call(self.lib.LMON_be_getMyProctab, byref(proctab), byref(size),
               maxsize)
     return proctab, size.value
예제 #7
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def getMyProctab(self, maxsize):
     """Return the process table and size for this process."""
     proctab_type = lmon.MPIR_PROCDESC_EXT * maxsize
     proctab = proctab_type()
     size = c_int()
     lmon.call(self.lib.LMON_be_getMyProctab, byref(proctab), byref(size),
               maxsize)
     return proctab, size.value
예제 #8
0
 def getProctable(self, session, maxsize):
     """Return the process table and its size."""
     proctab_type = lmon.MPIR_PROCDESC_EXT * maxsize
     proctab = proctab_type()
     size = c_uint()
     lmon.call(self.lib.LMON_fe_getProctable, session, byref(proctab),
               byref(size), c_uint(maxsize))
     return proctab, size.value
예제 #9
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
    def handshake(self, udata):
        """Do the LaunchMON handshake.

        If udata is not None, it should be the length of the buffer to
        unserialize front-end data to.

        """
        if udata is None:
            lmon.call(self.lib.LMON_be_handshake, cast(None, c_void_p))
        else:
            buf = create_string_buffer(udata)
            lmon.call(self.lib.LMON_be_handshake, cast(buf, c_void_p))
            # Check if we actually received data.
            if buf.raw[0] != "\0":
                return lmon.udata_unserialize(buf.value)
            return None
예제 #10
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
    def putToBeDaemonEnv(self, session, environ):
        """Set up the backend environment with LMON_fe_putToBeDaemonEnv.

        Environ is a list of tuples of keys and values.

        """
        env_list_type = lmon.lmon_daemon_env_t * len(environ)
        env_list = env_list_type()
        for k, env_item in enumerate(environ):
            env_list[k].envName = env_item[0]
            env_list[k].envValue = env_item[1]
            if k < (len(environ) - 1):
                env_list[k].next = pointer(env_list[k + 1])
            else:
                env_list[k].next = None
        lmon.call(self.lib.LMON_fe_putToBeDaemonEnv, session, env_list, len(environ))
예제 #11
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
    def handshake(self, udata):
        """Do the LaunchMON handshake.

        If udata is not None, it should be the length of the buffer to
        unserialize front-end data to.

        """
        if udata is None:
            lmon.call(self.lib.LMON_be_handshake, cast(None, c_void_p))
        else:
            buf = create_string_buffer(udata)
            lmon.call(self.lib.LMON_be_handshake, cast(buf, c_void_p))
            # Check if we actually received data.
            if buf.raw[0] != "\0":
                return lmon.udata_unserialize(buf.value)
            return None
예제 #12
0
    def putToBeDaemonEnv(self, session, environ):
        """Set up the backend environment with LMON_fe_putToBeDaemonEnv.

        Environ is a list of tuples of keys and values.

        """
        env_list_type = lmon.lmon_daemon_env_t * len(environ)
        env_list = env_list_type()
        for k, env_item in enumerate(environ):
            env_list[k].envName = env_item[0]
            env_list[k].envValue = env_item[1]
            if k < (len(environ) - 1):
                env_list[k].next = pointer(env_list[k + 1])
            else:
                env_list[k].next = None
        lmon.call(self.lib.LMON_fe_putToBeDaemonEnv, session, env_list,
                  len(environ))
예제 #13
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
    def init(self, argc, argv):
        """Invoke LMON_be_init.

        argc is the number of arguments in argv.
        argv is a list of arguments to pass as argv.

        """
        _argc = c_int(argc)
        # This is horribly ugly code to properly reconstruct argv for LaunchMON.
        # We stuff the arguments in string buffers (since they can be modified).
        # We stuff those into an array.
        # We add an entry at the end with a bunch of null bytes, since the last
        # argv entry is supposed to be a null and otherwise LaunchMON will make
        # malloc *very* unhappy.
        # We create a pointer to this array.
        # We pass that pointer by reference (another pointer).
        tmp_argv = [cast(create_string_buffer(x), c_char_p) for x in argv]
        tmp_argv.append(cast(create_string_buffer(32), c_char_p))
        _argv = lmon.create_array(c_char_p, tmp_argv)
        argv_ref = c_void_p(addressof(_argv))
        lmon.call(self.lib.LMON_be_init, lmon.LMON_VERSION, byref(_argc),
                  byref(argv_ref))
예제 #14
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
    def init(self, argc, argv):
        """Invoke LMON_be_init.

        argc is the number of arguments in argv.
        argv is a list of arguments to pass as argv.

        """
        _argc = c_int(argc)
        # This is horribly ugly code to properly reconstruct argv for LaunchMON.
        # We stuff the arguments in string buffers (since they can be modified).
        # We stuff those into an array.
        # We add an entry at the end with a bunch of null bytes, since the last
        # argv entry is supposed to be a null and otherwise LaunchMON will make
        # malloc *very* unhappy.
        # We create a pointer to this array.
        # We pass that pointer by reference (another pointer).
        tmp_argv = [cast(create_string_buffer(x), c_char_p) for x in argv]
        tmp_argv.append(cast(create_string_buffer(32), c_char_p))
        _argv = lmon.create_array(c_char_p, tmp_argv)
        argv_ref = c_void_p(addressof(_argv))
        lmon.call(self.lib.LMON_be_init, lmon.LMON_VERSION, byref(_argc),
                  byref(argv_ref))
예제 #15
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
    def broadcast(self, udata, size):
        """Broadcast data.

        The master provides data and the size of it, and this returns None.
        The slaves can provide None for the data, and size is the size of the
        buffer, which is returned after unserialization.

        """
        if self.amIMaster():
            # Master sends the data, returns None.
            lmon.call(self.lib.LMON_be_broadcast, lmon.udata_serialize(udata),
                      size)
            return None
        else:
            # Slave returns the data.
            buf = create_string_buffer(size)
            lmon.call(self.lib.LMON_be_broadcast, cast(buf, c_void_p), size)
            # Depending on the application, there appears to be a spurious null
            # byte at the start of the data. I do not know why. This avoids it.
            if buf.raw[0] == "\0" and buf.raw[1] != "\0":
                buf = string_at(addressof(buf) + 1)
            else:
                buf = buf.value
            return lmon.udata_unserialize(buf)
예제 #16
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
    def scatter(self, udata_array, elem_size):
        """Scatter data.

        The master provides udata_array, which is an array of data to scatter.
        The slaves may provide None for the data.
        elem_size is the size of each element. Due to serialization of data,
        this should be the maximum size of the data, and the elements are padded
        to this length.

        All callers return their respective data (including the master).

        """
        buf = create_string_buffer(elem_size)
        if self.amIMaster():
            # Master pads data if needed and sends.
            total_size = len(udata_array) * elem_size
            send_buf = create_string_buffer(total_size)
            buf_addr = addressof(send_buf)
            idx = 0
            for elem in udata_array:
                tmp_buf = create_string_buffer(
                    string_at(lmon.udata_serialize(elem)), elem_size)
                memmove(buf_addr + (idx * elem_size), tmp_buf, elem_size)
                idx += 1
            lmon.call(self.lib.LMON_be_scatter, cast(send_buf, c_void_p),
                      elem_size, cast(buf, c_void_p))
        else:
            lmon.call(self.lib.LMON_be_scatter, cast(None, c_void_p),
                      elem_size, cast(buf, c_void_p))
        # This is here for the same reason as in broadcast.
        # Note that it appears that the null byte is only present for children.
        if buf.raw[0] == "\0" and buf.raw[1] != "\0":
            buf = string_at(addressof(buf) + 1)
        else:
            buf = buf.value
        return lmon.udata_unserialize(buf)
예제 #17
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
    def broadcast(self, udata, size):
        """Broadcast data.

        The master provides data and the size of it, and this returns None.
        The slaves can provide None for the data, and size is the size of the
        buffer, which is returned after unserialization.

        """
        if self.amIMaster():
            # Master sends the data, returns None.
            lmon.call(self.lib.LMON_be_broadcast, lmon.udata_serialize(udata),
                      size)
            return None
        else:
            # Slave returns the data.
            buf = create_string_buffer(size)
            lmon.call(self.lib.LMON_be_broadcast, cast(buf, c_void_p), size)
            # Depending on the application, there appears to be a spurious null
            # byte at the start of the data. I do not know why. This avoids it.
            if buf.raw[0] == "\0" and buf.raw[1] != "\0":
                buf = string_at(addressof(buf) + 1)
            else:
                buf = buf.value
            return lmon.udata_unserialize(buf)
예제 #18
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def launchAndSpawnDaemons(self, session, hostname, launcher, l_argv, daemon, d_argv, febe_data,
                           befe_data):
     """Invoke LMON_fe_launchAndSpawnDaemons."""
     # Need trailing null entries on the arrays.
     l_argv += [None]
     d_argv += [None]
     _l_argv = lmon.create_array(c_char_p, l_argv)
     _d_argv = lmon.create_array(c_char_p, d_argv)
     if febe_data is not None:
         _febe_data = lmon.udata_serialize(febe_data)
     else:
         _febe_data = cast(None, c_void_p)
     buf = None
     if befe_data is not None:
         buf = create_string_buffer(befe_data)
         _befe_data = cast(buf, c_void_p)
     else:
         _befe_data = cast(None, c_void_p)
     lmon.call(self.lib.LMON_fe_launchAndSpawnDaemons, session, hostname, launcher, _l_argv,
               daemon, _d_argv, _febe_data, _befe_data)
     if befe_data:
         return lmon.udata_unserialize(buf.value)
     else:
         return None
예제 #19
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
    def scatter(self, udata_array, elem_size):
        """Scatter data.

        The master provides udata_array, which is an array of data to scatter.
        The slaves may provide None for the data.
        elem_size is the size of each element. Due to serialization of data,
        this should be the maximum size of the data, and the elements are padded
        to this length.

        All callers return their respective data (including the master).

        """
        buf = create_string_buffer(elem_size)
        if self.amIMaster():
            # Master pads data if needed and sends.
            total_size = len(udata_array) * elem_size
            send_buf = create_string_buffer(total_size)
            buf_addr = addressof(send_buf)
            idx = 0
            for elem in udata_array:
                tmp_buf = create_string_buffer(
                    string_at(lmon.udata_serialize(elem)), elem_size)
                memmove(buf_addr + (idx * elem_size), tmp_buf, elem_size)
                idx += 1
            lmon.call(self.lib.LMON_be_scatter, cast(send_buf, c_void_p),
                      elem_size, cast(buf, c_void_p))
        else:
            lmon.call(self.lib.LMON_be_scatter, cast(None, c_void_p), elem_size,
                      cast(buf, c_void_p))
        # This is here for the same reason as in broadcast.
        # Note that it appears that the null byte is only present for children.
        if buf.raw[0] == "\0" and buf.raw[1] != "\0":
            buf = string_at(addressof(buf) + 1)
        else:
            buf = buf.value
        return lmon.udata_unserialize(buf)
예제 #20
0
 def launchAndSpawnDaemons(self, session, hostname, launcher, l_argv,
                           daemon, d_argv, febe_data, befe_data):
     """Invoke LMON_fe_launchAndSpawnDaemons."""
     # Need trailing null entries on the arrays.
     l_argv += [None]
     d_argv += [None]
     _l_argv = lmon.create_array(c_char_p, l_argv)
     _d_argv = lmon.create_array(c_char_p, d_argv)
     if febe_data is not None:
         _febe_data = lmon.udata_serialize(febe_data)
     else:
         _febe_data = cast(None, c_void_p)
     buf = None
     if befe_data is not None:
         buf = create_string_buffer(befe_data)
         _befe_data = cast(buf, c_void_p)
     else:
         _befe_data = cast(None, c_void_p)
     lmon.call(self.lib.LMON_fe_launchAndSpawnDaemons, session, hostname,
               launcher, _l_argv, daemon, _d_argv, _febe_data, _befe_data)
     if befe_data:
         return lmon.udata_unserialize(buf.value)
     else:
         return None
예제 #21
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def sendUsrData(self, udata):
     """Send data to the front-end."""
     lmon.call(self.lib.LMON_be_sendUsrData, lmon.udata_serialize(udata))
예제 #22
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def regPackForBeToFe(self, callback):
     """Register a pack function."""
     self.pack_cb = self.pack_type(callback)
     lmon.call(self.lib.LMON_be_regPackForBeToFe, self.pack_cb)
예제 #23
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def amIMaster(self):
     """Return whether this process is the master."""
     rc = lmon.call(self.lib.LMON_be_amIMaster)
     if rc == lmon.LMON_YES:
         return True
     return False
예제 #24
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def createSession(self):
     """Create and return a session handle with LMON_fe_createSession."""
     session = c_int()
     lmon.call(self.lib.LMON_fe_createSession, byref(session))
     return session.value
예제 #25
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def kill(self, session):
     """Destroy all resources associated with the session."""
     lmon.call(self.lib.LMON_fe_kill, session)
예제 #26
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def detach(self, session):
     """Detach from the resource manager but leave daemons running."""
     lmon.call(self.lib.LMON_fe_detach, session)
예제 #27
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def getProctableSize(self, session):
     """Return the size of the process table with LMON_fe_getProctableSize."""
     size = c_uint()
     lmon.call(self.lib.LMON_fe_getProctableSize, session, byref(size))
     return size.value
예제 #28
0
 def init(self):
     """Invoke LMON_fe_init."""
     lmon.call(self.lib.LMON_fe_init, lmon.LMON_VERSION)
예제 #29
0
 def kill(self, session):
     """Destroy all resources associated with the session."""
     lmon.call(self.lib.LMON_fe_kill, session)
예제 #30
0
 def shutdownDaemons(self, session):
     """Detach from the resource manager and shut down daemons."""
     lmon.call(self.lib.LMON_fe_shutdownDaemons, session)
예제 #31
0
 def detach(self, session):
     """Detach from the resource manager but leave daemons running."""
     lmon.call(self.lib.LMON_fe_detach, session)
예제 #32
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def barrier(self):
     """Make a barrier."""
     lmon.call(self.lib.LMON_be_barrier)
예제 #33
0
 def getProctableSize(self, session):
     """Return the size of the process table."""
     size = c_uint()
     lmon.call(self.lib.LMON_fe_getProctableSize, session, byref(size))
     return size.value
예제 #34
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def barrier(self):
     """Make a barrier."""
     lmon.call(self.lib.LMON_be_barrier)
예제 #35
0
 def sendUsrDataBe(self, session, febe_data):
     """Send user data to the backend."""
     lmon.call(self.lib.LMON_fe_sendUsrDataBe, session,
               lmon.udata_serialize(febe_data))
예제 #36
0
 def createSession(self):
     """Create and return a session handle with LMON_fe_createSession."""
     session = c_int()
     lmon.call(self.lib.LMON_fe_createSession, byref(session))
     return session.value
예제 #37
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def regUnpackForFeToBe(self, callback):
     """Register an unpack function."""
     self.unpack_cb = self.unpack_type(callback)
     lmon.call(self.lib.LMON_be_regUnpackForFeToBe, self.unpack_cb)
예제 #38
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def sendUsrData(self, udata):
     """Send data to the front-end."""
     lmon.call(self.lib.LMON_be_sendUsrData, lmon.udata_serialize(udata))
예제 #39
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def shutdownDaemons(self, session):
     """Detach from the resource manager and shut down daemons."""
     lmon.call(self.lib.LMON_fe_shutdownDaemons, session)
예제 #40
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def ready(self, udata):
     """Inform the front-end that we are ready."""
     if udata is None:
         lmon.call(self.lib.LMON_be_ready, cast(None, c_void_p))
     else:
         lmon.call(self.lib.LMON_be_ready, lmon.udata_serialize(udata))
예제 #41
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def init(self):
     """Invoke LMON_fe_init."""
     lmon.call(self.lib.LMON_fe_init, lmon.LMON_VERSION)
예제 #42
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def regPackForBeToFe(self, callback):
     """Register a pack function."""
     self.pack_cb = self.pack_type(callback)
     lmon.call(self.lib.LMON_be_regPackForBeToFe, self.pack_cb)
예제 #43
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def getMyProctabSize(self):
     """Return the size of the process table."""
     size = c_int()
     lmon.call(self.lib.LMON_be_getMyProctabSize, byref(size))
     return size.value
예제 #44
0
 def recvUsrDataBe(self, session, buf_size):
     """Receive user data from the backend."""
     befe_data = create_string_buffer(buf_size)
     lmon.call(self.lib.LMON_fe_recvUsrDataBe, session,
               cast(befe_data, c_void_p))
     return lmon.udata_unserialize(befe_data.raw)
예제 #45
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def getMyProctabSize(self):
     """Return the size of the process table."""
     size = c_int()
     lmon.call(self.lib.LMON_be_getMyProctabSize, byref(size))
     return size.value
예제 #46
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def regPackForFeToBe(self, session, callback):
     """Register a pack function with LMON_fe_regPackForFeToBe."""
     cb = self.pack_type(callback)
     self.pack_cbs[session] = cb
     lmon.call(self.lib.LMON_fe_regPackForFeToBe, session, cb)
예제 #47
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def finalize(self):
     """Finalize this session."""
     lmon.call(self.lib.LMON_be_finalize)
예제 #48
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def getMyRank(self):
     """Return the rank of this process."""
     rank = c_int()
     lmon.call(self.lib.LMON_be_getMyRank, byref(rank))
     return rank.value
예제 #49
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def regUnpackForFeToBe(self, callback):
     """Register an unpack function."""
     self.unpack_cb = self.unpack_type(callback)
     lmon.call(self.lib.LMON_be_regUnpackForFeToBe, self.unpack_cb)
예제 #50
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def getSize(self):
     """Return the number of LaunchMON processes."""
     size = c_int()
     lmon.call(self.lib.LMON_be_getSize, byref(size))
     return size.value
예제 #51
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def finalize(self):
     """Finalize this session."""
     lmon.call(self.lib.LMON_be_finalize)
예제 #52
0
 def regPackForFeToBe(self, session, callback):
     """Register a pack function with LMON_fe_regPackForFeToBe."""
     cb = self.pack_type(callback)
     self.pack_cbs[session] = cb
     lmon.call(self.lib.LMON_fe_regPackForFeToBe, session, cb)
예제 #53
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def getMyRank(self):
     """Return the rank of this process."""
     rank = c_int()
     lmon.call(self.lib.LMON_be_getMyRank, byref(rank))
     return rank.value
예제 #54
0
 def regUnpackForBeToFe(self, session, callback):
     """Register an unpack function with LMON_fe_regUnpackForBeToFe."""
     cb = self.unpack_type(callback)
     self.unpack_cbs[session] = cb
     lmon.call(self.lib.LMON_fe_regUnpackForBeToFe, session, cb)
예제 #55
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def regUnpackForBeToFe(self, session, callback):
     """Register an unpack function with LMON_fe_regUnpackForBeToFe."""
     cb = self.unpack_type(callback)
     self.unpack_cbs[session] = cb
     lmon.call(self.lib.LMON_fe_regUnpackForBeToFe, session, cb)
예제 #56
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def getSize(self):
     """Return the number of LaunchMON processes."""
     size = c_int()
     lmon.call(self.lib.LMON_be_getSize, byref(size))
     return size.value
예제 #57
0
파일: lmonbe.py 프로젝트: ctanis/PGDB
 def amIMaster(self):
     """Return whether this process is the master."""
     rc = lmon.call(self.lib.LMON_be_amIMaster)
     if rc == lmon.LMON_YES:
         return True
     return False
예제 #58
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def sendUsrDataBe(self, session, febe_data):
     """Send user data to the backend with LMON_fe_sendUsrDataBe (it is serialized)."""
     lmon.call(self.lib.LMON_fe_sendUsrDataBe, session, lmon.udata_serialize(febe_data))
예제 #59
0
파일: lmonbe.py 프로젝트: thaolt/PGDB
 def ready(self, udata):
     """Inform the front-end that we are ready."""
     if udata is None:
         lmon.call(self.lib.LMON_be_ready, cast(None, c_void_p))
     else:
         lmon.call(self.lib.LMON_be_ready, lmon.udata_serialize(udata))
예제 #60
0
파일: lmonfe.py 프로젝트: alexzah/PGDB
 def recvUsrDataBe(self, session, buf_size):
     """Receive user data from the backend with LMON_fe_recvUsrDataBe (it is unserialized)."""
     befe_data = create_string_buffer(buf_size)
     lmon.call(self.lib.LMON_fe_recvUsrDataBe, session, cast(befe_data, c_void_p))
     return lmon.udata_unserialize(befe_data.raw)