Skip to content

Commit fcf599f

Browse files
committed
job-info: return job id after lookup
Problem: If a user wishes to send multiple job info lookups in parallel, they have to track which lookups belong to which job ids. This can be a tad inconvenient. Solution: Return the job id in the lookup response along with the information that was looked up.
1 parent 1008094 commit fcf599f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/modules/job-info/lookup.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ static void info_lookup_continuation (flux_future_t *fall, void *arg)
160160
size_t index;
161161
json_t *key;
162162
json_t *o = NULL;
163+
json_t *tmp = NULL;
163164
char *data = NULL;
164165

165166
if (!l->allow) {
@@ -184,6 +185,12 @@ static void info_lookup_continuation (flux_future_t *fall, void *arg)
184185
if (!(o = json_object ()))
185186
goto enomem;
186187

188+
tmp = json_integer (l->id);
189+
if (json_object_set_new (o, "id", tmp) < 0) {
190+
json_decref (tmp);
191+
goto enomem;
192+
}
193+
187194
json_array_foreach(l->keys, index, key) {
188195
flux_future_t *f;
189196
const char *keystr;

0 commit comments

Comments
 (0)