scsh-make/test-jobd.scm

35 lines
964 B
Scheme
Raw Normal View History

(define j-cwd "/home/johannes")
(define j-env (env->alist))
(define j-cmd "find /afs -name nonexistant")
(define j-descr (make-job-desc j-cwd j-env j-cmd))
(define j-cmds
(list (list "leo-dict" "detractors")
(list "ipcs" "-a")
(list "leo-dict" "schism")
(list "find" "studium" "-name" "*.txt")
(list "/bin/sh" "-c" "/bin/cat /var/tmp/*")
(list "ls" "-l")
(list "ps" "-eF")))
(define j-descrs
(let ((jdes (lambda (j-cmd) (make-job-desc j-cwd j-env j-cmd))))
(map jdes j-cmds)))
(define (do-some-jobs)
(let ((ch (cml-sync-ch/make-channel))
(start-parallel (jobd/set-jobbers! 3))
(jobd (jobd/make-jobd)))
(spawn
(lambda ()
(let* ((res-rvs (map jobd/execute j-descrs (circular-list jobd)))
(j-res (map cml-rv/sync res-rvs)))
(map display-job-output j-res)
(cml-sync-ch/send ch "done.")))
'test-jobd)
(sleep 50)
(jobd/stop jobd)
(sleep 40000)
(jobd/continue jobd)
(cml-sync-ch/receive ch)))