[gnome-continuous] autobuilder: Write an autobuilder-status.json file
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous] autobuilder: Write an autobuilder-status.json file
- Date: Wed, 6 Nov 2013 21:52:41 +0000 (UTC)
commit de8a877f942c62f96cf2589ce7bb7bdd3218cbb1
Author: Colin Walters <walters verbum org>
Date: Tue Nov 5 10:24:24 2013 -0500
autobuilder: Write an autobuilder-status.json file
So the web UI can show it.
extras/build.gnome.org/build.gnome.org.js | 21 +++++++++++++++++++++
extras/build.gnome.org/index.html | 3 +++
src/js/builtins/autobuilder.js | 20 +++++++++++++++++---
3 files changed, 41 insertions(+), 3 deletions(-)
---
diff --git a/extras/build.gnome.org/build.gnome.org.js b/extras/build.gnome.org/build.gnome.org.js
index cd7f54f..2dc0dc5 100644
--- a/extras/build.gnome.org/build.gnome.org.js
+++ b/extras/build.gnome.org/build.gnome.org.js
@@ -3,6 +3,7 @@
(function($, exports) {
"use strict";
+ var status = null;
var repoDataSignal = {};
var taskData = {};
var taskNames = ['build', 'smoketest', 'integrationtest', 'applicationstest'];
@@ -12,6 +13,13 @@
window.location.pathname + 'continuous/buildmaster/' + suffix;
}
+ function _loadStatus() {
+ $.getJSON(_getUrl('autobuilder-status.json'), function(data) {
+ status = data;
+ $(repoDataSignal).trigger("status-changed");
+ });
+ }
+
function _loadTask(taskname) {
var url = _getUrl('results/tasks/' + taskname + '/' + taskname + '/meta.json');
$.getJSON(url, function(data) {
@@ -21,6 +29,7 @@
}
function repowebInit() {
+ _loadStatus();
for (var i = 0; i < taskNames.length; i++) {
_loadTask(taskNames[i]);
}
@@ -126,6 +135,18 @@
$(repoDataSignal).on("taskdata-changed", function (event, taskName) {
_renderTask(taskName);
});
+ $(repoDataSignal).on("status-changed", function (event) {
+ var runningStateNode = $("#running-state").get(0);
+ $(runningStateNode).empty();
+ var text;
+ console.log("status=" + JSON.stringify(status));
+ if (status.running) {
+ text = 'Running: ' + status.running.join(' ') + '; load=' + status.systemLoad[0];
+ } else {
+ text = 'Idle, awaiting commits';
+ }
+ runningStateNode.appendChild(document.createTextNode(text));
+ });
}
$(document).ready(function() {
diff --git a/extras/build.gnome.org/index.html b/extras/build.gnome.org/index.html
index b1d0a46..26b8e00 100644
--- a/extras/build.gnome.org/index.html
+++ b/extras/build.gnome.org/index.html
@@ -59,6 +59,9 @@
<div data-role="content">
<p>See <a href="https://live.gnome.org/GnomeContinuous">GNOME-Continuous</a>
for more information. </p>
+ <p>
+ State: <span id="running-state"></span>
+ </p>
<p>Build: <a href="" id="build-link"></a><span id="build-span"></span></p>
<p>Smoketest: <a href="" id="smoketest-link"></a><span id="smoketest-span"></span></p>
<p>Integrationtest: <a href="" id="integrationtest-link"></a><span
id="integrationtest-span"></span></p>
diff --git a/src/js/builtins/autobuilder.js b/src/js/builtins/autobuilder.js
index 0a8adad..222aeff 100644
--- a/src/js/builtins/autobuilder.js
+++ b/src/js/builtins/autobuilder.js
@@ -122,18 +122,32 @@ const Autobuilder = new Lang.Class({
_updateStatus: function() {
let newStatus = "";
let taskstateList = this._taskmaster.getTaskState();
+ let runningTasks = [];
+ let queuedTasks = [];
for (let i = 0; i < taskstateList.length; i++) {
let taskstate = taskstateList[i];
+ let name = taskstate.task.name;
if (taskstate.running)
- newStatus += ("[" + taskstate.task.name + "] ");
+ runningTasks.push(name);
else
- newStatus += (taskstate.task.name + " ");
+ queuedTasks.push(name);
}
- if (newStatus == "")
+ if (runningTasks.length == 0 && queuedTasks.length == 0) {
newStatus = "[idle]";
+ } else {
+ newStatus = "running: " + JSON.stringify(runningTasks);
+ if (queuedTasks.length)
+ newStatus += " queued: " + JSON.stringify(queuedTasks);
+ }
if (newStatus != this._status) {
this._status = newStatus;
print(this._status);
+ let [success,loadAvg,etag] = Gio.File.new_for_path('/proc/loadavg').load_contents(null);
+ loadAvg = loadAvg.toString().replace(/\n$/, '').split(' ');
+ let statusPath = Gio.File.new_for_path('autobuilder-status.json');
+ JsonUtil.writeJsonFileAtomic(statusPath, {'running': runningTasks,
+ 'queued': queuedTasks,
+ 'systemLoad': loadAvg}, null);
this._impl.emit_property_changed('Status', new GLib.Variant("s", this._status));
}
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]