[gnome-continuous] task: Add a tasks dir that only updates on task completion



commit 05248011ce8baf98e4e2e7f7134ee588e1753517
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Oct 9 18:05:17 2013 -0400

    task: Add a tasks dir that only updates on task completion
    
    Some clients, like the IRC bot and website, may not care about the
    current task that is being worked on, but instead the last one that
    completed, either successfully or not. While we may want to expose
    a more rich way of doing this eventually (show the last successful
    or failed build for each task individiually), this is a good enough
    stopgap to keep the IRC bot in semi-working order.

 extras/ircbot/bot.py |    2 +-
 src/js/task.js       |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/extras/ircbot/bot.py b/extras/ircbot/bot.py
index 1fdf41e..9ba2a4b 100644
--- a/extras/ircbot/bot.py
+++ b/extras/ircbot/bot.py
@@ -85,7 +85,7 @@ class BuildGnomeOrg(irc.IRCClient):
             self._query_new_task(taskname, announce_always=False)
 
     def _get_task_state(self, taskname):
-        current_task_path = os.path.join(self._workdir, 'tasks/%s/%s/' % (taskname, taskname))
+        current_task_path = os.path.join(self._workdir, 'results/tasks/%s/%s/' % (taskname, taskname))
         meta_path = os.path.join(current_task_path, 'meta.json')
         if not os.path.exists(meta_path):
             return None, ""
diff --git a/src/js/task.js b/src/js/task.js
index 3d7dcde..5b595ce 100644
--- a/src/js/task.js
+++ b/src/js/task.js
@@ -132,6 +132,9 @@ const TaskMaster = new Lang.Class({
         this.tasksPath = workdir.get_child('tasks');
        GSystem.file_ensure_directory(this.tasksPath, true, null);
 
+        this.completedTasksPath = workdir.get_child('results/tasks');
+       GSystem.file_ensure_directory(this.completedTasksPath, true, null);
+
        this._processAfter = params.processAfter;
        this._skipTasks = {};
        for (let i = 0; i < params.skip.length; i++)
@@ -293,6 +296,9 @@ const TaskMaster = new Lang.Class({
            throw new Error("TaskMaster: Internal error - Failed to find completed task:" + 
runner.taskData.name);
        this._executing.splice(idx, 1);
 
+        let link = this.tasksPath.get_child(taskName);
+        BuildUtil.atomicSymlinkSwap(link, runner.buildPath, this.cancellable);
+
        if (success && runner.changed) {
            let taskName = runner.taskData.name;
            let taskDef = runner.taskData.taskDef;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]