add User.running

as the one true way to check whether a user is running or not

User.running will be True if spawn or stop is pending.
This commit is contained in:
Min RK
2015-02-06 14:46:34 -08:00
parent 1fd139418a
commit b5eda9d785
4 changed files with 17 additions and 8 deletions

View File

@@ -267,6 +267,15 @@ class User(Base):
name=self.name,
)
@property
def running(self):
"""property for whether a user has a running server"""
if self.spawner is None:
return False
if self.server is None:
return False
return True
def new_api_token(self):
"""Create a new API token"""
assert self.id is not None