From 18f48ee1db23e1e7f91e0e9e7846eb345d171534 Mon Sep 17 00:00:00 2001 From: Eman Elsabban Date: Mon, 13 May 2024 07:11:56 -0700 Subject: [PATCH] Deleting Mesos code from the Master Control Program --- tests/config/config_parse_test.py | 28 ---------------------------- tests/mcp_test.py | 6 +----- tron/config/config_parse.py | 2 -- tron/config/schema.py | 1 - tron/mcp.py | 3 --- 5 files changed, 1 insertion(+), 39 deletions(-) diff --git a/tests/config/config_parse_test.py b/tests/config/config_parse_test.py index 99f2b4368..01645cc8e 100644 --- a/tests/config/config_parse_test.py +++ b/tests/config/config_parse_test.py @@ -328,7 +328,6 @@ def make_tron_config( nodes=None, node_pools=None, jobs=None, - mesos_options=None, k8s_options=None, ): return schema.TronConfig( @@ -341,7 +340,6 @@ def make_tron_config( nodes=nodes or make_nodes(), node_pools=node_pools or make_node_pools(), jobs=jobs or make_master_jobs(), - mesos_options=mesos_options or make_mesos_options(), k8s_options=k8s_options or make_k8s_options(), ) @@ -479,7 +477,6 @@ def test_attributes(self): assert test_config.command_context == expected.command_context assert test_config.ssh_options == expected.ssh_options - assert test_config.mesos_options == expected.mesos_options assert test_config.time_zone == expected.time_zone assert test_config.nodes == expected.nodes assert test_config.node_pools == expected.node_pools @@ -1523,31 +1520,6 @@ def test_valid(self): config_parse.valid_volume.validate(config, self.context), ) - def test_mesos_default_volumes(self): - mesos_options = {"master_address": "mesos_master"} - mesos_options["default_volumes"] = [ - { - "container_path": "/nail/srv", - "host_path": "/tmp", - "mode": "RO", - }, - { - "container_path": "/nail/srv", - "host_path": "/tmp", - "mode": "invalid", - }, - ] - - with pytest.raises(ConfigError): - config_parse.valid_mesos_options.validate(mesos_options, self.context) - - # After we fix the error, expect error to go away. - mesos_options["default_volumes"][1]["mode"] = "RW" - assert config_parse.valid_mesos_options.validate( - mesos_options, - self.context, - ) - def test_k8s_default_volumes(self): k8s_options = {"kubeconfig_path": "some_path"} k8s_options["default_volumes"] = [ diff --git a/tests/mcp_test.py b/tests/mcp_test.py index 575ff6ff3..13ae2c830 100644 --- a/tests/mcp_test.py +++ b/tests/mcp_test.py @@ -76,9 +76,8 @@ def test_load_config(self, reconfigure, namespace): ], ) @mock.patch("tron.mcp.KubernetesClusterRepository", autospec=True) - @mock.patch("tron.mcp.MesosClusterRepository", autospec=True) @mock.patch("tron.mcp.node.NodePoolRepository", autospec=True) - def test_apply_config(self, mock_repo, mock_cluster_repo, mock_k8s_cluster_repo, reconfigure, namespace): + def test_apply_config(self, mock_repo, mock_k8s_cluster_repo, reconfigure, namespace): config_container = mock.create_autospec(config_parse.ConfigContainer) master_config = config_container.get_master.return_value autospec_method(self.mcp.jobs.update_from_config) @@ -94,9 +93,6 @@ def test_apply_config(self, mock_repo, mock_cluster_repo, mock_k8s_cluster_repo, master_config.node_pools, master_config.ssh_options, ) - mock_cluster_repo.configure.assert_called_with( - master_config.mesos_options, - ) mock_k8s_cluster_repo.configure.assert_called_with( master_config.k8s_options, ) diff --git a/tron/config/config_parse.py b/tron/config/config_parse.py index 0a134f1a6..79fb48851 100644 --- a/tron/config/config_parse.py +++ b/tron/config/config_parse.py @@ -896,7 +896,6 @@ class ValidateConfig(Validator): }, "node_pools": {}, "jobs": (), - "mesos_options": ConfigMesos(**ValidateMesos.defaults), "k8s_options": ConfigKubernetes(**ValidateKubernetes.defaults), "eventbus_enabled": None, } @@ -911,7 +910,6 @@ class ValidateConfig(Validator): "state_persistence": valid_state_persistence, "nodes": nodes, "node_pools": node_pools, - "mesos_options": valid_mesos_options, "k8s_options": valid_kubernetes_options, "eventbus_enabled": valid_bool, } diff --git a/tron/config/schema.py b/tron/config/schema.py index 6cdd78098..451e1dd46 100644 --- a/tron/config/schema.py +++ b/tron/config/schema.py @@ -44,7 +44,6 @@ def config_object_factory(name, required=None, optional=None): "nodes", # dict of ConfigNode "node_pools", # dict of ConfigNodePool "jobs", # dict of ConfigJob - "mesos_options", # ConfigMesos "k8s_options", # ConfigKubernetes "eventbus_enabled", # bool or None ], diff --git a/tron/mcp.py b/tron/mcp.py index e6b316c10..7b0e31ad1 100644 --- a/tron/mcp.py +++ b/tron/mcp.py @@ -13,7 +13,6 @@ from tron.core.jobgraph import JobGraph from tron.eventbus import EventBus from tron.kubernetes import KubernetesClusterRepository -from tron.mesos import MesosClusterRepository from tron.serialize.runstate import statemanager log = logging.getLogger(__name__) @@ -106,14 +105,12 @@ def apply_config(self, config_container, reconfigure=False, namespace_to_reconfi "node_pools", "ssh_options", ), - (MesosClusterRepository.configure, "mesos_options"), (KubernetesClusterRepository.configure, "k8s_options"), (self.configure_eventbus, "eventbus_enabled"), ] master_config = config_container.get_master() apply_master_configuration(master_config_directives, master_config) - self.state_watcher.watch(MesosClusterRepository) self.state_watcher.watch(KubernetesClusterRepository) # If the master namespace was updated, we should update jobs in all namespaces