Skip to content

Commit 8209e21

Browse files
committed
Remove redundant function initialize_sfapi
1 parent c227338 commit 8209e21

2 files changed

Lines changed: 1 addition & 24 deletions

File tree

dashboard/app.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from optimization_manager import OptimizationManager
1212
from parameters_manager import ParametersManager
1313
from calibration_manager import SimulationCalibrationManager
14-
from sfapi_manager import initialize_sfapi, load_sfapi_card
14+
from sfapi_manager import load_sfapi_card
1515
from state_manager import server, state, ctrl, initialize_state
1616
from error_manager import error_panel, add_error
1717
from utils import (
@@ -477,8 +477,6 @@ def gui_setup():
477477
if __name__ == "__main__":
478478
# initialize state variables needed at startup
479479
initialize_state()
480-
# initialize Superfacility API
481-
initialize_sfapi()
482480
# update for the first time
483481
update()
484482
# start server

dashboard/sfapi_manager.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from datetime import datetime
2-
import os
32
from sfapi_client import Client
43
from sfapi_client.compute import Machine
54
from trame.widgets import vuetify3 as vuetify
@@ -36,26 +35,6 @@ def parse_sfapi_key(key_str):
3635
state.sfapi_key = "".join(key_lines)
3736

3837

39-
def initialize_sfapi():
40-
print("Initializing Superfacility API...")
41-
# look for a key file in the current directory
42-
key_path = os.path.join(os.getcwd(), "priv_key.pem")
43-
if os.path.isfile(key_path):
44-
try:
45-
with Client(key=key_path) as client:
46-
# store the whole content of the key file in a string
47-
key_str = client._secret
48-
# store the client ID and key in the respective state variables
49-
parse_sfapi_key(key_str)
50-
# update Superfacility API info
51-
update_sfapi_info()
52-
except Exception as e:
53-
title = "Unable to initialize the Superfacility API connection"
54-
msg = f"Error occurred when initializing the Superfacility API connection: {e}"
55-
add_error(title, msg)
56-
print(msg)
57-
58-
5938
def update_sfapi_info():
6039
print("Updating Superfacility API info...")
6140
try:

0 commit comments

Comments
 (0)