Different minimums for HIT and catch exception on delete

This commit is contained in:
mt 2019-11-03 16:26:08 +01:00
parent 310d23006b
commit 7824fdae8c
2 changed files with 7 additions and 3 deletions

View file

@ -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).\

View file

@ -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(