def lambda_handler()

in sam/app-control-concurrency-with-dynamodb/functions/do_work_function/app.py [0:0]


def lambda_handler(event, context):
    random_number = random.random()
    # Throw and exception if the random number is larger than the specified threshold
    if random_number > failure_threshold:
        raise RandomSimulatedFailure('Function failed because randomly generated number {} was larger than {}'.format(random_number,failure_threshold))
    else:
        time.sleep(15) 
        return 1