Exemplo n.º 1
0
 def _handle_timeout(signum, frame):
     config = get_config()
     if not config.ready:
         config.load()
     message = {
         "subject": "Idle Experiment.",
         "body": idle_template.format(
             app_id=config.get("id"), minutes_so_far=round(seconds / 60)
         ),
     }
     log("Reporting problem with idle experiment...")
     admin_notifier(config).send(**message)
Exemplo n.º 2
0
 def __init__(self):
     super(MTurkRecruiter, self).__init__()
     self.config = get_config()
     base_url = get_base_url()
     self.ad_url = "{}/ad?recruiter={}".format(base_url, self.nickname)
     self.notification_url = "{}/mturk-sns-listener".format(base_url)
     self.hit_domain = os.getenv("HOST")
     self.mturkservice = MTurkService(
         aws_access_key_id=self.config.get("aws_access_key_id"),
         aws_secret_access_key=self.config.get("aws_secret_access_key"),
         region_name=self.config.get("aws_region"),
         sandbox=self.config.get("mode") != "live",
     )
     self.notifies_admin = admin_notifier(self.config)
     self.mailer = get_mailer(self.config)
     self._validate_config()