Different minimums for HIT and catch exception on delete
This commit is contained in:
parent
310d23006b
commit
7824fdae8c
2 changed files with 7 additions and 3 deletions
|
@ -162,7 +162,7 @@ class Store:
|
||||||
return self.getAvgDurationOfPreviousNHits(5)
|
return self.getAvgDurationOfPreviousNHits(5)
|
||||||
|
|
||||||
def getHitTimeout(self):
|
def getHitTimeout(self):
|
||||||
return max(300, self.getAvgDurationOfPreviousNHits(5)*2)
|
return max(200, self.getAvgDurationOfPreviousNHits(5)*2)
|
||||||
|
|
||||||
def getHITs(self, n = 100):
|
def getHITs(self, n = 100):
|
||||||
return self.session.query(HIT).\
|
return self.session.query(HIT).\
|
||||||
|
|
|
@ -131,7 +131,11 @@ class CentralManagement():
|
||||||
HITId=self.currentHit.hit_id,
|
HITId=self.currentHit.hit_id,
|
||||||
ExpireAt=datetime.datetime.fromisoformat('2015-01-01')
|
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):
|
def eventListener(self):
|
||||||
while self.isRunning.is_set():
|
while self.isRunning.is_set():
|
||||||
try:
|
try:
|
||||||
|
@ -276,7 +280,7 @@ class CentralManagement():
|
||||||
question = open(self.config['amazon']['task_xml'], mode='r').read().replace("{HIT_NR}",str(self.currentHit.id))
|
question = open(self.config['amazon']['task_xml'], mode='r').read().replace("{HIT_NR}",str(self.currentHit.id))
|
||||||
estimatedHitDuration = self.store.getEstimatedHitDuration()
|
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.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']}")
|
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(
|
new_hit = self.mturk.create_hit(
|
||||||
|
|
Loading…
Reference in a new issue