def update_parallelism()

in resources/flink-on-kda/index.py [0:0]


def update_parallelism(context, desiredCapacity, resourceName, appVersionId):
    # Update parallelism to the new Desired Capacity value
    try:
        response = client_kda.update_application(
            ApplicationName=resourceName,
            CurrentApplicationVersionId=appVersionId,
            ApplicationConfigurationUpdate={
                'FlinkApplicationConfigurationUpdate': {
                    'ParallelismConfigurationUpdate': {
                        'ConfigurationTypeUpdate': 'CUSTOM',
                        'ParallelismUpdate': int(desiredCapacity),
                        'AutoScalingEnabledUpdate': False
                    }
                }
            }
        )

        print("In update_parallelism; response: ")
        print(response)
        scalingStatus = "InProgress"
        
        put_alarms(context, desiredCapacity)

    # In case of error of updating the sharding, raise an exception.
    except Exception as e:
        print(e)
        failureReason = str(e)
        scalingStatus = "Failed"
        pass

    return scalingStatus