@@ -7,6 +7,7 @@ use crate::{
77 store:: { Store as _, filestore:: LocalFileStore } ,
88 } ,
99} ;
10+ use colored:: Colorize as _;
1011use derive_more:: Display ;
1112use futures_executor:: block_on;
1213use futures_util:: future:: join_all;
@@ -70,9 +71,9 @@ impl AgentClient {
7071 } ) ?,
7172 } )
7273 }
73- /// Submit many pod jobs to be processed in parallel.
74+ /// Start many pod jobs to be processed in parallel.
7475 /// Return order will match inputs, casting outputs to `String` (since `uniffi` doesn't support sending unwrapped `Result`s).
75- pub async fn submit_pod_jobs ( & self , pod_jobs : Vec < Arc < PodJob > > ) -> Vec < Response > {
76+ pub async fn start_pod_jobs ( & self , pod_jobs : Vec < Arc < PodJob > > ) -> Vec < Response > {
7677 join_all ( pod_jobs. iter ( ) . map ( |pod_job| async {
7778 match self
7879 . publish ( & format ! ( "request/pod_job/{}" , pod_job. hash) , pod_job)
@@ -98,7 +99,7 @@ impl AgentClient {
9899 . context ( selector:: AgentCommunicationFailure { } ) ?;
99100 while let Ok ( sample) = subscriber. recv_async ( ) . await {
100101 let value = serde_json:: from_slice :: < Value > ( & sample. payload ( ) . to_bytes ( ) ) ?;
101- println ! ( "{}: {value:#}" , sample. key_expr( ) . as_str( ) ) ;
102+ println ! ( "{}: {value:#}" , sample. key_expr( ) . as_str( ) . yellow ( ) ) ;
102103 }
103104 Ok ( ( ) )
104105 }
@@ -162,13 +163,19 @@ impl Agent {
162163 Ok ( pod_result)
163164 } ,
164165 async |client, pod_result| {
165- let response_topic = match & pod_result. status {
166- Status :: Completed => & format ! ( "success/pod_job/{}" , pod_result. pod_job. hash) ,
167- Status :: Running | Status :: Failed ( _) | Status :: Unset => {
168- & format ! ( "failure/pod_job/{}" , pod_result. pod_job. hash)
169- }
170- } ;
171- client. publish ( response_topic, & pod_result) . await
166+ client
167+ . publish (
168+ & format ! (
169+ "{}/pod_job/{}" ,
170+ match & pod_result. status {
171+ Status :: Completed => "success" ,
172+ Status :: Running | Status :: Failed ( _) | Status :: Unset => "failure" ,
173+ } ,
174+ pod_result. pod_job. hash
175+ ) ,
176+ & pod_result,
177+ )
178+ . await
172179 } ,
173180 ) ) ;
174181 if let Some ( store) = available_store {
0 commit comments