diff --git a/python/pyspark/sql/connect/shell/progress.py b/python/pyspark/sql/connect/shell/progress.py index ada3b4d177024..4bee6bcb31f7e 100644 --- a/python/pyspark/sql/connect/shell/progress.py +++ b/python/pyspark/sql/connect/shell/progress.py @@ -174,10 +174,10 @@ def update_ticks( self._ticks = total_tasks self._tick = completed_tasks self._bytes_read = sum(map(lambda x: x.num_bytes_read, stages)) - if self._tick is not None and self._tick >= 0: - self.output() self._running = inflight_tasks self._stages = stages + if self._tick is not None and self._tick >= 0: + self.output() self._notify(False) def finish(self) -> None: diff --git a/python/pyspark/sql/tests/connect/shell/test_progress.py b/python/pyspark/sql/tests/connect/shell/test_progress.py index f567320bda087..2f33f8a81db98 100644 --- a/python/pyspark/sql/tests/connect/shell/test_progress.py +++ b/python/pyspark/sql/tests/connect/shell/test_progress.py @@ -41,6 +41,7 @@ def test_simple_progress(self): self.assertIn("50.00%", val, "Current progress is 50%") self.assertIn("****", val, "Should use the default char to print.") self.assertIn("Scanned 999.0 B", val, "Should contain the bytes scanned metric.") + self.assertIn("10 Tasks running", val, "Should contain current running tasks.") self.assertFalse(val.endswith("\r"), "Line should not be empty") p.finish() val = buffer.getvalue()