'Need to be careful, as this affects the computation of process_percent.'

def update_total_stages(self, total_stages, current_stage=None):

    assert ((self.end_time is None) and (self.completed == False)), 'Cannot    update    processes    that    have    been    ended.'
    if (total_stages == self.total_stages):
        return
    if self.total_stages:
        logging.debug(('Updating    %s    from    %d    to    %d    stages.' % (self.process_name, self.total_stages, total_stages)))
    else:
        logging.debug(('Setting    %s    to    %d    total    stages.' % (self.process_name, total_stages)))
    self.total_stages = total_stages
    if (current_stage is not None):
        self.current_stage = current_stage
    self.process_percent = self._compute_process_percent()
    self.save()
