@@ -230,6 +230,21 @@ impl Job {
230230 Ok ( ( ) )
231231 }
232232
233+ pub async fn update_node ( & mut self , client : & reqwest:: Client , base_url : & str ) -> JobResult {
234+
235+ let cluster = self . node . cluster . clone ( ) . unwrap ( ) ;
236+ if let Ok ( nodes) = inventories:: fetch_nodes ( & client, base_url, & self . site , & cluster) . await {
237+
238+ let node: Node = nodes. into_iter ( ) . find ( |node| node. uid == self . node . uid ) . unwrap ( ) ;
239+
240+ debug ! ( "Cluster : {} ; Node : {} ; os : {:?}" , cluster, node. uid, node. operating_system) ;
241+ self . node = node;
242+ } else {
243+ warn ! ( "Could not gather nodes" ) ;
244+ }
245+ Ok ( ( ) )
246+ }
247+
233248}
234249
235250#[ derive( Debug , Serialize , Deserialize , Clone ) ]
@@ -316,8 +331,8 @@ impl Jobs {
316331 job. submit_job ( ) . await ?;
317332 self . jobs . push ( job) ;
318333 info ! ( "Job submitted for {} node" , node_uid) ;
319- info ! ( "Wait 1 secondes before another submission" ) ;
320- tokio:: time:: sleep ( Duration :: from_secs ( 1 ) ) . await ;
334+ info ! ( "Wait 100 ms before another submission" ) ;
335+ tokio:: time:: sleep ( Duration :: from_millis ( 100 ) ) . await ;
321336
322337 self . check_unfinished_jobs ( & client, super :: BASE_URL , jobs_file)
323338 . await ?;
@@ -354,7 +369,7 @@ impl Jobs {
354369 job. oar_job_id, job. state
355370 ) ;
356371 }
357- tokio:: time:: sleep ( Duration :: from_secs ( 5 ) ) . await ;
372+ tokio:: time:: sleep ( Duration :: from_millis ( 100 ) ) . await ;
358373 }
359374
360375 self . dump_to_file ( file_to_dump_to) ?;
0 commit comments