Example #1
0
 def _uptime_minutes(instance_name=None):
     attrs = CompGCE._instance_attrs(instance_name)
     lt = parse_iso_time(attrs["creationTimestamp"])
     nt = datetime.datetime.now(pytz.utc)
     uptime = nt - lt
     minutes = int(uptime.total_seconds() / 60)
     return minutes
Example #2
0
 def _uptime_minutes(instance_id=None):
     attrs = CompEC2._instance_attrs(instance_id)
     lt = parse_iso_time(attrs.launch_time)
     nt = datetime.datetime.now(pytz.utc)
     uptime = nt - lt
     minutes = int(uptime.total_seconds()/60)
     return minutes
Example #3
0
 def _uptime_minutes(instance_name=None):
     attrs = CompGCE._instance_attrs(instance_name)
     lt = parse_iso_time(attrs["creationTimestamp"])
     nt = datetime.datetime.now(pytz.utc)
     uptime = nt - lt
     minutes = int(uptime.total_seconds()/60)
     return minutes
Example #4
0
 def is_refreshed(self):
     marker = os.path.join(self.disk_path, '.juliabox/.refreshed')
     if not os.path.exists(marker):
         return False
     try:
         with open(marker, 'r') as mfile:
             dt = parse_iso_time(mfile.read())
         self.log_info("disk refreshed date: %r. user home timestamp: %r", dt, self._get_user_home_timestamp())
         return dt >= self._get_user_home_timestamp()
     except:
         self.log_error("Error reading refreshed marker from disk %s", self.disk_path)
         return False
Example #5
0
 def is_refreshed(self):
     marker = os.path.join(self.disk_path, '.juliabox/.refreshed')
     if not os.path.exists(marker):
         return False
     try:
         with open(marker, 'r') as mfile:
             dt = parse_iso_time(mfile.read())
         self.log_info("disk refreshed date: %r. user home timestamp: %r",
                       dt, self._get_user_home_timestamp())
         return dt >= self._get_user_home_timestamp()
     except:
         self.log_error("Error reading refreshed marker from disk %s",
                        self.disk_path)
         return False
Example #6
0
    def get_message(cluster, del_expired=True):
        try:
            record = JBoxDynConfig(JBoxDB.qual(cluster, 'message'))
        except JBoxDBItemNotFound:
            return None

        msg = record.get_value()
        if msg is None:
            return None

        msg = json.loads(msg)

        tnow = datetime.datetime.now(pytz.utc)
        tvalid = parse_iso_time(msg['valid_till'])
        # JBoxDynConfig.log_debug("tnow: %s, tvalid: %s", str(tnow), str(tvalid))
        if tvalid >= tnow:
            return msg['msg']

        if del_expired:
            record.delete()

        return None
Example #7
0
    def get_message(cluster, del_expired=True):
        try:
            record = JBoxDynConfig(JBoxDB.qual(cluster, "message"))
        except JBoxDBItemNotFound:
            return None

        msg = record.get_value()
        if msg is None:
            return None

        msg = json.loads(msg)

        tnow = datetime.datetime.now(pytz.utc)
        tvalid = parse_iso_time(msg["valid_till"])
        # JBoxDynConfig.log_debug("tnow: %s, tvalid: %s", str(tnow), str(tvalid))
        if tvalid >= tnow:
            return msg["msg"]

        if del_expired:
            record.delete()

        return None
Example #8
0
 def get_stat_collected_date(cluster):
     try:
         record = JBoxDynConfig(JBoxDB.qual(cluster, 'stat_date'))
     except JBoxDBItemNotFound:
         return None
     return parse_iso_time(record.get_value())
Example #9
0
 def get_stat_collected_date(cluster):
     try:
         record = JBoxDynConfig(JBoxDB.qual(cluster, "stat_date"))
     except JBoxDBItemNotFound:
         return None
     return parse_iso_time(record.get_value())