def lambda_handler()

in assets/functions/check_initial_pipeline_run/app.py [0:0]


def lambda_handler(event, context):
    working_bucket = os.environ['Working_bucket']
    file_key = "meteranalytics/initial_pass"


    initial_pipeline_passed = check_if_file_exist(working_bucket, file_key)

    if initial_pipeline_passed:
        parameter = load_json_from_file(working_bucket, file_key)
    else:
        parameter = {
            "Data_start": "2013-06-01",
            "Data_end": "2013-12-01",
            "Forecast_period": 7,
            "Training_samples": 50,
            "Training_instance_type": "ml.c5.2xlarge",
            "Endpoint_instance_type": "ml.m5.xlarge",
            "Training_job_name": "training-job-{}".format(str(uuid.uuid4())),
            "ModelName": "ml-model-{}".format(str(uuid.uuid4())),
            "ML_endpoint_name": "ml-endpoint-{}".format(str(uuid.uuid4())),
            "Meter_start": 1,
            "Meter_end": 100,
            "Batch_size": 25
        }

    return {
        **parameter,
        **event, # will override parameter with same key, can be used to override default parameter from the outside
        "initial_pipeline_passed": initial_pipeline_passed
    }