Skip to content

Commit 99a1bb0

Browse files
committed
Add DB check before parsing start command
Signed-off-by: Ulincsys <[email protected]>
1 parent 3548b1a commit 99a1bb0

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

augur/application/cli/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def new_func(ctx, *args, **kwargs):
3232
You are not connected to the internet.\n \
3333
Please connect to the internet to run Augur\n \
3434
Consider setting http_proxy variables for limited access installations.")
35-
sys.exit()
35+
sys.exit(-1)
3636

3737
return update_wrapper(new_func, function_internet_connection)
3838

@@ -78,7 +78,7 @@ def new_func(ctx, *args, **kwargs):
7878
print(f"\n\n{usage} command setup failed\nERROR: connecting to database\nHINT: The {incorrect_values} may be incorrectly specified in {location}\n")
7979

8080
engine.dispose()
81-
sys.exit()
81+
sys.exit(-2)
8282

8383
return update_wrapper(new_func, function_db_connection)
8484

jumpstart/procman.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ def start(self, component: Union[Component, str], client: Client, *options):
4141
client.respond(Status.error(f"Invalid component for start: {component}"))
4242
return
4343

44+
check_db = run("augur db test-connection".split())
45+
46+
if check_db.returncode != 0:
47+
client.respond(Status.error(f"Could not communicate with the database: {check_db.returncode}"))
48+
return
49+
4450
if c in (Component.api, Component.frontend, Component.all):
4551
if self.frontend:
4652
client.respond(Status.information(f"The frontend/api is already running"))

jumpstart/tui.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ def compose(self):
4141
with Vertical(classes="status_container"):
4242
with Horizontal(classes="info_container"):
4343
yield Label("Frontend")
44-
yield Label(id="frontend_label", classes="status_label")
44+
yield Label("X", id="frontend_label", classes="status_label")
4545
with Horizontal(classes="info_container"):
4646
yield Label("API")
47-
yield Label(id="api_label", classes="status_label")
47+
yield Label("X", id="api_label", classes="status_label")
4848
with Horizontal(classes="info_container"):
4949
yield Label("Collection")
50-
yield Label(id="collection_label", classes="status_label")
50+
yield Label("X", id="collection_label", classes="status_label")
5151

52-
yield Button("Status", id="statusbtn")
52+
yield Button("Start", id="startbtn")
53+
yield Button("Stop", id="stopbtn")
5354
yield Button("Exit", variant="error", id="exitbtn")
5455

5556
with Vertical():

jumpstart/tui.tcss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@
3232
dock: right;
3333
width: 2;
3434
background: red;
35+
color: black;
36+
text-align: center;
3537
}
3638

3739
.label_up {
3840
background: green;
41+
color: green;
3942
}
4043

4144
#exitbtn {

0 commit comments

Comments
 (0)