예제 #1
0
 def get_status_array(self):
     if self.m_state.lower() == "running":  # For extra states.
         if self.is_alive is not True:
             ld = "Starting"
         elif self.load:
             lds = self.load.split(' ')
             if len(lds) == 3:
                 try:
                     load1 = float(lds[0]) / self.num_cpus
                     load2 = float(lds[1]) / self.num_cpus
                     load3 = float(lds[2]) / self.num_cpus
                     ld = "%s %s %s" % (load1, load2, load3)
                 except Exception, e:
                     log.debug("Problems normalizing load: %s" % e)
                     ld = self.load
             else:
                 ld = self.load
         elif self.worker_status == "Ready":
             ld = "Running"
         return [
             self.id, ld,
             misc.format_seconds(Time.now() - self.last_m_state_change),
             self.nfs_data, self.nfs_tools, self.nfs_indices, self.nfs_sge,
             self.get_cert, self.sge_started, self.worker_status
         ]
예제 #2
0
    def get_status_dict(self):
        toret = {
            'id':
            self.id,
            'alias':
            self.alias,
            'ld':
            self.load,
            'time_in_state':
            misc.format_seconds(Time.now() - self.last_m_state_change),
            'nfs_data':
            self.nfs_data,
            'nfs_tools':
            self.nfs_tools,
            'nfs_indices':
            self.nfs_indices,
            'nfs_sge':
            self.nfs_sge,
            'nfs_tfs':
            self.nfs_tfs,
            'get_cert':
            self.get_cert,
            'slurmd_running':
            self.slurmd_running,
            'worker_status':
            self.worker_status,
            'instance_state':
            self.m_state,
            'instance_type':
            self.type,
            'public_ip':
            self.public_ip
        }

        if self.load:
            lds = self.load.split(' ')
            if len(lds) == 3:
                toret['ld'] = "%s %s %s" % (float(lds[0]) / self.num_cpus,
                                            float(lds[1]) / self.num_cpus,
                                            float(lds[2]) / self.num_cpus)
        return toret
예제 #3
0
 def get_status_array(self):
     if self.m_state.lower() == "running":  # For extra states.
         if self.is_alive is not True:
             ld = "Starting"
         elif self.load:
             lds = self.load.split(' ')
             if len(lds) == 3:
                 try:
                     load1 = float(lds[0]) / self.num_cpus
                     load2 = float(lds[1]) / self.num_cpus
                     load3 = float(lds[2]) / self.num_cpus
                     ld = "%s %s %s" % (load1, load2, load3)
                 except Exception, e:
                     log.debug("Problems normalizing load: %s" % e)
                     ld = self.load
             else:
                 ld = self.load
         elif self.worker_status == "Ready":
             ld = "Running"
         return [self.id, ld, misc.format_seconds(
             Time.now() - self.last_m_state_change),
             self.nfs_data, self.nfs_tools, self.nfs_indices, self.nfs_sge, self.get_cert,
             self.sge_started, self.worker_status]
예제 #4
0
    def get_status_dict(self):
        toret = {'id': self.id,
                 'alias': self.alias,
                 'ld': self.load,
                 'time_in_state': misc.format_seconds(Time.now() - self.last_m_state_change),
                 'nfs_data': self.nfs_data,
                 'nfs_tools': self.nfs_tools,
                 'nfs_indices': self.nfs_indices,
                 'nfs_sge': self.nfs_sge,
                 'nfs_tfs': self.nfs_tfs,
                 'get_cert': self.get_cert,
                 'slurmd_running': self.slurmd_running,
                 'worker_status': self.worker_status,
                 'instance_state': self.m_state,
                 'instance_type': self.type,
                 'public_ip': self.public_ip}

        if self.load:
            lds = self.load.split(' ')
            if len(lds) == 3:
                toret['ld'] = "%s %s %s" % (float(lds[0]) / self.num_cpus, float(
                    lds[1]) / self.num_cpus, float(lds[2]) / self.num_cpus)
        return toret
예제 #5
0
                        load3 = float(lds[2]) / self.num_cpus
                        ld = "%s %s %s" % (load1, load2, load3)
                    except Exception, e:
                        log.debug("Problems normalizing load: %s" % e)
                        ld = self.load
                else:
                    ld = self.load
            elif self.worker_status == "Ready":
                ld = "Running"
            return [self.id, ld, misc.format_seconds(
                Time.now() - self.last_m_state_change),
                self.nfs_data, self.nfs_tools, self.nfs_indices, self.nfs_sge, self.get_cert,
                self.sge_started, self.worker_status]
        else:
            return [self.id, self.m_state,
                    misc.format_seconds(Time.now() - self.last_m_state_change),
                    self.nfs_data, self.nfs_tools, self.nfs_indices,
                    self.nfs_sge, self.get_cert, self.sge_started,
                    self.worker_status]

    @TestFlag("TestInstanceID")
    def get_id(self):
        if self.inst is not None and self.id is None:
            try:
                self.inst.update()
                self.id = self.inst.id
            except EC2ResponseError, e:
                log.error("Error retrieving instance id: %s" % e)
            except Exception, e:
                log.error("Exception retreiving instance object: %s" % e)
        return self.id
예제 #6
0
                        load3 = float(lds[2]) / self.num_cpus
                        ld = "%s %s %s" % (load1, load2, load3)
                    except Exception, e:
                        log.debug("Problems normalizing load: %s" % e)
                        ld = self.load
                else:
                    ld = self.load
            elif self.worker_status == "Ready":
                ld = "Running"
            return [self.id, ld, misc.format_seconds(
                Time.now() - self.last_m_state_change),
                self.nfs_data, self.nfs_tools, self.nfs_indices, self.nfs_sge, self.get_cert,
                self.sge_started, self.worker_status]
        else:
            return [self.id, self.m_state,
                    misc.format_seconds(Time.now() - self.last_m_state_change),
                    self.nfs_data, self.nfs_tools, self.nfs_indices,
                    self.nfs_sge, self.get_cert, self.sge_started,
                    self.worker_status]

    @TestFlag("TestInstanceID")
    def get_id(self):
        if self.inst is not None and self.id is None:
            try:
                self.inst.update()
                self.id = self.inst.id
            except EC2ResponseError, e:
                log.error("Error retrieving instance id: %s" % e)
            except Exception, e:
                log.error("Exception retreiving instance object: %s" % e)
        return self.id