Skip to content

Commit

Permalink
HACK to run both superthin and thin templates
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanw17 committed Feb 25, 2024
1 parent 382b3be commit 5c7d454
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions manager/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def add_frequency_control(self, code):

def on_run_application(self, event):

superthin = False
# Extract app config
application_configuration = event.kwargs.get('data', {})
application_file_path = application_configuration['template']
Expand All @@ -211,6 +212,9 @@ def on_run_application(self, event):
else:
application_folder = application_file_path + '/ros2_humble/'

if not os.path.isfile(application_folder + 'exercise.py'):
superthin = True

# Create executable app
errors = self.linter.evaluate_code(code, exercise_id)
if errors == "":
Expand All @@ -221,9 +225,12 @@ def on_run_application(self, event):
f.close()

shutil.copytree(application_folder, "/workspace/code", dirs_exist_ok=True)
self.application_process = subprocess.Popen(["python3", "/workspace/code/academy.py"], stdout=sys.stdout, stderr=subprocess.STDOUT,
if superthin:
self.application_process = subprocess.Popen(["python3", "/workspace/code/academy.py"], stdout=sys.stdout, stderr=subprocess.STDOUT,
bufsize=1024, universal_newlines=True)
else:
self.application_process = subprocess.Popen(["python3", "/workspace/code/exercise.py"], stdout=sys.stdout, stderr=subprocess.STDOUT,
bufsize=1024, universal_newlines=True)

self.unpause_sim()
else:
print('errors')
Expand Down

0 comments on commit 5c7d454

Please sign in to comment.