@@ -14,7 +14,8 @@ use crate::clients::{self, AdminClientInterface, batch_execute};
1414use crate :: ui:: invocations:: render_simple_invocation_list;
1515
1616use crate :: commands:: invocations:: {
17- DEFAULT_BATCH_INVOCATIONS_OPERATION_LIMIT , create_query_filter,
17+ DEFAULT_BATCH_INVOCATIONS_OPERATION_LIMIT , DEFAULT_BATCH_INVOCATIONS_OPERATION_PRINT_LIMIT ,
18+ create_query_filter,
1819} ;
1920use anyhow:: { Result , anyhow, bail} ;
2021use cling:: prelude:: * ;
@@ -41,7 +42,7 @@ pub struct Resume {
4142 #[ clap( long) ]
4243 deployment : Option < String > ,
4344 /// Limit the number of fetched invocations
44- #[ clap( long, default_value = " DEFAULT_BATCH_INVOCATIONS_OPERATION_LIMIT" ) ]
45+ #[ clap( long, default_value_t = DEFAULT_BATCH_INVOCATIONS_OPERATION_LIMIT ) ]
4546 limit : usize ,
4647}
4748
@@ -64,21 +65,30 @@ pub async fn run_resume(State(env): State<CliEnv>, opts: &Resume) -> Result<()>
6465 ) ;
6566 } ;
6667
67- render_simple_invocation_list ( & invocations, DEFAULT_BATCH_INVOCATIONS_OPERATION_LIMIT ) ;
68+ render_simple_invocation_list (
69+ & invocations,
70+ DEFAULT_BATCH_INVOCATIONS_OPERATION_PRINT_LIMIT ,
71+ ) ;
6872
6973 // Get the invocation and confirm
7074 confirm_or_exit ( "Are you sure you want to resume these invocations?" ) ?;
7175
7276 // Resume invocations
73- let deployment = opts. deployment . as_deref ( ) ;
74- let ( resumed, failed_to_resume) =
75- batch_execute ( client, invocations, |client, invocation| async move {
77+ let deployment = opts. deployment . clone ( ) ;
78+ let ( resumed, failed_to_resume) = batch_execute (
79+ client,
80+ invocations
81+ . into_iter ( )
82+ . map ( |i| ( i, deployment. clone ( ) ) )
83+ . collect ( ) ,
84+ |client, ( invocation, deployment) | async move {
7685 client
77- . resume_invocation ( & invocation. id , deployment)
86+ . resume_invocation ( & invocation. id , deployment. as_deref ( ) )
7887 . await
7988 . map_err ( anyhow:: Error :: from)
80- } )
81- . await ;
89+ } ,
90+ )
91+ . await ;
8292 let succeeded_count = resumed. len ( ) ;
8393 let failed_count = failed_to_resume. len ( ) ;
8494
@@ -90,7 +100,7 @@ pub async fn run_resume(State(env): State<CliEnv>, opts: &Resume) -> Result<()>
90100 c_warn ! ( "Failed to resume:" ) ;
91101 let mut failed_to_restart_table = Table :: new_styled ( ) ;
92102 failed_to_restart_table. set_styled_header ( vec ! [ "ID" , "REASON" ] ) ;
93- for ( inv, reason) in failed_to_resume {
103+ for ( ( inv, _ ) , reason) in failed_to_resume {
94104 failed_to_restart_table. add_row ( vec ! [
95105 Cell :: new( & inv. id) ,
96106 Cell :: new( reason) . fg( Color :: DarkRed ) ,
0 commit comments