Skip to content

Commit b5122b4

Browse files
committed
ref(scheduler): move public method to top of k8s class and private methods grouped by resource type
1 parent 97e62c0 commit b5122b4

4 files changed

Lines changed: 281 additions & 270 deletions

File tree

rootfs/scheduler/__init__.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1 @@
1-
2-
class AbstractSchedulerClient(object):
3-
"""
4-
A generic interface to a scheduler backend.
5-
"""
6-
7-
def __init__(self, target, auth, options):
8-
self.target = target
9-
self.auth = auth
10-
self.options = options
11-
12-
def create(self, name, image, command, **kwargs):
13-
"""Create a new container."""
14-
raise NotImplementedError
15-
16-
def destroy(self, name):
17-
"""Destroy a container."""
18-
raise NotImplementedError
19-
20-
def run(self, name, image, entrypoint, command):
21-
"""Run a one-off command."""
22-
raise NotImplementedError
23-
24-
def start(self, name):
25-
"""Start a container."""
26-
raise NotImplementedError
27-
28-
def state(self, name):
29-
"""Display the given job's running state."""
30-
raise NotImplementedError
31-
32-
def stop(self, name):
33-
"""Stop a container."""
34-
raise NotImplementedError
1+
from .abstract import AbstractSchedulerClient # noqa

rootfs/scheduler/abstract.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
class AbstractSchedulerClient(object):
3+
"""
4+
A generic interface to a scheduler backend.
5+
"""
6+
7+
def __init__(self, target, auth, options):
8+
self.target = target
9+
self.auth = auth
10+
self.options = options
11+
12+
def create(self, name, image, command, **kwargs):
13+
"""Create a new container."""
14+
raise NotImplementedError
15+
16+
def destroy(self, name):
17+
"""Destroy a container."""
18+
raise NotImplementedError
19+
20+
def run(self, name, image, entrypoint, command):
21+
"""Run a one-off command."""
22+
raise NotImplementedError
23+
24+
def start(self, name):
25+
"""Start a container."""
26+
raise NotImplementedError
27+
28+
def state(self, name):
29+
"""Display the given job's running state."""
30+
raise NotImplementedError
31+
32+
def stop(self, name):
33+
"""Stop a container."""
34+
raise NotImplementedError

0 commit comments

Comments
 (0)