Skip to content

Commit

Permalink
Project-Varuna v1.2 update; Created toggle in script for dev and user…
Browse files Browse the repository at this point in the history
… mode; Pending adding this toggle to GUI
  • Loading branch information
ajinkya-joglekar committed Dec 5, 2024
1 parent d61b271 commit 1599ba8
Showing 1 changed file with 41 additions and 18 deletions.
59 changes: 41 additions & 18 deletions GUI_supporting_pages/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,24 +369,47 @@ def next_page(self):
args_json = json.dumps(self.controller.args_dict)
# Path to the package in parent folder

# Get the parent directory of the current script's directory
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))

# Define the path to the target file in the parent directory
script_path = os.path.join(parent_dir, "koopman")
try:
result = subprocess.run(
[script_path, args_json],
check=True,
capture_output=True,
text=True
)

# Print the output from the target script (or handle it in any way)
print(f"Script output: {result.stdout}")

except subprocess.CalledProcessError as e:
print(f"Error occurred: {e.stderr}")
dev_mode =False
if dev_mode == True:
print('Running app in dev mode: Running koopman.py script')
parent_dir = '/home/krovilab/Project-Varuna-V1_1/Project-Varuna-MMPK-Package'
script_path = os.path.join(parent_dir, "koopman.py")
# If in dev mode, run the Python script with the arguments
try:
result = subprocess.run(
["python3", script_path, "--arg_dict", args_json, "--dev_mode", "True"], # Add 'python' to run the script
check=True,
capture_output=True,
text=True
)

# Print the output from the Python script
print(f"Python script output: {result.stdout}")

except subprocess.CalledProcessError as e:
print(f"Error occurred while running the Python script: {e.stderr}")

else: # Condition for running in user mode
print('Running app as user through binary')
# Get the parent directory of the current script's directory
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))

# Define the path to the target file in the parent directory
script_path = os.path.join(parent_dir, "koopman")

try:
result = subprocess.run(
[script_path, "--arg_dict", args_json],
check=True,
capture_output=True,
text=True
)

# Print the output from the target script (or handle it in any way)
print(f"Script output: {result.stdout}")

except subprocess.CalledProcessError as e:
print(f"Error occurred: {e.stderr}")

def previous_page(self):
self.controller.show_frame("Planning_Controls")
Expand Down

0 comments on commit 1599ba8

Please sign in to comment.