Пример #1
0
def update_nodes(event):
    """
    Entry point for the CloudWatch scheduled task to discover and cache services.
    """
    # get this lambda's timeout value
    lambda_client = boto3.client("lambda")
    this_lambda = lambda_client.get_function(
        FunctionName=event.context.invoked_function_arn)
    # calculate millis
    total_ms = int(this_lambda['Configuration']['Timeout']) * 1000
    # we need 25% of our total run time remaining to keep going
    min_remain_ms = int(total_ms * 0.25)
    # loop until the remaining time is less than the minimum
    while min_remain_ms < event.context.get_remaining_time_in_millis():
        periodic_handlers.update_nodes()
        # print the stats
        print("remaining time {}ms".format(
            event.context.get_remaining_time_in_millis()))
        print("required remaining time {}ms".format(min_remain_ms))
def update_nodes(_):
    """
    Entry point for the CloudWatch scheduled task to discover and cache services.
    """
    return periodic_handlers.update_nodes()
def update_nodes(_):
    """
    Entry point for the CloudWatch scheduled task to discover and cache services.
    """
    return periodic_handlers.update_nodes()