-
Notifications
You must be signed in to change notification settings - Fork 43k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP]Feature, configurable network port #6678
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,10 @@ class Config(SystemSettings, arbitrary_types_allowed=True): | |
default=6379, | ||
from_env=lambda: int(v) if (v := os.getenv("REDIS_PORT")) else None, | ||
) | ||
agent_port: int = UserConfigurable( | ||
default=8000, | ||
from_env=lambda: int(v) if (v := os.getenv("AGENT_PORT")) else None, | ||
) | ||
Comment on lines
+118
to
+121
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be in the "Application Settings" section, e.g. on line 55. Also, can you rename |
||
redis_password: str = UserConfigurable("", from_env="REDIS_PASSWORD") | ||
wipe_redis_on_start: bool = UserConfigurable( | ||
default=True, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/sh | ||
|
||
kill $(lsof -t -i :8000) | ||
kill $(lsof -t -i :${AGENT_PORT:-8080}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
if [ ! -f .env ] && [ -z "$OPENAI_API_KEY" ]; then | ||
cp .env.example .env | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AGBenchmark reads AutoGPT/benchmark/agbenchmark/__main__.py Lines 191 to 193 in 25cc6ad
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -303,8 +303,11 @@ def stop(): | |||||
import signal | ||||||
import subprocess | ||||||
|
||||||
port = os.getenv('PORT', 8000) | ||||||
agent_port = os.getenv('AGENT_PORT', 8080) | ||||||
|
||||||
try: | ||||||
pids = subprocess.check_output(["lsof", "-t", "-i", ":8000"]).split() | ||||||
pids = subprocess.check_output(["lsof", "-t", "-i", ":"+str(agent_port)]).split() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if isinstance(pids, int): | ||||||
os.kill(int(pids), signal.SIGTERM) | ||||||
else: | ||||||
|
@@ -314,7 +317,7 @@ def stop(): | |||||
click.echo("No process is running on port 8000") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
try: | ||||||
pids = int(subprocess.check_output(["lsof", "-t", "-i", ":8080"])) | ||||||
pids = int(subprocess.check_output(["lsof", "-t", "-i", ":"+str(port)])) | ||||||
if isinstance(pids, int): | ||||||
os.kill(int(pids), signal.SIGTERM) | ||||||
else: | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
python3 cli.py "$@" | ||
set -a | ||
source .env | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For most users, |
||
set +a | ||
python3 cli.py "$@" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not match the config attribute created in config.py