-
Notifications
You must be signed in to change notification settings - Fork 78
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
Clean Chains Stack Traces and consolidate logging config. Fixes BT-13465 BT-13378 #1353
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 |
---|---|---|
|
@@ -221,11 +221,10 @@ def push( | |
class DockerChainletService(b10_service.TrussService): | ||
"""This service is for Chainlets (not for Chains).""" | ||
|
||
def __init__(self, port: int, is_draft: bool, **kwargs): | ||
def __init__(self, port: int, **kwargs): | ||
remote_url = f"http://localhost:{port}" | ||
self._port = port | ||
|
||
super().__init__(remote_url, is_draft, **kwargs) | ||
super().__init__(remote_url, is_draft=False, **kwargs) | ||
|
||
def authenticate(self) -> Dict[str, str]: | ||
return {} | ||
|
@@ -246,10 +245,6 @@ def is_ready(self) -> bool: | |
def logs_url(self) -> str: | ||
raise NotImplementedError() | ||
|
||
@property | ||
def port(self) -> int: | ||
return self._port | ||
|
||
@property | ||
def predict_url(self) -> str: | ||
return f"{self._service_url}/v1/models/model:predict" | ||
|
@@ -272,6 +267,7 @@ def _push_service_docker( | |
wait_for_server_ready=True, | ||
network="host", | ||
container_name_prefix=chainlet_display_name, | ||
disable_json_logging=True, | ||
) | ||
|
||
|
||
|
@@ -309,12 +305,13 @@ def _create_docker_chain( | |
entrypoint_artifact: b10_types.ChainletArtifact, | ||
dependency_artifacts: list[b10_types.ChainletArtifact], | ||
) -> DockerChainService: | ||
chainlet_artifacts = [entrypoint_artifact, *dependency_artifacts] | ||
chainlet_artifacts = [*dependency_artifacts, entrypoint_artifact] | ||
chainlet_to_predict_url: Dict[str, Dict[str, str]] = {} | ||
chainlet_to_service: Dict[str, DockerChainletService] = {} | ||
for chainlet_artifact in chainlet_artifacts: | ||
port = utils.get_free_port() | ||
service = DockerChainletService(is_draft=True, port=port) | ||
service = DockerChainletService(port) | ||
|
||
docker_internal_url = service.predict_url.replace( | ||
"localhost", "host.docker.internal" | ||
) | ||
|
@@ -323,27 +320,16 @@ def _create_docker_chain( | |
} | ||
chainlet_to_service[chainlet_artifact.name] = service | ||
|
||
local_config_handler.LocalConfigHandler.set_dynamic_config( | ||
definitions.DYNAMIC_CHAINLET_CONFIG_KEY, json.dumps(chainlet_to_predict_url) | ||
) | ||
local_config_handler.LocalConfigHandler.set_dynamic_config( | ||
definitions.DYNAMIC_CHAINLET_CONFIG_KEY, json.dumps(chainlet_to_predict_url) | ||
) | ||
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. Interesting, this doesn't have to have all the predict URLs of dependencies populated before mounting and running? I noticed you put 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. Chains are always DAGs by construction and That's also how it worked before we had dynamic config map, because then all URLs were directly baked into the generated truss config. |
||
|
||
# TODO(Tyron): We run the Docker containers in a | ||
# separate for-loop to make sure that the dynamic | ||
# config is populated (the same one gets mounted | ||
# on all the containers). We should look into | ||
# consolidating the logic into a single for-loop. | ||
# One approach might be to use separate config | ||
# paths for each container under the `/tmp` dir. | ||
for chainlet_artifact in chainlet_artifacts: | ||
truss_dir = chainlet_artifact.truss_dir | ||
logging.info( | ||
f"Building Chainlet `{chainlet_artifact.display_name}` docker image." | ||
) | ||
_push_service_docker( | ||
truss_dir, | ||
chainlet_artifact.display_name, | ||
docker_options, | ||
chainlet_to_service[chainlet_artifact.name].port, | ||
truss_dir, chainlet_artifact.display_name, docker_options, port | ||
) | ||
logging.info( | ||
f"Pushed Chainlet `{chainlet_artifact.display_name}` as docker container." | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import os | ||
|
||
from shared.logging import setup_logging | ||
from truss_server import TrussServer | ||
|
||
CONFIG_FILE = "config.yaml" | ||
|
||
if __name__ == "__main__": | ||
setup_logging() | ||
http_port = int(os.environ.get("INFERENCE_SERVER_PORT", "8080")) | ||
TrussServer(http_port, CONFIG_FILE).start() |
This file was deleted.
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.
did you intend to leave these in?
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.
Yeas, that's in the integration test chain, I like to have this around when debugging/changing anything.
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.
sounds good