class documentation

class OperationProgressTracker(Protocol): (source)

View In Hierarchy

Protocol describing operation-level progress tracking.

This protocol mirrors the server-side ProgressTracker object and adds convenience helpers for time and work fractions.

The tracker is only available for v1 operations that include a progress_tracker field. For v1alpha1 operations, Operation.progress_tracker returns None.

Example

Reading overall progress:

tracker = operation.progress_tracker()
if tracker:
    print(tracker.description())
    work_fraction = tracker.work_fraction()
    if work_fraction is not None:
        print(f"Work: {work_fraction:.0%}")
    time_fraction = tracker.time_fraction()
    if time_fraction is not None:
        print(f"Time: {time_fraction:.0%}")
Method description Return a human-readable description of the tracker.
Method estimated_finished_at Return the estimated completion timestamp when available.
Method finished_at Return the tracker finished timestamp or None if unfinished.
Method started_at Return the tracker start timestamp or None if unknown.
Method steps Return steps reported by the progress tracker.
Method time_fraction Return elapsed time fraction or None when unavailable.
Method work_done Return work progress details for the tracker when available.
Method work_fraction Return the completed work fraction or None when unavailable.
def description(self) -> str: (source)

Return a human-readable description of the tracker.

def estimated_finished_at(self) -> datetime | None: (source)

Return the estimated completion timestamp when available.

def finished_at(self) -> datetime | None: (source)

Return the tracker finished timestamp or None if unfinished.

def started_at(self) -> datetime | None: (source)

Return the tracker start timestamp or None if unknown.

def steps(self) -> Sequence[CurrentStep]: (source)

Return steps reported by the progress tracker.

def time_fraction(self) -> float | None: (source)

Return elapsed time fraction or None when unavailable.

Return work progress details for the tracker when available.

def work_fraction(self) -> float | None: (source)

Return the completed work fraction or None when unavailable.