Exemple #1
0
def stop_runtime(code=0, hard_stop=False):
    # type: (int, bool) -> None
    """ Stops the COMPSs runtime.

    Stops the runtime by calling the external python library that calls
    the bindings-common.
    Also cleans objects and temporary files created during runtime.
    If the code is different from 0, all running or waiting tasks will be
    cancelled.

    :parameter code: Stop code (if code != 0 ==> cancel application tasks).
    :param hard_stop: Stop compss when runtime has died.
    :return: None
    """
    with event_master(STOP_RUNTIME_EVENT):
        app_id = 0
        if __debug__:
            logger.info("Stopping runtime...")

        # Stopping a possible wall clock limit
        signal.alarm(0)

        if code != 0:
            if __debug__:
                logger.info("Canceling all application tasks...")
            COMPSs.cancel_application_tasks(app_id, 0)

        if __debug__:
            logger.info("Cleaning objects...")
        _clean_objects(hard_stop=hard_stop)

        if __debug__:
            reporting = OT.is_report_enabled()
            if reporting:
                logger.info("Generating Object tracker report...")
                target_path = get_log_path()
                OT.generate_report(target_path)
                OT.clean_report()

        if __debug__:
            logger.info("Stopping COMPSs...")
        COMPSs.stop_runtime(code)

        if __debug__:
            logger.info("Cleaning temps...")
        _clean_temps()

        context.set_pycompss_context(context.OUT_OF_SCOPE)
        if __debug__:
            logger.info("COMPSs stopped")
Exemple #2
0
def stop_runtime(code=0):
    # type: (int) -> None
    """ Stops the COMPSs runtime.

    Stops the runtime by calling the external python library that calls
    the bindings-common.
    Also cleans objects and temporary files created during runtime.
    If the code is different from 0, all running or waiting tasks will be
    cancelled.

    :parameter code: Stop code (if code != 0 ==> cancel application tasks).
    :return: None
    """
    app_id = 0
    if __debug__:
        logger.info("Stopping runtime...")

    if code != 0:
        if __debug__:
            logger.info("Canceling all application tasks...")
        COMPSs.cancel_application_tasks(app_id, 0)

    if __debug__:
        logger.info("Cleaning objects...")
    _clean_objects()

    if __debug__:
        reporting = OT_is_report_enabled()
        if reporting:
            logger.info("Generating Object tracker report...")
            target_path = get_log_path()
            OT_generate_report(target_path)
            OT_clean_report()

    if __debug__:
        logger.info("Stopping COMPSs...")
    COMPSs.stop_runtime(code)

    if __debug__:
        logger.info("Cleaning temps...")
    _clean_temps()

    if __debug__:
        logger.info("COMPSs stopped")