Esempio n. 1
0
def run_main():
    """
        Parsers command line arguments and launches PyXRD accordingly.
    """

    # Get settings
    from pyxrd.data import settings

    if settings.DEBUG:
        from pyxrd import stacktracer
        stacktracer.trace_start(
            "trace.html",
            interval=5, auto=True) # Set auto flag to always update file!

    try:
        if settings.ARGS.script:
            # Run the specified user script:
            _run_user_script()
        else:
            # Run the GUI:
            _run_gui()
    except:
        raise # re-raise the error
    finally:
        for finalizer in settings.FINALIZERS:
            finalizer()
        if settings.DEBUG: stacktracer.trace_stop()
Esempio n. 2
0
def _worker_initializer(pool_stop, debug, *args):

    # Spoof command line arguments so settings are loaded with correct
    # debugging flag
    import sys
    if debug and not "-d" in sys.argv:
        sys.argv.insert(1, "-d")
    if not debug and "-d" in sys.argv:
        sys.argv.remove("-d")

    # Load settings
    from pyxrd.data import settings

    if settings.DEBUG:
        from pyxrd import stacktracer
        stacktracer.trace_start(
            "trace-worker-%s.html" % multiprocessing.current_process().name,
            interval=5, auto=True) # Set auto flag to always update file!
    logger.info("Worker process initialized, DEBUG=%s" % debug)
Esempio n. 3
0
def _worker_initializer(pool_stop, debug, *args):
    # Spoof command line arguments so settings are loaded with correct
    # debugging flag
    if debug and not "-d" in sys.argv:
        sys.argv.insert(1, "-d")
    if not debug and "-d" in sys.argv:
        sys.argv.remove("-d")

    # Load settings
    from pyxrd.data import settings
    settings.initialize()

    if settings.DEBUG:
        from pyxrd import stacktracer
        stacktracer.trace_start(
            "trace-worker-%s.html" % multiprocessing.current_process().name,
            interval=5,
            auto=True)  # Set auto flag to always update file!
    logger.info("Worker process initialized, DEBUG=%s" % debug)
    pass
Esempio n. 4
0
def run_main():
    """
        Parsers command line arguments and launches PyXRD accordingly.
    """

    # Make sure the current path is used for loading PyXRD modules:
    mod = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    if not mod in sys.path:
        sys.path.insert(1, mod)

    # Init settings, first import will trigger initialization
    from pyxrd.data import settings
    settings.initialize()

    # Setup basic logging
    from pyxrd.logs import setup_logging
    setup_logging(basic=True)

    if settings.DEBUG:
        from pyxrd import stacktracer
        stacktracer.trace_start(
            "trace.html",
            interval=5, auto=True) # Set auto flag to always update file!

    try:
        if settings.ARGS.script:
            # Run the specified user script:
            _run_user_script()
        else:
            # Run the GUI:
            _run_gui()
    except:
        raise # re-raise the error
    finally:
        for finalizer in settings.FINALIZERS:
            finalizer()
        if settings.DEBUG: stacktracer.trace_stop()
Esempio n. 5
0
def run_main():
    """
        Parsers command line arguments and launches PyXRD accordingly.
    """

    # Make sure the current path is used for loading PyXRD modules:
    mod = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    if not mod in sys.path:
        sys.path.insert(1, mod)

    # Init settings, first import will trigger initialization
    from pyxrd.data import settings
    settings.initialize()

    # Setup basic logging
    from pyxrd.logs import setup_logging
    setup_logging(basic=True)

    if settings.DEBUG:
        from pyxrd import stacktracer
        stacktracer.trace_start(
            "trace.html", interval=5,
            auto=True)  # Set auto flag to always update file!

    try:
        if settings.ARGS.script:
            # Run the specified user script:
            _run_user_script()
        else:
            # Run the GUI:
            _run_gui()
    except:
        raise  # re-raise the error
    finally:
        for finalizer in settings.FINALIZERS:
            finalizer()
        if settings.DEBUG: stacktracer.trace_stop()