Skip to content

Commit

Permalink
wait for port
Browse files Browse the repository at this point in the history
  • Loading branch information
carneiro-cw committed Dec 2, 2024
1 parent 06c27b2 commit ee505f8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion utils/benchmark_rocks_config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,18 @@ def run_stratus():
)
print("Started stratus")
# Give it some time to start up
time.sleep(10)
print("Waiting for stratus to start...")
port_open = False
while not port_open:
try:
result = subprocess.run(["lsof", "-i", ":3000"], capture_output=True, text=True)

Check warning on line 42 in utils/benchmark_rocks_config/main.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

utils/benchmark_rocks_config/main.py#L42

Starting a process with a partial executable path

Check warning on line 42 in utils/benchmark_rocks_config/main.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

utils/benchmark_rocks_config/main.py#L42

subprocess call - check for execution of untrusted input.
if result.stdout:
port_open = True
else:
time.sleep(1)

Check failure on line 46 in utils/benchmark_rocks_config/main.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

utils/benchmark_rocks_config/main.py#L46

time.sleep() call; did you mean to leave this in?
except subprocess.CalledProcessError:
time.sleep(1)
print("Port 3000 is now in use, stratus has started")
return process

def start_benchmark():
Expand Down

0 comments on commit ee505f8

Please sign in to comment.