Skip to content
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

Bugfix/net client addr #58

Merged
merged 3 commits into from
Jan 16, 2024
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
9 changes: 7 additions & 2 deletions agent/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
import docker
import urllib
from docker.models.containers import Container
from docker.types import LogConfig
from dotenv import load_dotenv
Expand Down Expand Up @@ -32,7 +33,7 @@

def parse_envs():
args_req = {
x: constants._VALUES[x] if x in constants._VALUES else os.environ[x]
x: constants._VALUES[x] if x in constants._VALUES else os.environ.get(x, None)
for x in constants.get_required_settings()
}
args_opt = {
Expand Down Expand Up @@ -76,10 +77,14 @@ def _start_net_client(docker_api=None):
net_server_port = constants.NET_SERVER_PORT()
if net_server_port is None:
raise RuntimeError(f"{constants._NET_SERVER_PORT} is not defined")

server_addr_url_obj = urllib.parse.urlparse(f"http://{constants.SERVER_ADDRESS().rstrip('/').lstrip('https://').lstrip('http://')}")
net_server_address = f"{server_addr_url_obj.hostname}:{net_server_port}"

command = [
constants.TOKEN(),
os.path.join(constants.SERVER_ADDRESS(), "net/"),
f"{constants.SERVER_ADDRESS().rstrip('/').lstrip('https://').lstrip('http://')}:{net_server_port}",
net_server_address,
]
envs = [
f"{constants._SLY_NET_CLIENT_PING_INTERVAL}={constants.SLY_NET_CLIENT_PING_INTERVAL()}",
Expand Down
2 changes: 1 addition & 1 deletion agent/worker/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def TOKEN():
_DOCKER_NET: None, # or string value 'supervisely-vpn'
_AGENT_ROOT_DIR: "/sly_agent",
_DISABLE_TELEMETRY: None,
_SUPERVISELY_AGENT_FILES: f"supervisely-agent-files-{TOKEN()[:8]}",
_SUPERVISELY_AGENT_FILES: f"/opt/supervisely/agents/agent-files-{TOKEN()[:8]}",
_SUPERVISELY_AGENT_FILES_CONTAINER: "/app/sly-files",
_OFFLINE_MODE: False,
_DEFAULT_APP_DOCKER_IMAGE: "supervisely/base-py-sdk",
Expand Down
Loading