-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathmocks.py
More file actions
75 lines (57 loc) · 2.16 KB
/
mocks.py
File metadata and controls
75 lines (57 loc) · 2.16 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from typing import Dict, List
from jupyter_scheduler.environments import EnvironmentManager
from jupyter_scheduler.executors import ExecutionManager
from jupyter_scheduler.models import JobFeature, RuntimeEnvironment, UpdateJobDefinition
from jupyter_scheduler.task_runner import BaseTaskRunner
class MockExecutionManager(ExecutionManager):
def __init__(self, job_id: str, staging_paths: Dict[str, str], root_dir: str, db_url: str):
pass
def execute(self):
pass
def process(self):
pass
def supported_features(self) -> Dict[JobFeature, bool]:
return {
JobFeature.job_name: True,
JobFeature.output_formats: True,
JobFeature.job_definition: False,
}
class MockEnvironmentManager(EnvironmentManager):
def list_environments(self) -> List[RuntimeEnvironment]:
file_extensions = ["ipynb"]
output_formats = ["ipynb", "html"]
return [
RuntimeEnvironment(
name="env_a",
label="env_a",
description="/opt/anaconda3/envs/a",
file_extensions=file_extensions,
output_formats=output_formats,
),
RuntimeEnvironment(
name="env_b",
label="env_a",
description="/opt/anaconda3/envs/b",
file_extensions=file_extensions,
output_formats=output_formats,
),
]
def manage_environments_command(self) -> str:
return "command_a"
def output_formats_mapping(self) -> Dict[str, str]:
return {"ipynb": "Notebook", "html": "HTML"}
class MockTaskRunner(BaseTaskRunner):
def __init__(self, config=None, **kwargs):
super().__init__(config=config)
async def start(self):
pass
def add_job_definition(self, job_definition_id: str):
pass
def update_job_definition(self, job_definition_id: str, model: UpdateJobDefinition):
pass
def delete_job_definition(self, job_definition_id: str):
pass
def pause_jobs(self, job_definition_id: str):
pass
def resume_jobs(self, job_definition_id: str):
pass