def wait_for_deployment_to_finish()

in deploy_component_version.py [0:0]


def wait_for_deployment_to_finish(deploy_id):
    """ Waits for the deployment to complete """
    deployment_status = 'ACTIVE'
    snapshot = time.time()

    while deployment_status == 'ACTIVE' and (time.time() - snapshot) < 300:
        try:
            response = greengrassv2_client.get_deployment(deploymentId=deploy_id)
            deployment_status = response['deploymentStatus']
        except Exception as e:
            print('Failed to get deployment\nException: {}'.format(e))
            sys.exit(1)

    if deployment_status == 'COMPLETED':
        print('Deployment completed successfully in {:.1f} seconds'.format(time.time() - snapshot))
    elif deployment_status == 'ACTIVE':
        print('Deployment timed out')
        sys.exit(1)
    else:
        print('Deployment error: {}'.format(deployment_status))
        sys.exit(1)