implement streaming for cli agent -c

This commit is contained in:
xenia 2021-01-04 03:01:33 -05:00
parent ce3866f236
commit 594d785641
2 changed files with 5 additions and 6 deletions

View File

@ -238,11 +238,11 @@
(~a (string-join (map ~a (sort (node-info-resources info) string<?)) ", ")) (~a (string-join (map ~a (sort (node-info-resources info) string<?)) ", "))
detailed-status))))) detailed-status)))))
(define (cmd-agent-create name arch resources out-port) (define (cmd-agent-create name arch resources out-port [progress-func void])
(with-server-connection (with-server-connection
(define id (new-agent name arch resources)) (define id (new-agent name arch resources))
;; TODO : streaming (define ft (get-agent-deployment id))
(write-bytes (get-agent-deployment id) out-port) (file-transfer-connect ft out-port progress-func)
id)) id))
(define (cmd-agent-delete id) (define (cmd-agent-delete id)
@ -409,7 +409,8 @@
(define out-name (make-random-filename)) (define out-name (make-random-filename))
(call-with-output-file out-name (call-with-output-file out-name
(lambda (o) (lambda (o)
(define aid (cmd-agent-create (flag-agent-name) (flag-agent-arch) (flag-agent-res) o)) (define aid (cmd-agent-create (flag-agent-name) (flag-agent-arch) (flag-agent-res) o print-progress))
(finish-progress)
(report-status "created agent ~a" aid))) (report-status "created agent ~a" aid)))
(do-final out-name)] (do-final out-name)]
[(list 'delete aid-str) [(list 'delete aid-str)

View File

@ -262,7 +262,6 @@
(define/contract (get-agent-deployment id) (define/contract (get-agent-deployment id)
(-> integer? file-transfer?) (-> integer? file-transfer?)
;; TODO : streaming interface
(enforce-subject 'client) (enforce-subject 'client)
(define-values [agent-node arch] (load-comms-node id #t #t)) (define-values [agent-node arch] (load-comms-node id #t #t))
(match (node-type agent-node) (match (node-type agent-node)
@ -371,7 +370,6 @@
(define/contract (get-project-file taskid) (define/contract (get-project-file taskid)
(-> integer? file-transfer?) (-> integer? file-transfer?)
;; TODO : streaming interface
(match (server-get-file taskid) (match (server-get-file taskid)
[#f (error "no such project file")] [#f (error "no such project file")]
[port (make-file-transfer port)])) [port (make-file-transfer port)]))