Example #1
0
File: task.py Project: VUIIS/api
 def check_job_usage(self):
     #self.copy_memused()
     
     memused = self.get_memused()
     walltime = self.get_walltime()
     
     if walltime != '':
         if memused == '':
             self.set_memused('NotFound')
         else:
             pass
             #print('DEBUG:memused and walltime already set, skipping')
         
         return
     
     jobstartdate = self.get_jobstartdate()
     
     # We can't get info from cluster if job too old
     if not cluster.is_traceable_date(jobstartdate):
         self.set_walltime('NotFound')
         self.set_memused('NotFound')
         return
     
     # Get usage with tracejob
     jobinfo = cluster.tracejob_info(self.get_jobid(), jobstartdate)
     if jobinfo['mem_used'] != '': 
         memused = str(int(jobinfo['mem_used'].split('kb')[0])/1024)+'mb'
         self.set_memused(memused)
     if jobinfo['walltime_used'] != '':
         self.set_walltime(jobinfo['walltime_used'])
Example #2
0
    def check_job_usage(self):
        #self.copy_memused()

        memused = self.get_memused()
        walltime = self.get_walltime()

        if walltime != '':
            if memused == '':
                self.set_memused('NotFound')
            else:
                pass
                #print('DEBUG:memused and walltime already set, skipping')

            return

        jobstartdate = self.get_jobstartdate()

        # We can't get info from cluster if job too old
        if not cluster.is_traceable_date(jobstartdate):
            self.set_walltime('NotFound')
            self.set_memused('NotFound')
            return

        # Get usage with tracejob
        jobinfo = cluster.tracejob_info(self.get_jobid(), jobstartdate)
        if jobinfo['mem_used'] != '':
            memused = str(
                int(jobinfo['mem_used'].split('kb')[0]) / 1024) + 'mb'
            self.set_memused(memused)
        if jobinfo['walltime_used'] != '':
            self.set_walltime(jobinfo['walltime_used'])
Example #3
0
    def check_job_usage(self):
        """
        The task has now finished, get the amount of memory used, the amount of
         walltime used, the jobid of the process, the node the process ran on,
         and when it started from the scheduler. Set these values locally

        :return: None

        """
        [memused, walltime, jobid, jobnode, jobstartdate] = self.get_job_usage()

        if walltime:
            if memused and jobnode:
                LOGGER.debug('memused and walltime already set, skipping')
            else:
                if memused == '':
                    self.set_memused('NotFound')
                if jobnode == '':
                    self.set_jobnode('NotFound')
            return

        # We can't get info from cluster if job too old
        if not cluster.is_traceable_date(jobstartdate):
            self.set_walltime('NotFound')
            self.set_memused('NotFound')
            self.set_jobnode('NotFound')
            return

        # Get usage with tracejob
        jobinfo = cluster.tracejob_info(jobid, jobstartdate)
        if jobinfo['mem_used'].strip():
            self.set_memused(jobinfo['mem_used'])
        else:
            self.set_memused('NotFound')
        if jobinfo['walltime_used'].strip():
            self.set_walltime(jobinfo['walltime_used'])
        else:
            self.set_walltime('NotFound')
        if jobinfo['jobnode'].strip():
            self.set_jobnode(jobinfo['jobnode'])
        else:
            self.set_jobnode('NotFound')
Example #4
0
File: task.py Project: Raab70/dax
    def check_job_usage(self):
        """
        The task has now finished, get the amount of memory used, the amount of
         walltime used, the jobid of the process, the node the process ran on,
         and when it started from the scheduler. Set these values on XNAT

        :return: None

        """
        [memused, walltime, jobid, jobnode, jobstartdate] = self.get_job_usage()

        if walltime != "":
            if memused != "" and jobnode != "":
                LOGGER.debug("memused and walltime already set, skipping")
            else:
                if memused == "":
                    self.set_memused("NotFound")
                if jobnode == "":
                    self.set_jobnode("NotFound")
            return

        # We can't get info from cluster if job too old
        if not cluster.is_traceable_date(jobstartdate):
            self.set_walltime("NotFound")
            self.set_memused("NotFound")
            self.set_jobnode("NotFound")
            return

        # Get usage with tracejob
        jobinfo = cluster.tracejob_info(jobid, jobstartdate)
        if jobinfo["mem_used"].strip():
            self.set_memused(jobinfo["mem_used"])
        else:
            self.set_memused("NotFound")
        if jobinfo["walltime_used"].strip():
            self.set_walltime(jobinfo["walltime_used"])
        else:
            self.set_walltime("NotFound")
        if jobinfo["jobnode"].strip():
            self.set_jobnode(jobinfo["jobnode"])
        else:
            self.set_jobnode("NotFound")