File tree 6 files changed +19
-14
lines changed
6 files changed +19
-14
lines changed Original file line number Diff line number Diff line change 3
3
from app .main import app
4
4
5
5
pretty_errors .configure (
6
- separator_character = '*' ,
7
- filename_display = pretty_errors .FILENAME_EXTENDED ,
8
- line_number_first = True ,
9
- display_link = True ,
10
- lines_before = 5 ,
11
- lines_after = 2 ,
12
- line_color = pretty_errors .RED + '> ' + pretty_errors .default_config .line_color ,
13
- code_color = ' ' + pretty_errors .default_config .line_color ,
14
- truncate_code = True ,
15
- display_locals = True
6
+ separator_character = '*' ,
7
+ filename_display = pretty_errors .FILENAME_EXTENDED ,
8
+ line_number_first = True ,
9
+ display_link = True ,
10
+ lines_before = 5 ,
11
+ lines_after = 2 ,
12
+ line_color = pretty_errors .RED + '> ' + pretty_errors .default_config .line_color ,
13
+ code_color = ' ' + pretty_errors .default_config .line_color ,
14
+ truncate_code = True ,
15
+ display_locals = True
16
16
)
17
17
pretty_errors .blacklist ('c:/python' )
Original file line number Diff line number Diff line change 3
3
from pydantic import BaseSettings
4
4
from pathlib import Path
5
5
6
+
6
7
class Settings (BaseSettings ):
7
8
8
9
output_file_path : Path = Path ("logs.txt" )
@@ -25,4 +26,3 @@ class Settings(BaseSettings):
25
26
config = Settings ()
26
27
if config .on_brain is True :
27
28
config .robot_env ["PYTHONPATH" ] = config .robot_path
28
-
Original file line number Diff line number Diff line change 14
14
app .include_router (routers .runner_router )
15
15
app .include_router (routers .upload_router )
16
16
17
+
17
18
@app .get ("/" )
18
19
def root ():
19
20
return "Root of shepherd-2"
20
21
22
+
21
23
@app .on_event ("shutdown" )
22
24
def shutdown_event ():
23
25
"""Make sure that we kill any running usercode
@@ -27,4 +29,4 @@ def shutdown_event():
27
29
28
30
29
31
if __name__ == '__main__' :
30
- uvicorn .run (app , port = 8080 , host = '0.0.0.0' )
32
+ uvicorn .run (app , port = 8080 , host = '0.0.0.0' )
Original file line number Diff line number Diff line change @@ -52,4 +52,3 @@ def upload_file(file: UploadFile):
52
52
"filename" : file .filename ,
53
53
"filesize" : len (file )
54
54
}
55
-
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ def _enter_ready_state(self) -> None:
53
53
54
54
def _enter_running_state (self ) -> None :
55
55
"""Send start signal to usercode"""
56
- pass # TODO:
56
+ pass # TODO:
57
57
58
58
def _enter_stopped_state (self ) -> None :
59
59
"""Reap the users code"""
@@ -135,4 +135,5 @@ def _run_watchdog(self) -> None:
135
135
self .next_state = States .STOPPED
136
136
self .new_state_event .set ()
137
137
138
+
138
139
runner = Runner ()
Original file line number Diff line number Diff line change 7
7
8
8
client = TestClient (app )
9
9
10
+
10
11
@pytest .mark .timeout (STATE_TRANS_TIMEOUT )
11
12
def test_inital_state ():
12
13
"""The server is ready to run code within STATE_TRANS_TIMEOUT seconds of starting"""
13
14
while (response := client .get ("/state" )).json () != "Ready" :
14
15
pass
15
16
assert response .status_code == 200
16
17
18
+
17
19
@pytest .mark .timeout (STATE_TRANS_TIMEOUT )
18
20
def test_start ():
19
21
"""Code can be started"""
@@ -22,6 +24,7 @@ def test_start():
22
24
pass
23
25
assert response .status_code == 200
24
26
27
+
25
28
@pytest .mark .timeout (STATE_TRANS_TIMEOUT )
26
29
def test_stop ():
27
30
"""Code can be stopped within STATE_TRANS_TIMEOUT seconds of it commanding to be stopped"""
You can’t perform that action at this time.
0 commit comments