Esempio n. 1
0
def approve_assignments_for_hit(client: MTurkClient,
                                hit_id: str,
                                override_rejection: bool = False):
    """Approve work for assignments associated with a given hit, through
    mturk client
    """
    assignments = get_assignments_for_hit(client, hit_id)
    for assignment in assignments:
        assignment_id = assignment["AssignmentId"]
        client.approve_assignment(AssignmentId=assignment_id,
                                  OverrideRejection=override_rejection)
Esempio n. 2
0
def approve_work(client: MTurkClient,
                 assignment_id: str,
                 override_rejection: bool = False) -> None:
    """approve work for a given assignment through the mturk client"""
    try:
        client.approve_assignment(AssignmentId=assignment_id,
                                  OverrideRejection=override_rejection)
    except Exception as e:
        logger.exception(
            f"Approving MTurk assignment failed, likely because it has auto-approved. Details: {e}",
            exc_info=True,
        )
Esempio n. 3
0
def approve_work(client: MTurkClient,
                 assignment_id: str,
                 override_rejection: bool = False) -> None:
    """approve work for a given assignment through the mturk client"""
    try:
        client.approve_assignment(AssignmentId=assignment_id,
                                  OverrideRejection=override_rejection)
    except Exception as e:
        # TODO(#93) Break down this error to the many reasons why approve may fail,
        # only silently pass on approving an already approved assignment
        logger.exception(
            f"Approving MTurk assignment failed, likely because it has auto-approved. Details: {e}",
            exc_info=True,
        )