Esempio n. 1
0
def Run(params):
    """
    Note: this action always runs in parallel.
    """
    git = params.config.git
    repos = params.config.repos

    # Note: to time, just pass --timeit in the command line!

    import sys

    if sys.platform == "win32":
        from mu_repo.system_mutex import create_system_mutex_for_current_dir

        # On mu st, we first check if we have a running server
        system_mutex = create_system_mutex_for_current_dir()
        if not system_mutex.get_mutex_aquired():
            with open(system_mutex.filename, "r") as stream:
                port = int(stream.read().strip())

            # Ok, we have a running server, go on and connect to it!
            from mu_repo.umsgpack_s_conn import ConnectionHandler, UMsgPacker, Client
            import threading

            event = threading.Event()

            class ClientHandler(ConnectionHandler, UMsgPacker):
                def _handle_decoded(self, msgs):
                    if not isinstance(msgs, (tuple, list)):
                        msgs = [msgs]
                    from mu_repo.print_ import Print

                    for msg in msgs:
                        Print(msg)

                    event.set()

            client = Client("127.0.0.1", port, ClientHandler)

            client.send(("stat", git, repos))
            event.wait(5)
            return

    ExecuteStCommand(params, repos, git)
Esempio n. 2
0
def stop_server():
    from mu_repo.system_mutex import create_system_mutex_for_current_dir
    system_mutex = create_system_mutex_for_current_dir()
    if not system_mutex.get_mutex_aquired():
        with open(system_mutex.filename, 'r') as stream:
            port = int(stream.read().strip())

        from mu_repo.umsgpack_s_conn import ConnectionHandler, UMsgPacker, Client

        class ClientHandler(ConnectionHandler, UMsgPacker):

            def _handle_decoded(self, decoded):
                print('Warning: not expecting message. Received: %s' % (decoded,))

        client = Client('127.0.0.1', port, ClientHandler)

        if _DEBUG:
            print('debug: client: Killing server')
        client.send('shutdown')
Esempio n. 3
0
def Run(params):
    '''
    Note: this action always runs in parallel.
    '''
    git = params.config.git
    repos = params.config.repos

    # Note: to time, just pass --timeit in the command line!

    import sys
    if sys.platform == 'win32':
        from mu_repo.system_mutex import create_system_mutex_for_current_dir
        # On mu st, we first check if we have a running server
        system_mutex = create_system_mutex_for_current_dir()
        if not system_mutex.get_mutex_aquired():
            with open(system_mutex.filename, 'r') as stream:
                port = int(stream.read().strip())

            # Ok, we have a running server, go on and connect to it!
            from mu_repo.umsgpack_s_conn import ConnectionHandler, UMsgPacker, Client
            import threading

            event = threading.Event()

            class ClientHandler(ConnectionHandler, UMsgPacker):

                def _handle_decoded(self, msgs):
                    if not isinstance(msgs, (tuple, list)):
                        msgs = [msgs]
                    from mu_repo.print_ import Print
                    for msg in msgs:
                        Print(msg)

                    event.set()

            client = Client('127.0.0.1', port, ClientHandler)

            client.send(('stat', git, repos))
            event.wait(5)
            return

    ExecuteStCommand(params, repos, git)