Skip to content

Commit

Permalink
Merge pull request #953 from Yelp/u/emanelsabban/TRON-2183
Browse files Browse the repository at this point in the history
Delete Mesos code from statemanager - TRON-2183
  • Loading branch information
EmanElsaban authored May 13, 2024
2 parents e411408 + d78a8af commit 1035345
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 22 deletions.
12 changes: 0 additions & 12 deletions tests/serialize/runstate/statemanager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from tron.config import schema
from tron.core.job import Job
from tron.core.jobrun import JobRun
from tron.mesos import MesosClusterRepository
from tron.serialize import runstate
from tron.serialize.runstate.shelvestore import ShelveStateStore
from tron.serialize.runstate.statemanager import PersistenceManagerFactory
Expand Down Expand Up @@ -307,17 +306,6 @@ def test_restore(self):
self.watcher.restore(jobs)
self.watcher.state_manager.restore.assert_called_with(jobs)

def test_handler_mesos_change(self):
self.watcher.handler(
observable=MesosClusterRepository,
event=None,
)
self.watcher.state_manager.save.assert_called_with(
runstate.MESOS_STATE,
MesosClusterRepository.name,
MesosClusterRepository.state_data,
)

def test_handler_job_state_change(self):
mock_job = mock.Mock(spec_set=Job)
with mock.patch.object(self.watcher, "save_job") as mock_save_job:
Expand Down
1 change: 0 additions & 1 deletion tron/serialize/runstate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
JOB_STATE = "job_state"
JOB_RUN_STATE = "job_run_state"
MCP_STATE = "mcp_state"
MESOS_STATE = "mesos_state"
8 changes: 1 addition & 7 deletions tron/serialize/runstate/statemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from tron.config import schema
from tron.core import job
from tron.core import jobrun
from tron.mesos import MesosClusterRepository
from tron.serialize import runstate
from tron.serialize.runstate.dynamodb_state_store import DynamoDBStateStore
from tron.serialize.runstate.shelvestore import ShelveStateStore
Expand Down Expand Up @@ -289,9 +288,7 @@ def update_from_config(self, state_config):

def handler(self, observable, event, event_data=None):
"""Handle a state change in an observable by saving its state."""
if observable == MesosClusterRepository:
self.save_frameworks(observable)
elif isinstance(observable, job.Job):
if isinstance(observable, job.Job):
if event == job.Job.NOTIFY_NEW_RUN:
if event_data is None or not isinstance(event_data, jobrun.JobRun):
log.warning(f"Notified of new run, but no run to watch. Got {event_data}")
Expand All @@ -315,9 +312,6 @@ def save_job_run(self, job_run):
def delete_job_run(self, job_run):
self.state_manager.delete(runstate.JOB_RUN_STATE, job_run.name)

def save_frameworks(self, clusters):
self._save_object(runstate.MESOS_STATE, clusters)

def save_metadata(self):
self._save_object(runstate.MCP_STATE, StateMetadata())

Expand Down
2 changes: 0 additions & 2 deletions tron/trondaemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import tron
from tron.kubernetes import KubernetesClusterRepository
from tron.manhole import make_manhole
from tron.mesos import MesosClusterRepository
from tron.utils import chdir
from tron.utils import flock
from tron.utils import signals
Expand Down Expand Up @@ -162,7 +161,6 @@ def _handle_shutdown(self, sig_num, stack_frame):
waited += 0.1
if self.mcp:
self.mcp.shutdown()
MesosClusterRepository.shutdown()
KubernetesClusterRepository.shutdown()
raise SystemExit(f"Terminating on signal {str(sig_num)}")

Expand Down

0 comments on commit 1035345

Please sign in to comment.