Example #1
0
    def __init__(self, agent_id, node, scheduler_config):
        """Constructor

        :param agent_id: The Mesos agent ID for the node
        :type agent_id: string
        :param node: The node model
        :type node: :class:`node.models.Node`
        :param scheduler_config: The scheduler configuration
        :type scheduler_config: :class:`scheduler.configuration.SchedulerConfiguration`
        """

        self._hostname = str(node.hostname)  # Never changes
        self._id = node.id  # Never changes

        self._agent_id = agent_id
        self._cleanup = NodeCleanup()
        self._cleanup_task = None
        self._conditions = NodeConditions(self._hostname)
        self._health_task = None
        self._is_active = node.is_active
        self._is_image_pulled = False
        self._is_initial_cleanup_completed = False
        self._is_online = True
        self._is_paused = node.is_paused
        self._is_scheduler_paused = scheduler_config.is_paused
        self._last_health_task = None
        self._last_offer_received = node.last_offer_received
        self._lock = threading.Lock()
        self._pull_task = None
        self._state = None
        self._update_state()
Example #2
0
    def _reset_node(self):
        """Resets the node if it goes away so initial cleanup and the Scale image pull occur when the node comes back.
        Caller must have obtained the node's thread lock.
        """

        self._cleanup = NodeCleanup()
        self._cleanup_task = None
        self._health_task = None
        self._is_image_pulled = False
        self._is_initial_cleanup_completed = False
        self._last_health_task = None
        self._pull_task = None