Esempio n. 1
0
    def __init__(self, df, resource_bounds=None, float_precision=6):
        # set float round precision
        self.float_precision = float_precision
        self.df = np.round(df, float_precision)

        if resource_bounds:
            self.res_bounds = resource_bounds
        else:
            self.res_bounds = (
                min([b for x in self.df.allocated_processors
                     for (b, e) in x]),
                max([e for x in self.df.allocated_processors
                     for (b, e) in x]))

        self.MaxProcs = total([self.res_bounds])

        self.df['proc_alloc'] = self.df.allocated_processors.apply(total)

        # Add missing columns
        if 'starting_time' not in self.df.columns:
            self.df['starting_time'] = \
                self.df['submission_time'] + self.df['waiting_time']
        if 'finish_time' not in self.df.columns:
            self.df['finish_time'] = \
                self.df['starting_time'] + self.df['execution_time']

        # TODO check consistency on calculated columns...

        # init cache
        self._utilisation = None
        self._queue = None
Esempio n. 2
0
 def detailed_utilisation(self):
     df = self.free_intervals()
     df['total'] = total([self.res_bounds]) - df.free_itvs.apply(total)
     df.set_index("time", drop=True, inplace=True)
     return df