def from_assigned_task(self, assigned_task, _): mesos_task = mesos_task_instance_from_assigned_task(assigned_task) if not mesos_task.has_announce(): return None portmap = resolve_ports(mesos_task, assigned_task.assignedPorts) # assigned_task.slaveHost is the --hostname argument passed into the mesos slave. # Using this allows overriding the hostname published into ZK when announcing. # If no argument was passed to the mesos-slave, the slave falls back to gethostname(). endpoint, additional = make_endpoints( assigned_task.slaveHost, portmap, mesos_task.announce().primary_port().get()) client = self.make_zk_client() if mesos_task.announce().has_zk_path(): if self.__allow_custom_serverset_path: path = mesos_task.announce().zk_path().get() else: app.error('Executor must be started with --announcer-allow-custom-serverset-path in order ' 'to use zk_path in the Announcer config') else: path = self.make_zk_path(assigned_task) initial_interval = mesos_task.health_check_config().initial_interval_secs().get() interval = mesos_task.health_check_config().interval_secs().get() consecutive_failures = mesos_task.health_check_config().max_consecutive_failures().get() timeout_secs = initial_interval + (consecutive_failures * interval) return AnnouncerChecker( client, path, timeout_secs, endpoint, additional=additional, shard=assigned_task.instanceId, name=self.name)
def from_assigned_task(self, assigned_task, _): mesos_task = mesos_task_instance_from_assigned_task(assigned_task) if not mesos_task.has_announce(): return None portmap = resolve_ports(mesos_task, assigned_task.assignedPorts) # assigned_task.slaveHost is the --hostname argument passed into the mesos slave. # Using this allows overriding the hostname published into ZK when announcing. # If no argument was passed to the mesos-slave, the slave falls back to gethostname(). endpoint, additional = make_endpoints( assigned_task.slaveHost, portmap, mesos_task.announce().primary_port().get()) client = self.make_zk_client() if mesos_task.announce().has_zk_path(): if self.__allow_custom_serverset_path: path = mesos_task.announce().zk_path().get() else: app.error('Executor must be started with --announcer-allow-custom-serverset-path in order ' 'to use zk_path in the Announcer config') else: path = self.make_zk_path(assigned_task) initial_interval = mesos_task.health_check_config().initial_interval_secs().get() interval = mesos_task.health_check_config().interval_secs().get() consecutive_failures = mesos_task.health_check_config().max_consecutive_failures().get() timeout_secs = initial_interval + (consecutive_failures * interval) return AnnouncerChecker( client, path, timeout_secs, endpoint, additional=additional, shard=assigned_task.instanceId, name=self.name)
def from_assigned_task(self, assigned_task, _): mesos_task = mesos_task_instance_from_assigned_task(assigned_task) if not mesos_task.has_announce(): return None portmap = resolve_ports(mesos_task, assigned_task.assignedPorts) endpoint, additional = make_endpoints( socket.gethostname(), portmap, mesos_task.announce().primary_port().get()) serverset = self.make_serverset(assigned_task) return AnnouncerChecker( serverset, endpoint, additional=additional, shard=assigned_task.instanceId, name=self.name)
def from_assigned_task(self, assigned_task, _): mesos_task = mesos_task_instance_from_assigned_task(assigned_task) if not mesos_task.has_announce(): return None portmap = resolve_ports(mesos_task, assigned_task.assignedPorts) endpoint, additional = make_endpoints( socket.gethostname(), portmap, mesos_task.announce().primary_port().get()) serverset = self.make_serverset(assigned_task) return AnnouncerChecker(serverset, endpoint, additional=additional, shard=assigned_task.instanceId, name=self.name)
def from_assigned_task(self, assigned_task, _): mesos_task = mesos_task_instance_from_assigned_task(assigned_task) if not mesos_task.has_announce(): return None portmap = resolve_ports(mesos_task, assigned_task.assignedPorts) endpoint, additional = make_endpoints(socket.gethostname(), portmap, mesos_task.announce().primary_port().get()) client = self.make_zk_client() path = self.make_zk_path(assigned_task) initial_interval = mesos_task.health_check_config().initial_interval_secs().get() interval = mesos_task.health_check_config().interval_secs().get() consecutive_failures = mesos_task.health_check_config().max_consecutive_failures().get() timeout_secs = initial_interval + (consecutive_failures * interval) return AnnouncerChecker( client, path, timeout_secs, endpoint, additional=additional, shard=assigned_task.instanceId, name=self.name )