Merge branch 'master' of gitlab.com:rubenvandeven/sorteerhoed

This commit is contained in:
Ruben van de Ven 2019-11-04 08:58:30 +01:00
commit 260c184a36
2 changed files with 7 additions and 3 deletions

View File

@ -166,7 +166,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(