Permalink
Browse files

use new commander output instead of calculating run time

  • Loading branch information...
1 parent 9a545e9 commit 69873b2ac4a7bf724b8fcb4a7e381cc50b75f1ae @oremj oremj committed May 11, 2012
Showing with 18 additions and 40 deletions.
  1. +8 −13 captain.coffee
  2. +9 −26 captain.js
  3. +1 −1 package.json
View
@@ -1,27 +1,22 @@
-TASK_RE = /^\[(.+?)] Running (.*)/
+TASK_RE = /^\[(.+?)] (Finished|Running) (.*)/
SUBTASK_RE = /^\[(.+?)\] \[(.+?)\] (\w+):\s*(.*)$/
-elapsed = (start, stop) ->
- str_to_date = (str) ->
- d = (parseInt(i) for i in /(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/.exec(str)[1..])
- new Date(d[0], d[1], d[2], d[3], d[4], d[5])
-
- (str_to_date(stop) - str_to_date(start)) / 1000
-
exports.parselog = (stream) ->
- state =
+ state =
task: ""
queue: {}
failed: []
completed: []
for line in stream.split("\n")
if TASK_RE.test(line)
- [date, task] = TASK_RE.exec(line)[1..]
- if state.task != ""
- [prev_time, prev_task] = state.task
- state.completed.push([prev_task, elapsed(prev_time, date)])
+ [date, status, task] = TASK_RE.exec(line)[1..]
+ if status == "Running"
+ state.task = [date, task]
+ else if status == "Finished"
+ [task, time] = /^(.+?) \((\d+)s\)/.exec(task)[1..]
+ state.completed.push([task, time])
state.task = [date, task]
else if SUBTASK_RE.test(line)
[date, host, kind, text] = SUBTASK_RE.exec(line)[1..]
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,7 +1,7 @@
{
"name": "pushbots",
"description": "IRC bots to go with Chief/Freddo",
- "version": "0.1.2",
+ "version": "0.1.3",
"author": "Jeff Balogh <jbalogh@mozilla.com>",
"contributors": [
"James Socol <james@mozilla.com>",

0 comments on commit 69873b2

Please sign in to comment.