Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions dashboard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from optimization_manager import OptimizationManager
from parameters_manager import ParametersManager
from calibration_manager import SimulationCalibrationManager
from sfapi_manager import initialize_sfapi, load_sfapi_card
from sfapi_manager import load_sfapi_card
from state_manager import server, state, ctrl, initialize_state
from error_manager import error_panel, add_error
from utils import (
Expand Down Expand Up @@ -477,8 +477,6 @@ def gui_setup():
if __name__ == "__main__":
# initialize state variables needed at startup
initialize_state()
# initialize Superfacility API
initialize_sfapi()
# update for the first time
update()
# start server
Expand Down
21 changes: 0 additions & 21 deletions dashboard/sfapi_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from datetime import datetime
import os
from sfapi_client import Client
from sfapi_client.compute import Machine
from trame.widgets import vuetify3 as vuetify
Expand Down Expand Up @@ -36,26 +35,6 @@ def parse_sfapi_key(key_str):
state.sfapi_key = "".join(key_lines)


def initialize_sfapi():
print("Initializing Superfacility API...")
# look for a key file in the current directory
key_path = os.path.join(os.getcwd(), "priv_key.pem")
if os.path.isfile(key_path):
try:
with Client(key=key_path) as client:
# store the whole content of the key file in a string
key_str = client._secret
# store the client ID and key in the respective state variables
parse_sfapi_key(key_str)
# update Superfacility API info
update_sfapi_info()
except Exception as e:
title = "Unable to initialize the Superfacility API connection"
msg = f"Error occurred when initializing the Superfacility API connection: {e}"
add_error(title, msg)
print(msg)


def update_sfapi_info():
print("Updating Superfacility API info...")
try:
Expand Down
Loading