Skip to content

Commit

Permalink
Deleting Mesos code from the Master Control Program
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanElsaban committed May 13, 2024
1 parent 6d108e8 commit 18f48ee
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 39 deletions.
28 changes: 0 additions & 28 deletions tests/config/config_parse_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ def make_tron_config(
nodes=None,
node_pools=None,
jobs=None,
mesos_options=None,
k8s_options=None,
):
return schema.TronConfig(
Expand All @@ -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(),
)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"] = [
Expand Down
6 changes: 1 addition & 5 deletions tests/mcp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
)
Expand Down
2 changes: 0 additions & 2 deletions tron/config/config_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,6 @@ class ValidateConfig(Validator):
},
"node_pools": {},
"jobs": (),
"mesos_options": ConfigMesos(**ValidateMesos.defaults),
"k8s_options": ConfigKubernetes(**ValidateKubernetes.defaults),
"eventbus_enabled": None,
}
Expand All @@ -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,
}
Expand Down
1 change: 0 additions & 1 deletion tron/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
Expand Down
3 changes: 0 additions & 3 deletions tron/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 18f48ee

Please sign in to comment.