-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmock.py
More file actions
41 lines (32 loc) · 894 Bytes
/
mock.py
File metadata and controls
41 lines (32 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from cStringIO import StringIO
class MockSchedulerClient(object):
def __init__(self, name, hosts, auth):
self.name = name
self.hosts = hosts
self.auth = auth
def create(self, name, image, command, resources={}, constraints={}):
"""
Create a new job
"""
return {'state': 'inactive'}
def start(self, name):
"""
Start an idle job
"""
return {'state': 'active'}
def stop(self, name):
"""
Stop a running job
"""
return {'state': 'inactive'}
def destroy(self, name):
"""
Destroy an existing job
"""
return {'state': 'inactive'}
def attach(self, name):
"""
Attach to a job's stdin, stdout and stderr
"""
return StringIO(), StringIO(), StringIO()
SchedulerClient = MockSchedulerClient