Add iOS Simulator EWS to bot watcher's dashboard
[WebKit-https.git] / Tools / BuildSlaveSupport / build.webkit.org-config / public_html / dashboard / Scripts / BubbleQueueServer.js
1 /*
2  * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 BubbleQueueServer = function()
27 {
28     const queueInfo = {
29         "commit-queue": {platform: Dashboard.Platform.MacOSXYosemite, shortName: "commit", title: "Commit Queue"},
30         "style-queue": {shortName: "style", title: "Style Checker Queue"},
31         "gtk-wk2-ews": {platform: Dashboard.Platform.LinuxGTK, shortName: "gtk-wk2", title: "WebKit2\xa0Release\xa0Build\xa0EWS"},
32         "ios-ews": {platform: Dashboard.Platform.iOS9Device, shortName: "ios", title: "Release\xa0Build\xa0EWS"},
33         "ios-sim-ews": {platform: Dashboard.Platform.iOS9Simulator, shortName: "ios-sim", title: "WebKit2\xa0Release\xa0Tests\xa0EWS"},
34         "mac-ews": {platform: Dashboard.Platform.MacOSXYosemite, shortName: "mac", title: "WebKit1\xa0Release\xa0Tests\xa0EWS"},
35         "mac-wk2-ews": {platform: Dashboard.Platform.MacOSXYosemite, shortName: "mac-wk2", title: "WebKit2\xa0Release\xa0Tests\xa0EWS"},
36         "mac-debug-ews": {platform: Dashboard.Platform.MacOSXYosemite, shortName: "mac-debug", title: "WebKit1\xa0Debug\xa0Tests\xa0EWS"},
37         "mac-32bit-ews": {platform: Dashboard.Platform.MacOSXYosemite, shortName: "mac-32bit", title: "Release\xa032\u2011bit\xa0Build\xa0EWS"},
38         "win-ews": {platform: Dashboard.Platform.Windows7, shortName: "win", title: "WebKit1\xa0Release\xa0Build\xa0EWS"},
39         "efl-wk2-ews": {platform: Dashboard.Platform.LinuxEFL, shortName: "efl-wk2", title: "WebKit2\xa0Release\xa0Build\xa0EWS"}
40     };
41
42     BaseObject.call(this);
43
44     this.baseURL = "https://webkit-queues.webkit.org/";
45     this.queues = {};
46
47     for (var id in queueInfo)
48         this.queues[id] = new BubbleQueue(this, id, queueInfo[id]);
49 };
50
51 BaseObject.addConstructorFunctions(BubbleQueueServer);
52
53 BubbleQueueServer.prototype = {
54     constructor: BubbleQueueServer,
55     __proto__: BaseObject.prototype,
56
57     jsonQueueLengthURL: function(queueID)
58     {
59         return this.baseURL + "queue-length-json/" + encodeURIComponent(queueID);
60     },
61
62     jsonQueueStatusURL: function(queueID)
63     {
64         return this.baseURL + "queue-status-json/" + encodeURIComponent(queueID);
65     },
66
67     jsonProcessingTimesURL: function(fromTime, toTime)
68     {
69         return this.baseURL + "processing-times-json/" + [fromTime.getUTCFullYear(), fromTime.getUTCMonth() + 1, fromTime.getUTCDate(), fromTime.getUTCHours(), fromTime.getUTCMinutes(), fromTime.getUTCSeconds()].join("-")
70             + "-" + [toTime.getUTCFullYear(), toTime.getUTCMonth() + 1, toTime.getUTCDate(), toTime.getUTCHours(), toTime.getUTCMinutes(), toTime.getUTCSeconds()].join("-");
71     },
72
73     queueStatusURL: function(queueID)
74     {
75         return this.baseURL + "queue-status/" + encodeURIComponent(queueID);
76     },
77
78     // Retrieves information about all patches that were submitted in the time range:
79     // {
80     //     patch_id_1: {
81     //         queue_name_1: {
82     //             date: <date/time when the patch was submitted to the queue>,
83     //             retry_count: <number of times a bot had to bail out and drop the lock, for another bot to start from scratch>,
84     //             wait_duration: <how long it took before a bot first locked the patch for processing>,
85     //             process_duration: <how long it took from end of wait to finish, only valid for finished patches. Includes wait time between retries>
86     //             final_message: <(pass|fail|not processed|could not apply|internal error|in progress)>
87     //         },
88     //         ...
89     //     },
90     //     ...
91     // }
92     loadProcessingTimes: function(fromTime, toTime, callback)
93     {
94         JSON.load(this.jsonProcessingTimesURL(fromTime, toTime), function(data) {
95             for (patch in data) {
96                 for (queue in patch)
97                     queue.date = new Date(queue.date);
98             }
99             callback(data, fromTime, toTime);
100         }.bind(this));
101     },
102 };