Beispiel #1
0
def _clean_objects(hard_stop=False):
    # type: (bool) -> None
    """ Clean all objects.

    Clean the objects stored in the global dictionaries:
        - pending_to_synchronize dict.
        - _addr2id2obj dict.
        - obj_id_to_filename dict.
        - _objs_written_by_mp dict.

    :param hard_stop: avoid call to delete_file when the runtime has died.
    :return: None
    """
    app_id = 0
    if not hard_stop:
        for filename in OT.get_all_file_names():
            COMPSs.delete_file(app_id, filename, False)
    OT.clean_object_tracker()
Beispiel #2
0
def __hard_stop__(debug, sync, logger, ipython):
    # type: (bool, bool, typing.Any, typing.Any) -> None
    """ The runtime has been stopped by any error and this method stops the
    remaining things in the binding.

    :param debug: If debugging.
    :param sync: Scope variables synchronization [ True | False ].
    :param logger: Logger where to put the logging messages.
    :param ipython: Ipython instance.
    :return: None
    """
    print("The runtime is not running.")
    # Check that everything is stopped as well:

    # Stop streaming
    if STREAMING:
        stop_streaming()

    # Stop persistent storage
    if PERSISTENT_STORAGE:
        master_stop_storage(logger)

    # Clean any left object in the object tracker
    OT.clean_object_tracker()

    # Cleanup events and files
    release_event_manager(ipython)
    __clean_temp_files__()

    # Stop watching stdout and stderr
    STDW.stop_watching(clean=not debug)
    # Retrieve the remaining messages that could have been captured.
    last_messages = STDW.get_messages()
    if last_messages:
        for message in last_messages:
            print(message)

    if sync:
        print("* Can not synchronize any future object.")
    return None