Lee-W commented on code in PR #69789:
URL: https://github.com/apache/airflow/pull/69789#discussion_r3609667358


##########
scripts/ci/analyze_ci_job_durations.py:
##########
@@ -263,6 +259,34 @@ def get_prepare_breeze_step_duration(job: dict) -> float | 
None:
     return None
 
 
+def work_duration(job_data: JobDuration) -> float:

Review Comment:
   ```suggestion
   def calculate_work_duration(job_data: JobDuration) -> float:
   ```



##########
scripts/ci/analyze_ci_job_durations.py:
##########
@@ -587,32 +699,43 @@ def main() -> None:
             f"Not enough runs to establish a trend "
             f"(found {len(runs)}, need {latest_runs_count + 
min_baseline_runs}). Skipping."
         )
-        _write_outputs(False, False, 0)
+        _write_outputs(False, False, 0, False)
         sys.exit(0)
 
     latest_runs = runs[:latest_runs_count]
     baseline_runs = runs[latest_runs_count:]
     print(f"Latest runs: {len(latest_runs)}; baseline runs: 
{len(baseline_runs)}.")
 
+    # Fetch each run's jobs once: they feed the image-build discount below, the
+    # per-job trend, and the image-build persistence check.
+    jobs_by_run_id = fetch_run_jobs_map(repo, runs) if do_analyze_jobs else {}
+
+    def adjusted_run_duration(run: dict) -> float:

Review Comment:
   ```suggestion
       def calculate_adjusted_run_duration(run: dict) -> float:
   ```



##########
scripts/ci/analyze_ci_job_durations.py:
##########
@@ -263,6 +259,34 @@ def get_prepare_breeze_step_duration(job: dict) -> float | 
None:
     return None
 
 
+def work_duration(job_data: JobDuration) -> float:
+    """Return a job's wall-clock with the image-build (prepare breeze) step 
removed.
+
+    The image build occasionally balloons — a cache miss forces a full rebuild
+    (minutes → tens of minutes) — which would otherwise inflate the job's total
+    and flag an unrelated job as "slower". The duration trend should track the
+    actual test/work time, so image build is discounted from it and watched
+    separately by :func:`detect_image_build_regression`.
+    """
+    prepare_breeze = job_data["prepare_breeze_duration"] or 0.0
+    return max(job_data["duration"] - prepare_breeze, 0.0)
+
+
+def run_image_build_seconds(jobs: dict[str, JobDuration]) -> float | None:

Review Comment:
   ```suggestion
   def calcuate_image_build_seconds(jobs: dict[str, JobDuration]) -> float | 
None:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to