;;; Hey, Emacs, this file is -*- Common-Lisp -*- ... got that?

(in-package :tsdb)

(setf *tsdb-cache-connections-p* t)

(setf *pvm-encoding* :utf-8)

(defparameter %logon% 
  (let ((root (system:getenv "LOGONROOT")))
    (when root (namestring (parse-namestring root)))))

(when %logon%
  ;;
  ;; point to Norwegian skeletons, rather than the default English ones
  ;;
  (tsdb 
   :skeleton
   (format nil "~a/lingo/lkb/src/tsdb/skeletons/norsk" %logon%))
  ;;
  ;; define [incr tsdb()] clients in terms of binary to run, command-line
  ;; arguments, and the host to run on; if the default of `(short-site-name)'
  ;; for the current host does not work for you, then contact me for advice.
  ;;                                                         (17-dec-03; oe)
  ;;
  (let ((erg "LinGO (20-dec-06)")
        (gg "GG (jun-2006)")
        (jacy "Jacy (2006-05-30)")
        (wrapper (format nil "~a/bin/logon" %logon%))
        (options '(#-:runtime-standard "--source" 
                   #+:runtime-standard "--binary"
                   "--tty"))
        (binary (format nil "~a/franz/~a/alisp" %logon% mk::%system-binaries%))
        (base 
         (format nil "~a/franz/~a/base.dxl" %logon% mk::%system-binaries%))
        (cheap (format nil "~a/bin/cheap" %logon%))
        (cheapo (format nil "~a/bin/cheapo" %logon%))
        (ace (format nil "~a/bin/ace" %logon%))
        (wait 300)
        (quantum 180))
    (setf *pvm-cpus*
      (list
       (make-cpu 
        :host (short-site-name)
        :spawn
        #+:linux (format nil "~a/franz/linux.x86.32/alisp" %logon%)
        #-:linux (format nil "~a/franz/macos.ppc.32/alisp" %logon%)
        :options (list "-I" "xle" "-qq" "-locale" "ISO-8859-1"
                       "-L" (format nil "~a/uib/client.lisp" %logon%))
        :class :norgram :grammar "NorGram (20-dec-06)" :name "xle" 
        :task '(:parse) :template "norgram/%t/%d/xle"
        :wait wait :quantum (* 2 quantum))
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "no_NO.UTF-8"
                       "-L" (format nil "~a/lingo/noen.lisp" %logon%))
        :class :noen :name "noen" :grammar "NoEn (2-jan-07)" 
        :task '(:transfer) :template "%s/%t/%d"
        :wait wait :quantum quantum)
       ;;
       ;; we have two distinct client definitions for the ERG, one for parsing
       ;; (using PET) and one for generation (using the LKB, out of necessity)
       ;;
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "no_NO.UTF-8"
                       "-L" (format nil "~a/lingo/erg.lisp" %logon%))
        :class :erg :grammar erg :task '(:parse :generate)
        :wait wait :quantum quantum)
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "no_NO.UTF-8"
                       "-L" (format nil "~a/lingo/logon.lisp" %logon%))
        :class '(:logon :no2en) :name "logon" :task '(:translate)
        :template "%s/%t/%d" :wait wait :quantum 7200)
       ;;
       ;; next, our Japanese -- English baby MT system
       ;;
       (make-cpu 
        :host (short-site-name)
        :spawn wrapper
        :options (append 
                  options
                  (list "-I" base "-qq" "-locale" "ja_JP.EUC" 
                        "-L" (format nil "~a/dfki/jacy.lisp" %logon%)))
        :class :jacy :name "lkb" :grammar jacy
        :task '(:parse :generate) :wait wait :quantum quantum)
       (make-cpu 
        :host (short-site-name)
        :spawn wrapper
        :options (append 
                  options
                  (list "-I" base "-qq" "-locale" "ja_JP.UTF-8"
                        "-L" (format nil "~a/lingo/jaen.lisp" %logon%)))
        :class :jaen :name "jaen" :grammar "JaEn (current)" 
        :task '(:transfer)
        :wait wait :quantum quantum)
       (make-cpu 
        :host (short-site-name)
        :spawn wrapper
        :options (append 
                  options
                  (list "-I" base "-qq" "-locale" "no_NO.UTF-8"
                        "-L" (format nil "~a/lingo/ja2en.lisp" %logon%)))
        :class :ja2en :name "ja2en" :task '(:translate)
        :template "%s/%t/%d" :wait wait :quantum 7200)
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "no_NO.UTF-8"
                       "-L" (format nil "~a/lingo/en2ja.lisp" %logon%))
        :class :en2ja :name "en2ja" :task '(:translate)
        :template "%s/%t/%d" :wait wait :quantum 7200)
       ;;
       ;; another baby MT pair: German -- English
       ;;
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "de_DE.UTF-8" 
                       "-L" (format nil "~a/dfki/gg.lisp" %logon%))
        :class :gg :name "lkb" :grammar gg
        :task '(:parse :generate) :wait 600 :quantum quantum)
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "de_DE.UTF-8"
                       "-L" (format nil "~a/lingo/deen.lisp" %logon%))
        :class :deen :name "lkb" :grammar "DeEn (28-jun-06)" 
        :task '(:transfer) :wait wait :quantum quantum)
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "no_NO.UTF-8"
                       "-L" (format nil "~a/lingo/de2en.lisp" %logon%))
        :class :de2en :name "de2en" :task '(:translate)
        :template "%s/%t/%d" :wait 900 :quantum 7200)
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "en_US.UTF-8"
                       "-L" (format nil "~a/lingo/ende.lisp" %logon%))
        :class :ende :name "lkb" :grammar "EnDe (28-jun-06)" 
        :task '(:transfer) :wait wait :quantum quantum)
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "en_US.UTF-8"
                       "-L" (format nil "~a/lingo/en2de.lisp" %logon%))
        :class :en2de :name "en2de" :task '(:translate)
        :template "%s/%t/%d" :wait 900 :quantum 7200)
       ;;
       ;; from here on, convenience cpu definitions for developers
       ;;
       (make-cpu 
        :host (short-site-name)
        :spawn cheap
        :options (list "-tsdb" "-yy" "-packing"
                       (format nil "~a/lingo/erg/english.grm" %logon%))
        :preprocessor "lkb::preprocess-for-pet"
        :class :cheap :grammar erg :name "pet" :task '(:parse)
        :wait wait :quantum quantum)
       (make-cpu 
        :host (short-site-name)
        :spawn cheapo
        :options (list "-tsdb" "-yy" "-packing"
                       (format nil "~a/lingo/erg/english.grm" %logon%))
        :preprocessor "lkb::preprocess-for-pet"
        :class :cheapo :grammar erg :name "peto" :task '(:parse)
        :wait wait :quantum quantum)
       (make-cpu 
        :host (short-site-name)
        :spawn ace
        :options (list "-g" (format nil "~a/lingo/erg/erg.ace" %logon%) "-t")
        :class :ape :grammar erg :name "ape" :task '(:parse) :wait wait)
       (make-cpu 
        :host (short-site-name)
        :spawn ace
        :options (list "-g" (format nil "~a/lingo/erg/erg.ace" %logon%)
                       "-e" "-t")
        :preprocessor "tsdb::answer-enrich-mrs"
        :class :age :grammar erg :name "ape" :task '(:generate) :wait wait)
       ;;
       ;; a group of external, early adopters: Norwegian -- Japanese at NTNU
       ;; 
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "no_NO.UTF-8" 
                       "-L" 
		       (format nil 
			       "~a/ntnu/norsource/lkb/norsource.lisp" 
			       %logon%))
        :class :norsource :name "norsource" :grammar "NorSource"
        :task '(:parse) :wait wait :quantum quantum)  
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "no_NO.UTF-8"
                       "-L" (format nil "~a/ntnu/noja/lkb/noja.lisp" %logon%))
        :class :noja :name "noja" :task '(:transfer)
        :template "%s/%t/%d" :wait wait)
       (make-cpu 
        :host (short-site-name)
        :spawn binary
        :options (list "-I" base "-qq" "-locale" "no_NO.UTF-8"
                       "-L" (format nil "~a/ntnu/noja/lkb/no2ja.lisp" %logon%))
        :class :no2ja :name "no2ja" :task '(:translate)
        :template "%s/%t/%d" :wait wait)))))