|
50 | 50 | #include "pmix_server_internal.h" |
51 | 51 | #include "pmix_server.h" |
52 | 52 |
|
| 53 | +static void mycbfunc(int status, void *cbdata); |
| 54 | + |
53 | 55 | /* stuff proc attributes for sending back to a proc */ |
54 | 56 | int orte_pmix_server_register_nspace(orte_job_t *jdata, bool force) |
55 | 57 | { |
@@ -472,5 +474,67 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata, bool force) |
472 | 474 | info, NULL, NULL); |
473 | 475 | OPAL_LIST_RELEASE(info); |
474 | 476 |
|
| 477 | + /* if the user has connected us to an external server, then we must |
| 478 | + * assume there is going to be some cross-mpirun exchange, and so |
| 479 | + * we protect against that situation by publishing the job info |
| 480 | + * for this job - this allows any subsequent "connect" to retrieve |
| 481 | + * the job info */ |
| 482 | + if (NULL != orte_data_server_uri) { |
| 483 | + opal_buffer_t buf; |
| 484 | + |
| 485 | + OBJ_CONSTRUCT(&buf, opal_buffer_t); |
| 486 | + if (OPAL_SUCCESS != (rc = opal_dss.pack(&buf, &jdata, 1, ORTE_JOB))) { |
| 487 | + ORTE_ERROR_LOG(rc); |
| 488 | + OBJ_DESTRUCT(&buf); |
| 489 | + return rc; |
| 490 | + } |
| 491 | + info = OBJ_NEW(opal_list_t); |
| 492 | + /* create a key-value with the key being the string jobid |
| 493 | + * and the value being the byte object */ |
| 494 | + kv = OBJ_NEW(opal_value_t); |
| 495 | + orte_util_convert_jobid_to_string(&kv->key, jdata->jobid); |
| 496 | + kv->type = OPAL_BYTE_OBJECT; |
| 497 | + opal_dss.unload(&buf, (void**)&kv->data.bo.bytes, &kv->data.bo.size); |
| 498 | + OBJ_DESTRUCT(&buf); |
| 499 | + opal_list_append(info, &kv->super); |
| 500 | + |
| 501 | + /* set the range to be session */ |
| 502 | + kv = OBJ_NEW(opal_value_t); |
| 503 | + kv->key = strdup(OPAL_PMIX_RANGE); |
| 504 | + kv->type = OPAL_UINT; |
| 505 | + kv->data.uint = OPAL_PMIX_RANGE_SESSION; |
| 506 | + opal_list_append(info, &kv->super); |
| 507 | + |
| 508 | + /* set the persistence to be app */ |
| 509 | + kv = OBJ_NEW(opal_value_t); |
| 510 | + kv->key = strdup(OPAL_PMIX_PERSISTENCE); |
| 511 | + kv->type = OPAL_INT; |
| 512 | + kv->data.integer = OPAL_PMIX_PERSIST_APP; |
| 513 | + opal_list_append(info, &kv->super); |
| 514 | + |
| 515 | + /* add our effective userid to the directives */ |
| 516 | + kv = OBJ_NEW(opal_value_t); |
| 517 | + kv->key = strdup(OPAL_PMIX_USERID); |
| 518 | + kv->type = OPAL_UINT32; |
| 519 | + kv->data.uint32 = geteuid(); |
| 520 | + opal_list_append(info, &kv->super); |
| 521 | + |
| 522 | + /* now publish it */ |
| 523 | + if (ORTE_SUCCESS != (rc = pmix_server_publish_fn(ORTE_PROC_MY_NAME, |
| 524 | + info, mycbfunc, info))) { |
| 525 | + ORTE_ERROR_LOG(rc); |
| 526 | + } |
| 527 | + } |
| 528 | + |
475 | 529 | return rc; |
476 | 530 | } |
| 531 | + |
| 532 | +static void mycbfunc(int status, void *cbdata) |
| 533 | +{ |
| 534 | + opal_list_t *info = (opal_list_t*)cbdata; |
| 535 | + |
| 536 | + if (ORTE_SUCCESS != status) { |
| 537 | + ORTE_ERROR_LOG(status); |
| 538 | + } |
| 539 | + OPAL_LIST_RELEASE(info); |
| 540 | +} |
0 commit comments