示例#1
0
def stop_infra():
    if common.INFRA_STOPPED:
        return
    # also used to signal shutdown for edge proxy so that any further requests will be rejected
    common.INFRA_STOPPED = True  # TODO: should probably be STOPPING since it isn't stopped yet

    event_publisher.fire_event(event_publisher.EVENT_STOP_INFRA)
    analytics.log.event("infra_stop")

    try:
        generic_proxy.QUIET = True  # TODO: this doesn't seem to be doing anything
        LOG.debug("[shutdown] Cleaning up services ...")
        SERVICE_PLUGINS.stop_all_services()
        LOG.debug("[shutdown] Cleaning up files ...")
        common.cleanup(files=True, quiet=True)
        LOG.debug("[shutdown] Cleaning up resources ...")
        common.cleanup_resources()

        if config.FORCE_SHUTDOWN:
            LOG.debug("[shutdown] Force shutdown, not waiting for infrastructure to shut down")
            return

        LOG.debug("[shutdown] Waiting for infrastructure to shut down ...")
        wait_for_infra_shutdown()
        LOG.debug("[shutdown] Infrastructure is shut down")
    finally:
        SHUTDOWN_INFRA.set()
示例#2
0
def stop_infra():
    from localstack.services.awslambda import lambda_api

    if common.INFRA_STOPPED:
        return
    common.INFRA_STOPPED = True

    event_publisher.fire_event(event_publisher.EVENT_STOP_INFRA)
    analytics.log.event("infra_stop")

    try:
        generic_proxy.QUIET = True
        LOG.debug("[shutdown] Cleaning up files ...")
        common.cleanup(files=True, quiet=True)
        LOG.debug("[shutdown] Cleaning up resources ...")
        common.cleanup_resources()
        LOG.debug("[shutdown] Cleaning up Lambda resources ...")
        lambda_api.cleanup()

        if config.FORCE_SHUTDOWN:
            LOG.debug(
                "[shutdown] Force shutdown, not waiting for infrastructure to shut down"
            )
            return

        LOG.debug("[shutdown] Waiting for infrastructure to shut down ...")
        wait_for_infra_shutdown()
        LOG.debug("[shutdown] Infrastructure is shut down")
    finally:
        SHUTDOWN_INFRA.set()
示例#3
0
def stop_infra():
    if common.INFRA_STOPPED:
        return
    common.INFRA_STOPPED = True

    event_publisher.fire_event(event_publisher.EVENT_STOP_INFRA)

    try:
        generic_proxy.QUIET = True
        LOG.debug('[shutdown] Cleaning up files ...')
        common.cleanup(files=True, quiet=True)
        LOG.debug('[shutdown] Cleaning up resources ...')
        common.cleanup_resources()
        LOG.debug('[shutdown] Cleaning up Lambda resources ...')
        lambda_api.cleanup()

        if config.FORCE_SHUTDOWN:
            LOG.debug('[shutdown] Force shutdown, not waiting for infrastructure to shut down')
            return

        LOG.debug('[shutdown] Waiting for infrastructure to shut down ...')
        wait_for_infra_shutdown()
        LOG.debug('[shutdown] Infrastructure is shut down')
    finally:
        SHUTDOWN_INFRA.set()
示例#4
0
def stop_infra():
    if common.INFRA_STOPPED:
        return
    common.INFRA_STOPPED = True

    event_publisher.fire_event(event_publisher.EVENT_STOP_INFRA)

    generic_proxy.QUIET = True
    common.cleanup(files=True, quiet=True)
    common.cleanup_resources()
    lambda_api.cleanup()
    time.sleep(2)
示例#5
0
def stop_infra():
    global INFRA_STOPPED
    if INFRA_STOPPED:
        return
    generic_proxy.QUIET = True
    common.cleanup(files=True, quiet=True)
    common.cleanup_resources()
    lambda_api.cleanup()
    time.sleep(1)
    # TODO: optimize this (takes too long currently)
    # check_infra(retries=2, expect_shutdown=True)
    INFRA_STOPPED = True
示例#6
0
def stop_infra():
    global INFRA_STOPPED
    if INFRA_STOPPED:
        return
    generic_proxy.QUIET = True
    common.cleanup(files=True, quiet=True)
    common.cleanup_resources()
    lambda_api.cleanup()
    time.sleep(1)
    # TODO: optimize this (takes too long currently)
    # check_infra(retries=2, expect_shutdown=True)
    INFRA_STOPPED = True
示例#7
0
def stop_infra(debug=False):
    if common.INFRA_STOPPED:
        return
    common.INFRA_STOPPED = True

    event_publisher.fire_event(event_publisher.EVENT_STOP_INFRA)

    generic_proxy.QUIET = True
    print_debug('[shutdown] Cleaning up files ...', debug)
    common.cleanup(files=True, quiet=True)
    print_debug('[shutdown] Cleaning up resources ...', debug)
    common.cleanup_resources(debug=debug)
    print_debug('[shutdown] Cleaning up Lambda resources ...', debug)
    lambda_api.cleanup()
    time.sleep(2)
示例#8
0
def stop_infra():
    generic_proxy.QUIET = True
    common.cleanup(files=True, quiet=True)
    common.cleanup_resources()
    lambda_api.cleanup()
    time.sleep(1)