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

Handling the MTurkUnit with no message data #3629

Merged
merged 2 commits into from
Apr 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion parlai/crowdsourcing/utils/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import pandas as pd

import parlai.utils.logging as logging

# Defining the class only if Mephisto is installed, since it relies on Mephisto
try:
from mephisto.abstractions.databases.local_database import LocalMephistoDB
Expand Down Expand Up @@ -185,5 +187,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