Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Catching the index error for unit with no message data
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-komeili committed Apr 28, 2021
1 parent 2f0e387 commit 58052c4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion parlai/crowdsourcing/utils/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from __future__ import annotations

import argparse
import logging
import os
from abc import ABC, abstractmethod
from datetime import datetime
Expand Down Expand Up @@ -185,5 +186,11 @@ def get_units_data(self, task_units: List[Unit]) -> List[dict]:
data_browser = self.get_mephisto_data_browser()
task_data = []
for unit in task_units:
task_data.append(data_browser.get_data_from_unit(unit))
try:
unit_data = data_browser.get_data_from_unit(unit)
task_data.append(unit_data)
except IndexError:
logging.warning(
f"Skipping unit {unit.db_id}. No message found for this unit."
)
return task_data

0 comments on commit 58052c4

Please sign in to comment.