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<?)) ", "))
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
(define id (new-agent name arch resources))
;; TODO : streaming
(write-bytes (get-agent-deployment id) out-port)
(define ft (get-agent-deployment id))
(file-transfer-connect ft out-port progress-func)
id))
(define (cmd-agent-delete id)
@ -409,7 +409,8 @@
(define out-name (make-random-filename))
(call-with-output-file out-name
(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)))
(do-final out-name)]
[(list 'delete aid-str)

View File

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