-
Notifications
You must be signed in to change notification settings - Fork 92
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
HiTL Dashboard - View and Update Model Checksum #1301
base: hitl_dashboard_model_viz
Are you sure you want to change the base?
Changes from all commits
a0afc34
721b0cd
df6d6c2
fcefb35
9cb7cdc
77d7a79
c3a9e07
fd91113
54c3573
4a7f707
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 |
---|---|---|
@@ -1 +1 @@ | ||
0c6b0070ca1f30b1420c4db9259789c2d6442a3a | ||
da39a3ee5e6b4b0d3255bfef95601890afd80709 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
b15b887d3795140a5fab42a68d7369fcebf28e8c | ||
da39a3ee5e6b4b0d3255bfef95601890afd80709 | ||
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. Same comment as above. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ | |
""" | ||
|
||
|
||
import argparse | ||
from enum import Enum | ||
import json | ||
from droidlet.tools.artifact_scripts.compute_checksum import compute_checksum_for_directory | ||
from droidlet.tools.hitl.dashboard_app.backend.dashboard_aws_helper import ( | ||
get_dataset_by_name, | ||
get_dataset_indices_by_id, | ||
|
@@ -22,6 +22,7 @@ | |
from droidlet.tools.hitl.dashboard_app.backend.dashboard_model_utils import ( | ||
get_complete_model, | ||
get_keys, | ||
get_model_checksum_by_name_n_agent, | ||
get_value_by_key, | ||
) | ||
from flask import Flask, abort | ||
|
@@ -49,6 +50,9 @@ class DASHBOARD_EVENT(Enum): | |
GET_MODEL_KEYS = "get_model_keys_by_id" | ||
GET_MODEL_VALUE = "get_model_value_by_id_n_key" | ||
|
||
GET_MODEL_CHECKSUM = "get_model_checksum_by_name_n_agent" | ||
UPDATE_MODEL_CHECKSUM = "update_model_checksum_by_name_n_agent" | ||
|
||
|
||
# constants for model related apis | ||
KEY_COMPLETE = "complete_model" | ||
|
@@ -225,5 +229,48 @@ def get_model_value(batch_id, key): | |
emit(DASHBOARD_EVENT.GET_MODEL_VALUE.value, [key, get_value_by_key(model, key)]) | ||
|
||
|
||
@socketio.on(DASHBOARD_EVENT.GET_MODEL_CHECKSUM.value) | ||
def get_model_checksum(model_name, agent): | ||
""" | ||
get the checksum for a specific model and agent | ||
- input: | ||
- model name | ||
- agent name | ||
- the valid combinations for model name and agent are: | ||
- nlu | ||
- perception locobot | ||
- perception craftassist | ||
- output: the checksum if model and agent combination are valid, and if checksum has been computed; otherwise error code | ||
""" | ||
print( | ||
f"Request received: {DASHBOARD_EVENT.GET_MODEL_CHECKSUM.value}, model = {model_name}, agent = {agent}" | ||
) | ||
checksum, error_code = get_model_checksum_by_name_n_agent(model_name, agent) | ||
if error_code: | ||
emit(DASHBOARD_EVENT.GET_MODEL_CHECKSUM.value, [model_name, agent, error_code]) | ||
else: | ||
emit(DASHBOARD_EVENT.GET_MODEL_CHECKSUM.value, [model_name, agent, checksum]) | ||
|
||
|
||
@socketio.on(DASHBOARD_EVENT.UPDATE_MODEL_CHECKSUM.value) | ||
def update_model_checksum(model_name, agent): | ||
""" | ||
update the checksum for a specific model and agent | ||
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. I think we need to be really clear what this does, both in this comment as well as maybe some text description shown to the user. "Update checksum" implies to me that we're updating it to a value we specify. This computes the checksum based on the artifacts currently in place on your branch, and then pushes that checksum to the tracked file. |
||
- input: | ||
- model name | ||
- agent name | ||
- the valid combinations for model name and agent are: | ||
- nlu | ||
- perception locobot | ||
- perception craftassist | ||
- output: an success code if update success | ||
""" | ||
print( | ||
f"Request received: {DASHBOARD_EVENT.UPDATE_MODEL_CHECKSUM.value}, model = {model_name}, agent = {agent}" | ||
) | ||
compute_checksum_for_directory(agent, "models", model_name) | ||
emit(DASHBOARD_EVENT.UPDATE_MODEL_CHECKSUM.value, 200) | ||
|
||
|
||
if __name__ == "__main__": | ||
socketio.run(app) |
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.
Is this supposed to be checked in? We should only update the tracked checksums if there's an update to the associated artifacts.