@@ -1262,6 +1262,7 @@ int cmd_list (optparse_t *p, int argc, char **argv)
12621262 json_t * value ;
12631263 uint32_t userid ;
12641264 int states = 0 ;
1265+ json_t * c ;
12651266
12661267 if (isatty (STDOUT_FILENO )) {
12671268 fprintf (stderr ,
@@ -1290,16 +1291,20 @@ int cmd_list (optparse_t *p, int argc, char **argv)
12901291 else
12911292 userid = getuid ();
12921293
1294+ if (!(c = json_pack ("{ s:[ {s:[i]}, {s:[i]} ] }" ,
1295+ "and" ,
1296+ "userid" , userid ,
1297+ "states" , states )))
1298+ log_msg_exit ("failed to construct constraint object" );
1299+
12931300 if (!(f = flux_rpc_pack (h ,
12941301 "job-list.list" ,
12951302 FLUX_NODEID_ANY ,
12961303 0 ,
1297- "{s:i s:[s] s:i s:i s:i }" ,
1304+ "{s:i s:[s] s:o }" ,
12981305 "max_entries" , max_entries ,
12991306 "attrs" , "all" ,
1300- "userid" , userid ,
1301- "states" , states ,
1302- "results" , 0 )))
1307+ "constraint" , c )))
13031308 log_err_exit ("flux_rpc_pack" );
13041309 if (flux_rpc_get_unpack (f , "{s:o}" , "jobs" , & jobs ) < 0 )
13051310 log_err_exit ("flux job-list.list" );
@@ -1327,6 +1332,7 @@ int cmd_list_inactive (optparse_t *p, int argc, char **argv)
13271332 json_t * jobs ;
13281333 size_t index ;
13291334 json_t * value ;
1335+ json_t * c ;
13301336
13311337 if (isatty (STDOUT_FILENO )) {
13321338 fprintf (stderr ,
@@ -1341,17 +1347,18 @@ int cmd_list_inactive (optparse_t *p, int argc, char **argv)
13411347 if (!(h = flux_open (NULL , 0 )))
13421348 log_err_exit ("flux_open" );
13431349
1350+ if (!(c = json_pack ("{s:[i]}" , "states" , FLUX_JOB_STATE_INACTIVE )))
1351+ log_msg_exit ("failed to construct constraint object" );
1352+
13441353 if (!(f = flux_rpc_pack (h ,
13451354 "job-list.list" ,
13461355 FLUX_NODEID_ANY ,
13471356 0 ,
1348- "{s:i s:f s:i s:i s:i s:[s] }" ,
1357+ "{s:i s:f s:[s] s:o }" ,
13491358 "max_entries" , max_entries ,
13501359 "since" , since ,
1351- "userid" , FLUX_USERID_UNKNOWN ,
1352- "states" , FLUX_JOB_STATE_INACTIVE ,
1353- "results" , 0 ,
1354- "attrs" , "all" )))
1360+ "attrs" , "all" ,
1361+ "constraint" , c )))
13551362 log_err_exit ("flux_rpc_pack" );
13561363 if (flux_rpc_get_unpack (f , "{s:o}" , "jobs" , & jobs ) < 0 )
13571364 log_err_exit ("flux job-list.list" );
0 commit comments