Skip to content

Commit

Permalink
Remove some more now-unused code from mesos_tools.py
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanKrall committed May 18, 2024
1 parent e089b04 commit af58b23
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions paasta_tools/mesos_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@
from typing import Sequence
from typing import Tuple
from typing import Union
from urllib.parse import urlparse

import a_sync
import humanize
import requests

import paasta_tools.mesos.cluster as cluster
import paasta_tools.mesos.exceptions as mesos_exceptions
Expand All @@ -50,15 +48,6 @@

DEFAULT_MESOS_CLI_CONFIG_LOCATION = "/nail/etc/mesos-cli.json"

TERMINAL_STATES = (
"TASK_ERROR",
"TASK_KILLED",
"TASK_FAILED",
"TASK_FINISHED",
"TASK_DROPPED",
"TASK_GONE",
"TASK_GONE_BY_OPERATOR",
)

log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
Expand Down Expand Up @@ -93,37 +82,12 @@ def get_mesos_master(
return MesosMaster(config)


MESOS_MASTER_PORT = 5050


class MesosTailLines(NamedTuple):
stdout: List[str]
stderr: List[str]
error_message: str


class MesosLeaderUnavailable(Exception):
pass


def find_mesos_leader(cluster):
"""Find the leader with redirect given one mesos master."""
master = (
load_system_paasta_config().get_cluster_fqdn_format().format(cluster=cluster)
)
if master is None:
raise ValueError("Mesos master is required to find leader")

url = f"http://{master}:{MESOS_MASTER_PORT}/redirect"
try:
# Timeouts here are for connect, read
response = requests.get(url, timeout=(5, 30))
except Exception as e:
raise MesosLeaderUnavailable(e)
hostname = urlparse(response.url).hostname
return f"{hostname}:{MESOS_MASTER_PORT}"


async def get_current_tasks(job_id: str) -> List[Task]:
"""Returns a list of all the tasks with a given job id.
:param job_id: the job id of the tasks.
Expand Down

0 comments on commit af58b23

Please sign in to comment.