ETA

class tfsnippet.utils.ETA(take_initial_snapshot=True)

Bases: object

Class to help compute the Estimated Time Ahead (ETA).

Methods Summary

get_eta(progress[, now, take_snapshot]) Get the Estimated Time Ahead (ETA).
take_snapshot(progress[, now]) Take a snapshot of (progress, now), for later computing ETA.

Methods Documentation

get_eta(progress, now=None, take_snapshot=True)

Get the Estimated Time Ahead (ETA).

Parameters:
  • progress – The current progress, range in [0, 1].
  • now – The current timestamp in seconds. If not specified, use time.time().
  • take_snapshot (bool) – Whether or not to take a snapshot of the specified (progress, now)? (default True)
Returns:

The remaining seconds, or None if

the ETA cannot be estimated.

Return type:

float or None

take_snapshot(progress, now=None)

Take a snapshot of (progress, now), for later computing ETA.

Parameters:
  • progress – The current progress, range in [0, 1].
  • now – The current timestamp in seconds. If not specified, use time.time().