From 7824fdae8cfb92e255df7a40e58141051e454c4a Mon Sep 17 00:00:00 2001 From: mt Date: Sun, 3 Nov 2019 16:26:08 +0100 Subject: [PATCH] Different minimums for HIT and catch exception on delete --- sorteerhoed/HITStore.py | 2 +- sorteerhoed/central_management.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sorteerhoed/HITStore.py b/sorteerhoed/HITStore.py index 986e7d1..ea5e83e 100644 --- a/sorteerhoed/HITStore.py +++ b/sorteerhoed/HITStore.py @@ -162,7 +162,7 @@ class Store: return self.getAvgDurationOfPreviousNHits(5) def getHitTimeout(self): - return max(300, self.getAvgDurationOfPreviousNHits(5)*2) + return max(200, self.getAvgDurationOfPreviousNHits(5)*2) def getHITs(self, n = 100): return self.session.query(HIT).\ diff --git a/sorteerhoed/central_management.py b/sorteerhoed/central_management.py index 14e30bc..64f2e58 100644 --- a/sorteerhoed/central_management.py +++ b/sorteerhoed/central_management.py @@ -131,7 +131,11 @@ class CentralManagement(): HITId=self.currentHit.hit_id, ExpireAt=datetime.datetime.fromisoformat('2015-01-01') ) - self.mturk.delete_hit(HITId=self.currentHit.hit_id) + try: + self.mturk.delete_hit(HITId=self.currentHit.hit_id) + except Exception as e: + self.logger.exception(e) + def eventListener(self): while self.isRunning.is_set(): try: @@ -276,7 +280,7 @@ class CentralManagement(): question = open(self.config['amazon']['task_xml'], mode='r').read().replace("{HIT_NR}",str(self.currentHit.id)) estimatedHitDuration = self.store.getEstimatedHitDuration() - fee = max(.2, (self.config['hour_rate_aim']/3600.) * estimatedHitDuration) + fee = max(.25, (self.config['hour_rate_aim']/3600.) * estimatedHitDuration) self.currentHit.fee = fee self.logger.info(f"Based on average duration of {estimatedHitDuration} fee should be {fee}/hit to get hourly rate of {self.config['hour_rate_aim']}") new_hit = self.mturk.create_hit(