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

adding container to update models on a schedule #46

Merged
merged 22 commits into from
Oct 5, 2023
Merged

Conversation

blaise-muhirwa
Copy link
Contributor

@blaise-muhirwa blaise-muhirwa commented Oct 3, 2023

Adds a container in the edge deployment that specifically takes care of updating models (every 2 minutes by default).

@@ -13,7 +13,7 @@
from model import Detector

from app.core.utils import safe_call_api

from .utils import load_edge_config
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to utils so that the new Dockerfile for model updating won't have to add all sorts of dependencies from edge_inference.py that it does not need, such as the kubernetes client, groundlight, etc.

@blaise-muhirwa blaise-muhirwa marked this pull request as ready for review October 4, 2023 18:20

logger.warning("EDGE_CONFIG environment variable not set. Checking default locations.")

default_paths = [DEFAULT_EDGE_CONFIG_PATH, "configs/edge-config.yaml"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need configs/edge-config.yaml still?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason looks like DEFAULT_EDGE_CONFIG_PATH wasn't being recognized. Will look into this closely separately from this PR.

if __name__ == "__main__":
while True:
update_models()
time.sleep(3600)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make this number configurable (via the edge_config file for example) and set the default small, maybe like every 2 minutes (its very cheap to check for a new model).

Copy link
Member

@tyler-romero tyler-romero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Just repeating my slack comment here)

One question that comes to mind is - do we need a separate dockerfile and image for the model-updater at all?

We already need to download the edge-endpoint image onto the edge device, so if it has the model updating code then we could just run the same image w/ a different entrypoint or command.

This is something we do in zuuul, for example. Same image for janzu and the celery pods, but different commands.

Dockerfile Outdated
@@ -55,6 +55,9 @@ RUN mkdir /etc/groundlight/edge-config && \
# Copy configs
COPY configs ${APP_ROOT}/configs

# Copy model updating code
COPY model_updater ${APP_ROOT}/model_updater
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it makes sense to have model_updater here, and app installed only in the production image, since model_updater depends on app being present. We should probably relocate this below the COPY /app line

inference_config = edge_inference_manager.inference_config

try:
# All detectors should have the same refresh rate.
Copy link
Member

@tyler-romero tyler-romero Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should throw an error (or at least log a warning) if they dont, rather than silently ignore all except for the first

Copy link
Member

@tyler-romero tyler-romero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM!

@blaise-muhirwa blaise-muhirwa merged commit 9e32f1f into main Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants