@staticmethod
    def _calc(count, 
              last_count, 
              start_time, 
              max_count, 
              speed_calc_cycles, 
              q, 
              last_old_count,
              last_old_time,
              lock):
        count_value = count.value
        start_time_value = start_time.value
        current_time = time.time()
        
        if last_count.value != count_value:
            # some progress happened
        
            with lock:
                # save current state (count, time) to queue
                
                q.put((count_value, current_time))
    
                # get older state from queue (or initial state)
                # to to speed estimation                
                if q.qsize() > speed_calc_cycles:
                    old_count_value, old_time = q.get()
                else:
                    old_count_value, old_time = 0, start_time_value
            
            last_count.value = count_value
            last_old_count.value = old_count_value
            last_old_time.value = old_time 
        else:
            # progress has not changed since last call
            # use also old (cached) data from the queue
            old_count_value, old_time = last_old_count.value, last_old_time.value

        if (max_count is None):
            max_count_value = None
        else:
            max_count_value = max_count.value
            
        tet = (current_time - start_time_value)
        speed = (count_value - old_count_value) / (current_time - old_time)
        if (speed == 0) or (max_count_value is None) or (max_count_value == 0):
            ttg = None
        else:
            ttg = math.ceil((max_count_value - count_value) / speed)
            
        return count_value, max_count_value, speed, tet, ttg
do the pre calculations in order to get TET, speed, TTG
dataset/ETHPy150Open cimatosa/jobmanager/jobmanager/progress.py/Progress._calc