Add new info key for publish that allows user to designate that the port is to be unique - i.e., to return an error if that service has already been published. Default is to overwrite
This commit was SVN r29028.
Этот коммит содержится в:
родитель
72b5e867ab
Коммит
bebe852057
@ -132,6 +132,7 @@ static int publish ( char *service_name, ompi_info_t *info, char *port_name )
|
||||
opal_buffer_t buf;
|
||||
orte_data_server_cmd_t cmd=ORTE_DATA_SERVER_PUBLISH;
|
||||
orte_std_cntr_t cnt;
|
||||
bool unique=false;
|
||||
|
||||
ompi_info_get_bool(info, "ompi_global_scope", &global_scope, &flag);
|
||||
|
||||
@ -172,6 +173,12 @@ static int publish ( char *service_name, ompi_info_t *info, char *port_name )
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
service_name, global_scope ? "Global" : "Local"));
|
||||
|
||||
ompi_info_get_bool(info, "ompi_unique", &unique, &flag);
|
||||
if (0 == flag) {
|
||||
/* uniqueness not specified - overwrite by default */
|
||||
unique = false;
|
||||
}
|
||||
|
||||
/* construct the buffer */
|
||||
OBJ_CONSTRUCT(&buf, opal_buffer_t);
|
||||
|
||||
@ -193,6 +200,12 @@ static int publish ( char *service_name, ompi_info_t *info, char *port_name )
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* pack the uniqueness flag */
|
||||
if (OPAL_SUCCESS != (rc = opal_dss.pack(&buf, &unique, 1, OPAL_BOOL))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* send the data */
|
||||
if (0 > (rc = orte_rml.send_buffer(info_host, &buf, ORTE_RML_TAG_DATA_SERVER, 0))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
|
@ -163,13 +163,14 @@ void orte_data_server(int status, orte_process_name_t* sender,
|
||||
orte_data_object_t *data;
|
||||
opal_buffer_t *answer;
|
||||
int rc, ret;
|
||||
count = 1;
|
||||
bool unique;
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
||||
"%s data server got message from %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(sender)));
|
||||
|
||||
count = 1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &command, &count, ORTE_DATA_SERVER_CMD))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return;
|
||||
@ -193,16 +194,26 @@ void orte_data_server(int status, orte_process_name_t* sender,
|
||||
goto SEND_ERROR;
|
||||
}
|
||||
|
||||
/* unpack uniqueness flag */
|
||||
count = 1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &unique, &count, OPAL_BOOL))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto SEND_ERROR;
|
||||
}
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
||||
"%s data server: publishing service %s port %s",
|
||||
"%s data server: publishing service %s port %s %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
service_name, port_name));
|
||||
service_name, port_name,
|
||||
unique ? "UNIQUE" : "OVERWRITE"));
|
||||
|
||||
/* check the current data store to see if this service name has already
|
||||
* been published
|
||||
*/
|
||||
if (NULL != lookup(service_name)) {
|
||||
/* already exists - return ORTE_EXISTS error code */
|
||||
if (NULL != (data = lookup(service_name))) {
|
||||
/* already exists - see if overwrite allowed */
|
||||
if (unique) {
|
||||
/* return ORTE_EXISTS error code */
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
||||
"%s data server: publishing service %s port %s already exists",
|
||||
@ -210,6 +221,19 @@ void orte_data_server(int status, orte_process_name_t* sender,
|
||||
service_name, port_name));
|
||||
|
||||
ret = ORTE_EXISTS;
|
||||
} else {
|
||||
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
||||
"%s data server: overwriting service %s with port %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
service_name, port_name));
|
||||
if (NULL != data->port) {
|
||||
free(data->port);
|
||||
}
|
||||
data->port = port_name;
|
||||
data->owner.jobid = sender->jobid;
|
||||
data->owner.vpid = sender->vpid;
|
||||
ret = ORTE_SUCCESS;
|
||||
}
|
||||
if (ORTE_SUCCESS != (rc = opal_dss.pack(answer, &ret, 1, OPAL_INT))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
/* if we can't pack it, we probably can't pack the
|
||||
@ -217,6 +241,7 @@ void orte_data_server(int status, orte_process_name_t* sender,
|
||||
*/
|
||||
}
|
||||
goto SEND_ANSWER;
|
||||
|
||||
}
|
||||
|
||||
/* create a new data object */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user