Handle model evaluations staled
Browse files
app.py
CHANGED
|
@@ -178,15 +178,30 @@ with tab1:
|
|
| 178 |
# Evaluate the models queued
|
| 179 |
if model_predictions_rows:
|
| 180 |
models_to_be_evaluated = []
|
| 181 |
-
|
| 182 |
|
| 183 |
for row in model_predictions_rows:
|
| 184 |
if row["status"] == "queued":
|
| 185 |
models_to_be_evaluated.append(row)
|
| 186 |
elif row["status"] == "in_progress":
|
| 187 |
-
|
| 188 |
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
for row in models_to_be_evaluated:
|
| 191 |
# Evaluate the model
|
| 192 |
subprocess.Popen(
|
|
|
|
| 178 |
# Evaluate the models queued
|
| 179 |
if model_predictions_rows:
|
| 180 |
models_to_be_evaluated = []
|
| 181 |
+
models_in_progress = []
|
| 182 |
|
| 183 |
for row in model_predictions_rows:
|
| 184 |
if row["status"] == "queued":
|
| 185 |
models_to_be_evaluated.append(row)
|
| 186 |
elif row["status"] == "in_progress":
|
| 187 |
+
models_in_progress.append(row)
|
| 188 |
|
| 189 |
+
for model in models_in_progress:
|
| 190 |
+
# Check if the evaluation is staled for more than a day!
|
| 191 |
+
timestamp = model["last_updated_timestamp"]
|
| 192 |
+
if utils.current_seconds_time() - timestamp > 86400:
|
| 193 |
+
utils.update_model_queue(
|
| 194 |
+
repo_id=os.environ["PREDICTIONS_DATASET_NAME"],
|
| 195 |
+
model_name=model["model_name"],
|
| 196 |
+
commit_id=model["commit_id"],
|
| 197 |
+
inference_function=model["inference_function"],
|
| 198 |
+
status="queued",
|
| 199 |
+
)
|
| 200 |
+
print(f"Model {model['model_name']} is staled for more than a day.")
|
| 201 |
+
models_to_be_evaluated.append(model)
|
| 202 |
+
models_in_progress.remove(model)
|
| 203 |
+
|
| 204 |
+
if models_in_progress == []:
|
| 205 |
for row in models_to_be_evaluated:
|
| 206 |
# Evaluate the model
|
| 207 |
subprocess.Popen(
|