How to use the guider.NetworkManager function in guider

To help you get started, weā€™ve selected a few guider examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iipeace / guider / agent / __init__.py View on Github external
def request_start(timestamp, targetAddr):
        print('request_start')

        # set addresses #
        NetworkManager.prepareServerConn(None, targetAddr)

        # get connection with server #
        conn = NetworkManager.getServerConn()
        if not conn:
            print('\nFail to get connection with server')
            sys.exit(0)

        # request command #
        pipe = NetworkManager.getCmdPipe(conn, 'GUIDER top -a -J -e dn')
        if not pipe:
            print('\nFail to get command pipe')
            sys.exit(0)

        # build message #
        msg = {'timestamp': timestamp}
        RequestManager.add_request(timestamp)

        '''
        # for multi-thread feature #
        global thread
        with thread_lock:
            if thread is None:
                thread = socketio.start_background_task(thread_task)
        '''
github iipeace / guider / agent / example.py View on Github external
'''
    Choose one of below calls. (None: default address)
    1. NetworkManager.prepareServerConn(CLIENT_IP:PORT, SERVER_IP:PORT)
    2. NetworkManager.prepareServerConn(None, SERVER_IP:PORT)
    3. NetworkManager.prepareServerConn(None, None)
    '''
    NetworkManager.prepareServerConn(None, None)

    # get connection with server #
    conn = NetworkManager.getServerConn()
    if not conn:
        print('\nFail to get connection with server')
        sys.exit(0)

    # request command #
    pipe = NetworkManager.getCmdPipe(conn, 'GUIDER top -a -J')
    if not pipe:
        print('\nFail to get command pipe')
        sys.exit(0)

    # get data from server #
    while 1:
        data = pipe.getData()
        if not data:
            break

        print(data.rstrip())

    # close command pipe to terminate process on server #
    pipe.close()
github iipeace / guider / agent / example.py View on Github external
if __name__ == '__main__':

    # run server before launch below client code #
    '''
    $ guider/guider.py server
    '''

    # set network info #
    '''
    Choose one of below calls. (None: default address)
    1. NetworkManager.prepareServerConn(CLIENT_IP:PORT, SERVER_IP:PORT)
    2. NetworkManager.prepareServerConn(None, SERVER_IP:PORT)
    3. NetworkManager.prepareServerConn(None, None)
    '''
    NetworkManager.prepareServerConn(None, None)

    # get connection with server #
    conn = NetworkManager.getServerConn()
    if not conn:
        print('\nFail to get connection with server')
        sys.exit(0)

    # request command #
    pipe = NetworkManager.getCmdPipe(conn, 'GUIDER top -a -J')
    if not pipe:
        print('\nFail to get command pipe')
        sys.exit(0)

    # get data from server #
    while 1:
        data = pipe.getData()
github iipeace / guider / agent / __init__.py View on Github external
def request_start(timestamp, targetAddr):
        print('request_start')

        # set addresses #
        NetworkManager.prepareServerConn(None, targetAddr)

        # get connection with server #
        conn = NetworkManager.getServerConn()
        if not conn:
            print('\nFail to get connection with server')
            sys.exit(0)

        # request command #
        pipe = NetworkManager.getCmdPipe(conn, 'GUIDER top -a -J -e dn')
        if not pipe:
            print('\nFail to get command pipe')
            sys.exit(0)

        # build message #
        msg = {'timestamp': timestamp}
        RequestManager.add_request(timestamp)

guider

Unified performance analyzer

GPL-2.0
Latest version published 8 months ago

Package Health Score

65 / 100
Full package analysis