Ejemplo n.º 1
0
    def monitor_registrations():
        max_rate = JBoxDynConfig.get_registration_hourly_rate(
            CloudHost.INSTALL_ID)
        rate = JBoxUserV2.count_created(1)
        reg_allowed = JBoxDynConfig.get_allow_registration(
            CloudHost.INSTALL_ID)
        CloudHost.log_debug(
            "registration allowed: %r, rate: %d, max allowed: %d", reg_allowed,
            rate, max_rate)

        if (reg_allowed and
            (rate > max_rate * 1.1)) or ((not reg_allowed) and
                                         (rate < max_rate * 0.9)):
            reg_allowed = not reg_allowed
            CloudHost.log_info("Changing registration allowed to %r",
                               reg_allowed)
            JBoxDynConfig.set_allow_registration(CloudHost.INSTALL_ID,
                                                 reg_allowed)

        if reg_allowed:
            num_pending_activations = JBoxUserV2.count_pending_activations()
            if num_pending_activations > 0:
                CloudHost.log_info(
                    "scheduling activations for %d pending activations",
                    num_pending_activations)
                JBoxContainer.async_schedule_activations()
Ejemplo n.º 2
0
 def run(self):
     if CloudHost.ENABLED['route53']:
         try:
             CloudHost.deregister_instance_dns()
             CloudHost.log_warn("Prior dns registration was found for the instance")
         except:
             CloudHost.log_debug("No prior dns registration found for the instance")
         CloudHost.register_instance_dns()
     JBoxContainer.publish_container_stats()
     JBox.do_update_user_home_image()
     JBoxContainer.async_refresh_disks()
     self.ct.start()
     self.ioloop.start()
Ejemplo n.º 3
0
 def run(self):
     try:
         CloudHost.deregister_instance_dns()
         CloudHost.log_warn(
             "Prior dns registration was found for the instance")
     except:
         CloudHost.log_debug(
             "No prior dns registration found for the instance")
     CloudHost.register_instance_dns()
     JBoxContainer.publish_container_stats()
     JBox.do_update_user_home_image()
     JBoxContainer.async_refresh_disks()
     self.ct.start()
     self.ioloop.start()
Ejemplo n.º 4
0
    def monitor_registrations():
        max_rate = JBoxDynConfig.get_registration_hourly_rate(CloudHost.INSTALL_ID)
        rate = JBoxUserV2.count_created(1)
        reg_allowed = JBoxDynConfig.get_allow_registration(CloudHost.INSTALL_ID)
        CloudHost.log_debug("registration allowed: %r, rate: %d, max allowed: %d", reg_allowed, rate, max_rate)

        if (reg_allowed and (rate > max_rate*1.1)) or ((not reg_allowed) and (rate < max_rate*0.9)):
            reg_allowed = not reg_allowed
            CloudHost.log_warn("Changing registration allowed to %r", reg_allowed)
            JBoxDynConfig.set_allow_registration(CloudHost.INSTALL_ID, reg_allowed)

        if reg_allowed:
            num_pending_activations = JBoxUserV2.count_pending_activations()
            if num_pending_activations > 0:
                CloudHost.log_info("scheduling activations for %d pending activations", num_pending_activations)
                JBoxContainer.async_schedule_activations()