Ejemplo n.º 1
0
def stop_lambda() -> None:
    from localstack.services.awslambda.lambda_api import cleanup
    """
    Stops / cleans up the Lambda Executor
    """
    # TODO actually stop flask server
    cleanup()
Ejemplo n.º 2
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()
Ejemplo n.º 3
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()
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
def stop_infra():
    global INFRA_STOPPED
    if INFRA_STOPPED:
        return

    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)
    # TODO: optimize this (takes too long currently)
    # check_infra(retries=2, expect_shutdown=True)
    INFRA_STOPPED = True
Ejemplo n.º 8
0
 def setUp(self):
     lambda_api.cleanup()
     self.maxDiff = None
     self.app = lambda_api.app
     self.app.testing = True
     self.client = self.app.test_client()
Ejemplo n.º 9
0
 def setUp(self):
     lambda_api.cleanup()
     self.maxDiff = None
     self.app = Flask(__name__)