Skip to content

Commit

Permalink
Lemur fixes.
Browse files Browse the repository at this point in the history
- Fix spot-check-history.
- Further fix output of spot-check-history and display-types;
  cl-format doesn't flush *out*.
- Clean up shell_test. It was broken with JAVA_HOMEs like
  "/usr/lib/jvm/java-6-sun/jre".
  • Loading branch information
Jed Denlea committed Mar 20, 2013
1 parent 99083bf commit d602eb3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
7 changes: 4 additions & 3 deletions src/main/clj/com/climate/services/aws/ec2.clj
Expand Up @@ -125,9 +125,10 @@
([hours] ([hours]
(spot-price-history hours nil)) (spot-price-history hours nil))
([hours type] ([hours type]
(let [now (GregorianCalendar.) (let [[start end] (let [volatile-cal (GregorianCalendar.)
end (.getTime now) end (.getTime volatile-cal)]
start (.getTime (.add now GregorianCalendar/HOUR_OF_DAY hours)) (.add volatile-cal GregorianCalendar/HOUR_OF_DAY (- hours))
[(.getTime volatile-cal) end])
sort-by (partial sort-by #(.getTimestamp %)) sort-by (partial sort-by #(.getTimestamp %))
req (doto (DescribeSpotPriceHistoryRequest.) req (doto (DescribeSpotPriceHistoryRequest.)
(.setStartTime start) (.setStartTime start)
Expand Down
6 changes: 4 additions & 2 deletions src/main/clj/lemur/core.clj
Expand Up @@ -902,7 +902,8 @@ calls launch - take action (upload files, start cluster, etc)
(cl-format true "~{~12<~a~>~}~%~ (cl-format true "~{~12<~a~>~}~%~
~{~{~12<~a~>~}~%~}" ~{~{~12<~a~>~}~%~}"
(take-nth 2 flds) (take-nth 2 flds)
details)) details)
(flush))
(quit)) (quit))


(defn- spot-price-history (defn- spot-price-history
Expand All @@ -918,7 +919,8 @@ calls launch - take action (upload files, start cluster, etc)
(cl-format true "~{~12<~a~>~}~%~ (cl-format true "~{~12<~a~>~}~%~
~{~{~12<~a~>~}~%~}" ~{~{~12<~a~>~}~%~}"
(take-nth 2 flds) (take-nth 2 flds)
details)) details)
(flush))
(quit)) (quit))


(defmacro when-local-test (defmacro when-local-test
Expand Down
19 changes: 11 additions & 8 deletions src/test/clj/com/climate/shell_test.clj
Expand Up @@ -39,14 +39,17 @@
:env (merge-env {:FOO "bar"})))))) :env (merge-env {:FOO "bar"}))))))


(deftest test-merge-env-2 (deftest test-merge-env-2
(is (re-find (is (let [java-home (get (System/getenv) "JAVA_HOME")]
#"\[\"[\.\/\w]+\" \"bar\"\]" (and
(:out (sh "java" "-cp" (clj-main-jar) "clojure.main" "-e" (not-empty java-home)
"(vector (.startsWith
(get (System/getenv) \"JAVA_HOME\") (:out (sh "java" "-cp" (clj-main-jar) "clojure.main" "-e"
(get (System/getenv) \"FOO\"))" "(vector
:err :pass (get (System/getenv) \"JAVA_HOME\")
:env (merge-env {:FOO "bar"})))))) (get (System/getenv) \"FOO\"))"
:err :pass
:env (merge-env {:FOO "bar"})))
(str "[" (pr-str java-home) " \"bar\"]"))))))


(deftest test-sh-with-files (deftest test-sh-with-files
(let [txt "some test text" (let [txt "some test text"
Expand Down

0 comments on commit d602eb3

Please sign in to comment.