Returns a float between 0 and 1, representing the current job's progress in its task.
        If total_progress is not given or 0, just return self.progress.

        :return: float corresponding to the total percentage progress of the job.
491651
def percentage_progress(self):
        

        if self.total_progress != 0:
            return float(self.progress) / self.total_progress
        else:
            return self.progress
439415
def get_current_program_progress(program):
    '''
    
    '''
    now = datetime.datetime.now()
    program_duration = get_program_duration(program)
    if not program_duration:
        return
    progress = now - program.get('start_time')
    return progress.seconds * 100 / program_duration
230455
def percentage(self):
        """"""
        if self.currval >= self.maxval:
            return 100.0
        return self.currval * 100.0 / self.maxval
344238
@Override
  public float getProgress() {
    try {
      return Math.max(Math.min(1, progressProvider.get().getProgress()), 0);
    } catch (final Exception e) {
      // An Exception must be caught and logged here because YARN swallows the Exception and fails the job.
      LOG.log(Level.WARNING, "Cannot get the application progress. Will return 0.", e);
      return 0;
    }
  }
355929
def value(self, progress_indicator):
        
        return interpolate.interpolate_linear_single(self.initial_value, self.final_value, progress_indicator)
21157
def percentOfTotal(self, value, values):
        
        try:
            return float(value) / sum(values)
        except (ZeroDivisionError, TypeError, ValueError):
            return 0.0
276864
def get_progress_percentage(self, ar_brain):
        
        review_state = ar_brain.review_state
        if review_state == "published":
            return 100

        numbers = ar_brain.getAnalysesNum

        num_analyses = numbers[1] or 0
        if not num_analyses:
            return 0

        # [verified, total, not_submitted, to_be_verified]
        num_to_be_verified = numbers[3] or 0
        num_verified = numbers[0] or 0

        # 2 steps per analysis (submit, verify) plus one step for publish
        max_num_steps = (num_analyses * 2) + 1
        num_steps = num_to_be_verified + (num_verified * 2)
        if not num_steps:
            return 0
        if num_steps > max_num_steps:
            return 100
        return (num_steps * 100) / max_num_steps
427979
def progress(count, total, suffix=''):
    '''
    
    '''
    bar_len = 60
    filled_len = int(round(bar_len * count / float(total)))
    percents = round(100.0 * count / float(total), 1)
    bar = '=' * filled_len + '-' * (bar_len - filled_len)
    sys.stdout.write('[%s] %s%s %s\r' % (bar, percents, '%', suffix))
    sys.stdout.flush()
654965
def get_progress(opts, out, progress):
    '''
    
    '''
    return salt.loader.raw_mod(opts,
                                out,
                                'rawmodule',
                                mod='output')['{0}.progress_iter'.format(out)](progress)
242348
def progress_indicator(self, fmt=None, interval=100, values=None):
        
        return ProgressIndicator(self.io, fmt, interval, values)
796491
public float progress() {
    Freezable f = UKV.get(destination_key);
    if( f instanceof Progress )
      return ((Progress) f).progress();
    return 0;
  }
1355876
public Double getProgress() {

        if (state.equals(ParallelTaskState.IN_PROGRESS)) {
            if (requestNum != 0) {
                return 100.0 * ((double) responsedNum / (double) requestNumActual);
            } else {
                return 0.0;
            }
        }

        if (state.equals(ParallelTaskState.WAITING)) {
            return 0.0;
        }

        // fix task if fail validation, still try to poll progress 0901
        if (state.equals(ParallelTaskState.COMPLETED_WITH_ERROR)
                || state.equals(ParallelTaskState.COMPLETED_WITHOUT_ERROR)) {
            return 100.0;
        }

        return 0.0;

    }
986128
def percentage(self):
        
        total_vote_count = self.poll.vote_count
        if total_vote_count:
            return self.vote_count * 100.0 / total_vote_count
        return 0
567231
def get_percentage_volume_change(self):
        
        initial_vol = self.initial.lattice.volume
        final_vol = self.final.lattice.volume
        return final_vol / initial_vol - 1
219960
def rate(self):
        """"""
        return float(self._eta.rate_unstable if self.eta_every > 1 else self._eta.rate)
910997
def get_status(self):
        
        if self.n_total == 0:
            return JobStatus.no_job
        elif self.n_done == self.n_total:
            return JobStatus.done
        elif self.n_failed > 0:
            # If more that a quater of the jobs fail, fail the whole thing
            if self.n_failed > self.n_total / 4.:
                return JobStatus.failed
            return JobStatus.partial_failed
        elif self.n_running > 0:
            return JobStatus.running
        elif self.n_pending > 0:
            return JobStatus.pending
        return JobStatus.ready
767844
protected double getKnobPercent() {
		// If we have no range
		if (maxValue <= minValue) {
			return 0;
		}

		// Calculate the relative progress
		double percent = (curValue - minValue) / (maxValue - minValue);
		return Math.max(0.0, Math.min(1.0, percent));
	}