示例#1
0
def prefetch_docker_image_on_private_agents(
    image, timeout=timedelta(minutes=5).total_seconds()):
    """ Given a docker image. An app with the image is scale across the private
        agents to ensure that the image is prefetched to all nodes.

        :param image: docker image name
        :type image: str
        :param timeout: timeout for deployment wait in secs (default: 5m)
        :type password: int
    """
    agents = len(shakedown.get_private_agents())
    app = {
        "id": "/prefetch",
        "instances": agents,
        "container": {
            "type": "DOCKER",
            "docker": {
                "image": image
            }
        },
        "cpus": 0.1,
        "mem": 128
    }

    client = marathon.create_client()
    client.add_app(app)

    shakedown.deployment_wait(timeout)

    shakedown.delete_all_apps()
    shakedown.deployment_wait(timeout)
def remove_mom_ee():
    mom_ee_versions = [('1.4', 'strict'), ('1.4', 'permissive'),
                       ('1.4', 'disabled'), ('1.3', 'strict'),
                       ('1.3', 'permissive'), ('1.3', 'disabled')]
    for mom_ee in mom_ee_versions:
        endpoint = mom_ee_endpoint(mom_ee[0], mom_ee[1])
        if shakedown.service_available_predicate(endpoint):
            print('Removing {}...'.format(endpoint))
            with shakedown.marathon_on_marathon(name=endpoint):
                shakedown.delete_all_apps()

    client = marathon.create_client()
    client.remove_app(MOM_EE_NAME)
    shakedown.deployment_wait()
    print('Successfully removed {}'.format(MOM_EE_NAME))