-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into nightly
- Loading branch information
Showing
8 changed files
with
156 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
from ..jobs import BaseJobRunner | ||
from ..types import Config | ||
|
||
|
||
def unimplemented_docker_compose(root: str, config: Config, *command: str) -> int: | ||
raise NotImplementedError | ||
class Context: | ||
""" | ||
Context object that is passed to all subcommands. | ||
The project `root` is passed to all subcommands of `tutor`; that's because | ||
it is defined as an argument of the top-level command. For instance: | ||
tutor --root=... local run ... | ||
""" | ||
|
||
# pylint: disable=too-few-public-methods | ||
class Context: | ||
def __init__(self, root: str) -> None: | ||
self.root = root | ||
self.docker_compose_func = unimplemented_docker_compose | ||
|
||
def docker_compose(self, root: str, config: Config, *command: str) -> int: | ||
return self.docker_compose_func(root, config, *command) | ||
|
||
class BaseJobContext(Context): | ||
""" | ||
Specialized context that subcommands may use. | ||
For instance `dev`, `local` and `k8s` define custom runners to run jobs. | ||
""" | ||
|
||
def job_runner(self, config: Config) -> BaseJobRunner: | ||
""" | ||
Return a runner capable of running docker-compose/kubectl commands. | ||
""" | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.