Skip to content

Commit a03b8ca

Browse files
committed
Closes OPEN-4523 Add progress indicator for wait_for_completion API
1 parent f00e79c commit a03b8ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

openlayer/project_versions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ def wait_for_completion(self, timeout: Optional[int] = None):
9999
ProjectVersion
100100
The project version object.
101101
"""
102+
self.print_status_report()
102103
while self.status not in [TaskStatus.COMPLETED, TaskStatus.FAILED]:
104+
prev_status_msg = self.status_message
103105
self.refresh()
106+
if self.status_message != prev_status_msg:
107+
self.print_status_report()
104108
time.sleep(1)
105109
if timeout:
106110
timeout -= 1
@@ -120,6 +124,10 @@ def refresh(self):
120124
information from the server."""
121125
self._json = self.client.load_project_version(self.id).to_dict()
122126

127+
def print_status_report(self):
128+
"""Prints the status report along with its status message."""
129+
print("Status:", self.status.value, "(" + self.status_message + ")")
130+
123131
def print_goal_report(self):
124132
"""Prints the goal results of the project version."""
125133
if self.status != TaskStatus.COMPLETED:

0 commit comments

Comments
 (0)