Example #1
0
    def _calc_purge_before(self):
        """Calculates time after which manifests should be purged."""

        if self.args.purge_before:
            return dt_util.parse_date_input(self.args.purge_before)

        assert (self.args.keep_days or -1) > 0
        return dt_util.now() - datetime.timedelta(self.args.keep_days)
Example #2
0
 def _calc_purge_before(self):
     """Calculates time after which manifests should be purged."""
     
     if self.args.purge_before:
         return dt_util.parse_date_input(self.args.purge_before)
     
     assert (self.args.keep_days or -1) > 0
     return dt_util.now() - datetime.timedelta(self.args.keep_days)
Example #3
0
    def _extrapolate_hours(self, hours):
        """Add hours to ``hours`` to extrapolate the total usage.

        Updates ``hours`` in place.
        """

        if self.args.extrapolate_to == "now":
            to_dt = datetime.datetime.now()
        else:
            to_dt = dt_util.parse_date_input(self.args.extrapolate_to)

        while hours[-1].start < to_dt and not hours[-1].contains(to_dt):
            hours.append(hours[-1].next_hour())
        return
Example #4
0
 def _extrapolate_hours(self, hours):
     """Add hours to ``hours`` to extrapolate the total usage.
     
     Updates ``hours`` in place. 
     """
     
     
     if self.args.extrapolate_to == "now":
         to_dt = datetime.datetime.now()
     else:
         to_dt = dt_util.parse_date_input(
             self.args.extrapolate_to)
             
     while hours[-1].start < to_dt and not hours[-1].contains(to_dt):
         hours.append(hours[-1].next_hour())
     return 
Example #5
0
 def __init__(self, args):
     self.args = args
     self.args.day = dt_util.to_utc(dt_util.parse_date_input(
         self.args.day))
Example #6
0
 def __init__(self, args):
     self.args = args
     self.args.day = dt_util.to_utc(dt_util.parse_date_input(self.args.day))