All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.fenzo.VirtualMachineCurrentState Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
/*
 * Copyright 2015 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.netflix.fenzo;

import org.apache.mesos.Protos;

import java.util.Collection;
import java.util.Map;

/**
 * Represents the current state of the host (virtual machine) that Fenzo is considering for a task assignment.
 * A fitness calculator plugin may use the information from this state object to influence how it optimizes task
 * placement decisions.
 */
public interface VirtualMachineCurrentState {

    /**
     * Get the name of the host on which the virtual machine is running.
     *
     * @return the hostname
     */
    String getHostname();

    /**
     * Get a map of resource sets of the virtual machine.
     *
     * @return The map of resource sets
     */
    Map getResourceSets();

    /**
     * Returns a VM lease object representing totals of resources from all available leases on this host for the
     * current scheduling run.
     *
     * @return a lease object that represents resources that are currently available on the host
     */
    VirtualMachineLease getCurrAvailableResources();

    /**
     * Get all offers for the VM that represent the available resources. There may be more than one offer over time
     * if Mesos master offered partial resources for the VM multiple times.
     * @return A collection of Mesos resource offers.
     */
    Collection getAllCurrentOffers();

    /**
     * Get list of task assignment results for this host so far in the current scheduling run.
     *
     * @return a collection of tasks that the current scheduling iteration assigned to this host but that are
     *         not launched/executing yet
     */
    Collection getTasksCurrentlyAssigned();

    /**
     * Get a list of those tasks that had already been assigned to this host before the current scheduling run
     * started.
     *
     * @return a collection of the tasks running on this host
     */
    Collection getRunningTasks();

    /**
     * Returns the time until which the given host remains disabled.
     *
     * @return time until which the host will remain disabled or 0 if the host is enabled
     */
    long getDisabledUntil();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy