Exemplo n.º 1
0
 def inDeploymentInterval(self):
     # TODO: a quick action is not only an action with nothing to upload
     if not self.deployment_intervals:  # no interval given => always perform
         result = True
     else:
         result = LaunchTimeResolver().in_deployment_interval(
             self.deployment_intervals, datetime.datetime.today())
     if not result:
         logging.getLogger().debug("inDeploymentInterval(#%s): %s" %
                                   (self.id, result))
     return result
Exemplo n.º 2
0
    def switch_phase_failed(self, decrement=True):
        """
        Toggles phase to failed.

        @param decrement: decrements the number of failed attempts
        @type decrement: bool
        """
        ltr = LaunchTimeResolver(start_date=self.coh.start_date,
                                 end_date=self.coh.end_date,
                                 attempts_failed=self.coh.attempts_failed,
                                 attempts_left=self.coh.attempts_left,
                                 max_wol_time=self.config.max_wol_time,
                                 deployment_intervals=self.cmd.deployment_intervals,
                                 now=time.time()
                                 )

        self.coh.reSchedule(ltr.get_launch_date(), decrement)
        
        self.phase.switch_to_failed()
        if self.coh.is_out_of_attempts():
            logging.getLogger().info("Circuit #%s: failed" % (self.coh.id))
            self.coh.setStateFailed()
            return DIRECTIVE.KILLED
        return self.failed() 
Exemplo n.º 3
0
    def switch_phase_failed(self):
        """
        Toggles phase to failed.

        @return: command directive
        @rtype: DIRECTIVE
        """
        ltr = LaunchTimeResolver(start_date=self.coh.start_date,
                                 end_date=self.coh.end_date,
                                 attempts_failed=self.coh.attempts_failed,
                                 attempts_left=self.coh.attempts_left,
                                 max_wol_time=self.config.max_wol_time,
                                 deployment_intervals=self.cmd.deployment_intervals,
                                 now=time.time()
                                 )

        self.coh.reSchedule(ltr.get_launch_date(), True)

        self.phase.switch_to_failed()
        if self.coh.is_out_of_attempts():
            logging.getLogger().info("Circuit #%s: failed" % (self.coh.id))
            self.coh.setStateFailed()
            return DIRECTIVE.KILLED
        return self.failed()