enable resuming Hub state from database

This commit is contained in:
MinRK
2014-09-21 17:36:01 -07:00
parent 485ddd039c
commit 01323833bb
2 changed files with 192 additions and 54 deletions

View File

@@ -103,7 +103,7 @@ class Spawner(LoggingConfigurable):
state: dict
a JSONable dict of state
"""
return {}
return dict(api_token=self.api_token)
def get_args(self):
"""Return the arguments to be passed after self.cmd"""
@@ -211,10 +211,13 @@ class LocalProcessSpawner(Spawner):
raise ValueError("This should be impossible")
def load_state(self, state):
super(LocalProcessSpawner, self).load_state(state)
self.pid = state['pid']
def get_state(self):
return dict(pid=self.pid)
state = super(LocalProcessSpawner, self).get_state()
state['pid'] = self.pid
return state
def sudo_cmd(self, user):
return ['sudo', '-u', user.name] + self.sudo_args