Permalink
Browse files

Store node count with job

  • Loading branch information...
andrewvc committed Aug 14, 2012
1 parent a2c423e commit 8fa16638c4ff81d2c6cc2944d2251d0b233821f4
Showing with 11 additions and 1 deletion.
  1. +2 −0 src/engulf/job_manager.clj
  2. +9 −1 src/engulf/migrations.clj
@@ -1,6 +1,7 @@
(ns engulf.job-manager
(:require [engulf.formula :as forumla]
[engulf.database :as database]
+ [engulf.comm.node-manager :as nmgr]
[engulf.settings :as settings]
[engulf.control :as ctrl]
[engulf.utils :as utils]
@@ -26,6 +27,7 @@
:ended-at nil
:title title
:notes notes
+ :node-count (nmgr/count-nodes)
:params params})
(defn record-result
View
@@ -34,12 +34,20 @@
(jdbc/do-commands
"CREATE INDEX results_job_uuid_idx ON results(job_uuid)")))})
+(def add-node-count
+ {:id "add-node-count"
+ :up (fn [db] (jdbc/with-connection db
+ (jdbc/do-commands "ALTER TABLE jobs ADD COLUMN node_count INTEGER")))
+ :down (fn [db])
+ })
+
(defn ensure-all
[]
(let [{{:keys [classname subprotocol subname user password]}:jdbc} settings/all
db (ragtime.sql.database.SqlDatabase. classname subprotocol subname
user password)]
(migrate-all db
[create-jobs
- create-results]
+ create-results
+ add-node-count]
strategy/apply-new)))

0 comments on commit 8fa1663

Please sign in to comment.