beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From al...@apache.org
Subject [beam] branch master updated: [BEAM-5209] Precommit timings notebook: fix illegal characters in URL, add 1day and 1week stats. (#5779)
Date Mon, 24 Sep 2018 17:47:53 GMT
This is an automated email from the ASF dual-hosted git repository.

altay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 02eadb1  [BEAM-5209] Precommit timings notebook: fix illegal characters in URL, add
1day and 1week stats. (#5779)
02eadb1 is described below

commit 02eadb12d583b876f639aee027dc61f8c18191df
Author: Udi Meiri <udim@users.noreply.github.com>
AuthorDate: Mon Sep 24 20:47:43 2018 +0300

    [BEAM-5209] Precommit timings notebook: fix illegal characters in URL, add 1day and 1week
stats. (#5779)
    
    * Precommit timings notebook: add 1day, 1week stats.
    * Fix illegal characters in request URL.
    Square brackets were not being quoted.
---
 .test-infra/jupyter/precommit_job_times.ipynb | 44 +++++++++++++++++----------
 1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/.test-infra/jupyter/precommit_job_times.ipynb b/.test-infra/jupyter/precommit_job_times.ipynb
index cadd611..1bfbeda 100644
--- a/.test-infra/jupyter/precommit_job_times.ipynb
+++ b/.test-infra/jupyter/precommit_job_times.ipynb
@@ -84,8 +84,10 @@
     "builds = []\n",
     "job_names = ['beam_PreCommit_Java_Cron', 'beam_PreCommit_Python_Cron', 'beam_PreCommit_Go_Cron']\n",
     "for job_name in job_names:\n",
-    "    url = 'https://builds.apache.org/job/%s/api/json?tree=%s[result,number,timestamp,actions[queuingDurationMillis,totalDurationMillis]]'
% (job_name, builds_key)\n",
-    "    r = requests.get(url)\n",
+    "    url = 'https://builds.apache.org/job/%s/api/json' % job_name\n",
+    "    params = {\n",
+    "        'tree': '%s[result,number,timestamp,actions[queuingDurationMillis,totalDurationMillis]]'
% builds_key}\n",
+    "    r = requests.get(url, params=params)\n",
     "    data = r.json()\n",
     "    builds.extend([Build(job_name, build_json)\n",
     "                         for build_json in data[builds_key]])\n",
@@ -93,7 +95,11 @@
     "df = pd.DataFrame(builds)\n",
     "\n",
     "timestamp_cutoff = pd.Timestamp.utcnow().tz_convert(None) - pd.Timedelta(weeks=4)\n",
-    "df_4weeks = df[df.timestamp >= timestamp_cutoff]"
+    "df_4weeks = df[df.timestamp >= timestamp_cutoff]\n",
+    "timestamp_cutoff = pd.Timestamp.utcnow().tz_convert(None) - pd.Timedelta(weeks=1)\n",
+    "df_1week = df[df.timestamp >= timestamp_cutoff]\n",
+    "timestamp_cutoff = pd.Timestamp.utcnow().tz_convert(None) - pd.Timedelta(days=1)\n",
+    "df_1day = df[df.timestamp >= timestamp_cutoff]"
    ]
   },
   {
@@ -117,20 +123,27 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "# Get metrics\n",
+    "# Get 95th percentile of precommit run times.\n",
+    "test_dfs = {'4 weeks': df_4weeks, '1 week': df_1week, '1 day': df_1day}\n",
     "metrics = []\n",
     "\n",
-    "for job_name in job_names:\n",
-    "    df_times = df_4weeks[df_4weeks.job_name == job_name]\n",
-    "    #df_times = df_times[['totalDurationMinutes', 'result']]\n",
-    "    res_total_all = np.percentile(df_times.totalDurationMinutes, q=95)\n",
-    "    res_total_success = np.percentile(df_times[df_times.result == 'SUCCESS'].totalDurationMinutes,
q=95)\n",
-    "    res_queue = np.percentile(df_times.queuingDurationMinutes, q=95)\n",
-    "    metrics.append({'job_name': job_name, 'totalDurationMinutes_95th_all': res_total_all,\n",
-    "                    'totalDurationMinutes_95th_success_only': res_total_success,\n",
-    "                    'queuingDurationMinutes_95th': res_queue})\n",
-    "\n",
-    "pd.DataFrame(metrics)"
+    "for sample_time, test_df in test_dfs.items():\n",
+    "    for job_name in job_names:\n",
+    "        df_times = test_df[test_df.job_name == job_name]\n",
+    "        for percentile in [95]:\n",
+    "            total_all = np.percentile(df_times.totalDurationMinutes, q=percentile)\n",
+    "            total_success = np.percentile(df_times[df_times.result == 'SUCCESS'].totalDurationMinutes,\n",
+    "                                          q=percentile)\n",
+    "            queue = np.percentile(df_times.queuingDurationMinutes, q=percentile)\n",
+    "            metrics.append({'job_name': '%s %s %dth' % (\n",
+    "                                job_name.replace('beam_PreCommit_','').replace('_GradleBuild',''),\n",
+    "                                sample_time, percentile),\n",
+    "                            'totalDurationMinutes_all': total_all,\n",
+    "                            'totalDurationMinutes_success_only': total_success,\n",
+    "                            'queuingDurationMinutes': queue,\n",
+    "                           })\n",
+    "\n",
+    "pd.DataFrame(metrics).sort_values('job_name')"
    ]
   },
   {
@@ -151,7 +164,6 @@
     "    num_fetched = 0\n",
     "    for build_num in build_nums:\n",
     "        url = 'https://builds.apache.org/job/%s/%s/testReport/api/json?depth=1' % (job_name,
build_num)\n",
-    "        #print(url)\n",
     "        print('.', end='')\n",
     "        r = requests.get(url)\n",
     "        if not r.ok:\n",


Mime
View raw message