    [s7p.master.core :refer [remove-dsp create-dsp change-qps start-query stop-query qp100ms timer]]))
 
 
-(def testing? (atom 1))
+(def testing (atom 1))
+(def queries (atom nil))
+
+(defn running? []
+  @queries)
+
+(defn testing? []
+  (= @testing 1))
 
 (defn page []
   (html

     :floorPrice (if (= "NA" fp) nil (Integer. fp))
     :device     (line 2)
     :user       (line 3)
     :test       @testing?}
    :result      (mapv #(Integer. %) (subvec line 4))}))


(defn -main [& args]
  (let [context (zmq/zcontext 1)
        queries (atom nil)
        ;; somehow cannot use with-open
        in-file (io/reader (first args))
        pub (doto (zmq/socket context :pub)

             (submit-button "new dsp")])
   (form-to [:post "/control/qps"]
            [:div
             "qps: " (str (* 10 @qp100ms)) [:input {:name :qps :value (* 10 @qp100ms)}]
             (submit-button "change qps")])
   [:div "mode: " (if (testing?) "test" "prd")]
   [:div
    (if (testing?)
      (form-to [:post "/control/prd"] (submit-button "production"))
      (form-to [:post "/control/test"]  (submit-button "test")))]
   [:div "status: " (if (running?) "running" "suspended")]
   [:div
    (if (running?)
      (form-to [:post "/control/stop"]  (submit-button "stop"))
      (form-to [:post "/control/start"] (submit-button "start")))]
   [:table {:style "clear: left"}
    [:tr [:th "id"] [:th "api url"] [:th "winnotice url"] [:th ""]]
    (for [dsp @config/dsps]
      [:tr [:input {:name :id :type :hidden :value (:id dsp)}]
       [:td (:id dsp)]
       [:td (:url dsp)]
       [:td (:winnotice dsp)]
       [:td (form-to [:post "/dsp/delete"] (submit-button "delete"))]])]))


(defn to-req [line]
