Megatest

Check-in [ed59d29798]
Login
Overview
Comment:Committing latest tquery branch
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | v1.6518-tquery
Files: files | file ages | folders
SHA1: ed59d297988963292cb5f31798edb2c095027d2c
User & Date: jmoon18 on 2019-01-22 17:11:11
Other Links: branch diff | manifest | tags
Context
2019-01-22
17:11
Committing latest tquery branch Leaf check-in: ed59d29798 user: jmoon18 tags: v1.6518-tquery
2019-01-11
17:28
Integrating tquery into 1.65 branch check-in: c6ecb4ee03 user: jmoon18 tags: v1.6518-tquery
Changes

Modified common.scm from [44ab2406f8] to [a5de10839e].

1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566

1567
1568
1569
1570
1571
1572
1573
1574
1575




1576


1577
1578
1579
1580
1581
1582
1583
    (begin
    (with-input-from-file (pathname-expand "~/.megatest/tquery")
      (lambda()
        (set! tqfilecontents (read-string))
      ))
    (handle-exceptions exn 
      (lambda()
       (sleep 1)
       (common:get-normalized-cpu-load remote-host)
      )
      (set! tqfileparts (string-split (string-trim-both tqfilecontents) ":"))
    )
    ;;(print "TQuery host: " (car tqfileparts)) 
    ;;(print "TQuery port " (cadr tqfileparts))
    ;;(print "Getting normalized cpu load for : " remote-host " via " (car tqfileparts) ":" (cadr tqfileparts))
    )
    (begin
      (process-run "nbfake tquery -server -")
      (sleep 2)
    )
  )
  (handle-exceptions exn 
    (lambda()
      ;;(print "Need to start tquery server here:")

      (process-run "nbfake tquery -server -")
      (sleep 2)
      (common:get-normalized-cpu-load remote-host)
    )
    ;;(print "Preparing to connect to get load")
    (define-values (i o) (tcp-connect (car tqfileparts) (string->number (cadr tqfileparts)))) 
    ;;(define-values (i o) (tcp-connect "plxcas102" 9000)) 
    (write-line (conc "adj-cpuload-full:" (if remote-host remote-host (get-host-name))) o) 
    ;;(write-line "adj-cpuload-full:plxcm5005" o) 




    (with-input-from-string (read-line i) read)


  )
)


(define (common:get-normalized-cpu-load-original remote-host)
  (let ((res (common:get-normalized-cpu-load-raw-original remote-host))
	(default `((adj-proc-load . 2) ;; there is no right answer







|










|



|

>

|



|

|

>
>
>
>
|
>
>







1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
    (begin
    (with-input-from-file (pathname-expand "~/.megatest/tquery")
      (lambda()
        (set! tqfilecontents (read-string))
      ))
    (handle-exceptions exn 
      (lambda()
       (sleep 5)
       (common:get-normalized-cpu-load remote-host)
      )
      (set! tqfileparts (string-split (string-trim-both tqfilecontents) ":"))
    )
    ;;(print "TQuery host: " (car tqfileparts)) 
    ;;(print "TQuery port " (cadr tqfileparts))
    ;;(print "Getting normalized cpu load for : " remote-host " via " (car tqfileparts) ":" (cadr tqfileparts))
    )
    (begin
      (process-run "nbfake tquery -server -")
      (sleep 5)
    )
  )
  (handle-exceptions exn 
    (begin
      ;;(print "Need to start tquery server here:")
      (delete-file* (pathname-expand "~/.megatest/tquery"))
      (process-run "nbfake tquery -server -")
      (sleep 5)
      (common:get-normalized-cpu-load remote-host)
    )
    ;;(print "Preparing to connect to get load")
    ;;;;(define-values (i o) (tcp-connect (car tqfileparts) (string->number (cadr tqfileparts)))) 
    ;;(define-values (i o) (tcp-connect "plxcas102" 9000)) 
    ;;;;(write-line (conc "adj-cpuload-full:" (if remote-host remote-host (get-host-name))) o) 
    ;;(write-line "adj-cpuload-full:plxcm5005" o) 
    ;;;;(with-input-from-string (read-line i) read)

    (let*-values (((i o) (tcp-connect (car tqfileparts) (string->number (cadr tqfileparts))))) 
      (write-line (conc "adj-cpuload-full:" (if remote-host remote-host (get-host-name))) o) 
      (with-input-from-string (read-line i) read)
    )
    ;;(if connection-successful tquery-output (begin (delete-file* (pathname-expand "~/.megatest/tquery")) (common:get-normalized-cpu-load remote-host)))
  )
)


(define (common:get-normalized-cpu-load-original remote-host)
  (let ((res (common:get-normalized-cpu-load-raw-original remote-host))
	(default `((adj-proc-load . 2) ;; there is no right answer
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
                     (common:get-homehost)))
         (hh     (if hh-dat (car hh-dat) #f))
         (numcpus (common:get-num-cpus hh)))
    (common:wait-for-normalized-load maxload msg hh)))

(define (common:get-num-cpus remote-host)
  (handle-exceptions exn 
    (lambda() 
      2 
    )
    (alist-ref 'core (common:get-normalized-cpu-load remote-host))
  )
)

(define (common:get-num-cpus-orig remote-host)
  (let* ((actual-host (or remote-host (get-host-name))))
    (or (common:get-cached-info actual-host "num-cpus" age: 86400) ;; hosts had better not be changing the number of cpus too often!







<
|
<







1819
1820
1821
1822
1823
1824
1825

1826

1827
1828
1829
1830
1831
1832
1833
                     (common:get-homehost)))
         (hh     (if hh-dat (car hh-dat) #f))
         (numcpus (common:get-num-cpus hh)))
    (common:wait-for-normalized-load maxload msg hh)))

(define (common:get-num-cpus remote-host)
  (handle-exceptions exn 

    2 

    (alist-ref 'core (common:get-normalized-cpu-load remote-host))
  )
)

(define (common:get-num-cpus-orig remote-host)
  (let* ((actual-host (or remote-host (get-host-name))))
    (or (common:get-cached-info actual-host "num-cpus" age: 86400) ;; hosts had better not be changing the number of cpus too often!