示例#1
0
 def _get_deadline(self, type, lease, start):
     if self.deadlinestretch_dist == None:
         return None, None
     else:
         if type in (FileGenerator.DEADLINE_DURATION, FileGenerator.DEADLINE_SLOWDOWN):
             if type == FileGenerator.DEADLINE_DURATION:
                 tau = self.deadlinestretch_dist.get()
                 
             elif type == FileGenerator.DEADLINE_SLOWDOWN:
                 runtime = float(lease.extras["SWF_runtime"])
                 waittime = float(lease.extras["SWF_waittime"])
                 if runtime < 10: runtime = 10
                 slowdown = (waittime + runtime) / runtime
 
                 min = self.deadlinestretch_dist.min
                 max = self.deadlinestretch_dist.max
                 tau = self.deadlinestretch_dist.get()
                 
                 tau = (slowdown - 1)*((tau-min) / (max-min))
 
             deadline = round_datetime_delta(start + (1 + tau)*lease.duration.requested)                
         elif type == FileGenerator.DEADLINE_ABSOLUTE:
             wait = self.deadlinestretch_dist.get()
             deadline = round_datetime_delta(start + TimeDelta(seconds=wait) + lease.duration.requested)  
             
             tau = ((deadline - start) / lease.duration.requested) - 1                    
                 
         return deadline, tau
示例#2
0
 def _get_start(self, type, lease = None):
     if self.startdelay_dist == None:
         return None, None
     else:
         delta = self.startdelay_dist.get()
         if type == FileGenerator.START_ABSOLUTE:
             start = round_datetime_delta(TimeDelta(seconds=delta))
         elif type == FileGenerator.START_DURATION:
             start = round_datetime_delta(delta * lease.duration.requested)
         return start, delta