Add a couple of new functions to the schema framework to check if a trigger is a "standard" trigger or not, and to extract a jobid from a standard trigger. Both functions will be used in a later commit.
Ensure that the seed set_my_name function sets all the right initial info in the name services' structures. This commit was SVN r6760.
Этот коммит содержится в:
родитель
c530521a8e
Коммит
e583f6a97f
@ -64,6 +64,9 @@ int orte_schema_base_store_my_info(void);
|
||||
int orte_schema_base_get_std_trigger_name(char **name,
|
||||
char *trigger,
|
||||
orte_jobid_t jobid);
|
||||
bool orte_schema_base_check_std_trigger_name(char *name, char *trig);
|
||||
int orte_schema_base_extract_jobid_from_std_trigger_name(orte_jobid_t *jobid,
|
||||
char *trig);
|
||||
int orte_schema_base_get_std_subscription_name(char **name,
|
||||
char *subscription,
|
||||
orte_jobid_t jobid);
|
||||
|
@ -300,6 +300,40 @@ int orte_schema_base_get_std_trigger_name(char **name,
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
bool orte_schema_base_check_std_trigger_name(char *name, char *trig)
|
||||
{
|
||||
if (NULL == name || NULL == trig) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 == strncmp(name, trig, strlen(trig))) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int orte_schema_base_extract_jobid_from_std_trigger_name(orte_jobid_t *jobid, char *trig)
|
||||
{
|
||||
char *jobstring;
|
||||
orte_jobid_t job;
|
||||
int rc;
|
||||
|
||||
jobstring = strrchr(trig, '-');
|
||||
if (NULL == jobstring) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
jobstring++;
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_jobid(&job, jobstring))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
*jobid = job;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int orte_schema_base_get_std_subscription_name(char **name,
|
||||
char *subscription,
|
||||
orte_jobid_t jobid)
|
||||
|
@ -45,6 +45,8 @@ OMPI_DECLSPEC orte_schema_base_module_t orte_schema = {
|
||||
orte_schema_base_extract_jobid_from_segment_name,
|
||||
orte_schema_base_store_my_info,
|
||||
orte_schema_base_get_std_trigger_name,
|
||||
orte_schema_base_check_std_trigger_name,
|
||||
orte_schema_base_extract_jobid_from_std_trigger_name,
|
||||
orte_schema_base_get_std_subscription_name
|
||||
};
|
||||
|
||||
|
@ -62,6 +62,11 @@ typedef int (*orte_schema_get_std_trigger_name_fn_t)(char **name,
|
||||
char *trigger,
|
||||
orte_jobid_t jobid);
|
||||
|
||||
typedef int (*orte_schema_extract_jobid_from_std_trigger_name_fn_t)(orte_jobid_t *jobid,
|
||||
char *trigger);
|
||||
|
||||
typedef bool (*orte_schema_check_std_trigger_name_fn_t)(char *name, char *trigger);
|
||||
|
||||
typedef int (*orte_schema_get_std_subscription_name_fn_t)(char **name,
|
||||
char *subscription,
|
||||
orte_jobid_t jobid);
|
||||
@ -79,6 +84,8 @@ struct orte_schema_base_module_1_0_0_t {
|
||||
orte_schema_extract_jobid_from_segment_name_fn_t extract_jobid_from_segment_name;
|
||||
orte_schema_store_my_info_fn_t store_my_info;
|
||||
orte_schema_get_std_trigger_name_fn_t get_std_trigger_name;
|
||||
orte_schema_check_std_trigger_name_fn_t check_std_trigger_name;
|
||||
orte_schema_extract_jobid_from_std_trigger_name_fn_t extract_jobid_from_std_trigger_name;
|
||||
orte_schema_get_std_subscription_name_fn_t get_std_subscription_name;
|
||||
};
|
||||
|
||||
|
@ -124,16 +124,26 @@ orte_sds_base_basic_contact_universe(void)
|
||||
int
|
||||
orte_sds_base_seed_set_name(void)
|
||||
{
|
||||
int id, flag;
|
||||
|
||||
int id, flag, rc;
|
||||
|
||||
/* if we're a seed and we're not infrastructure, we're also a
|
||||
singleton. So set the singleton flag in that case */
|
||||
id = mca_base_param_register_int("orte", "base", "infrastructure",
|
||||
NULL, (int)false);
|
||||
id = mca_base_param_reg_int_name("orte_base", "infrastructure",
|
||||
"Whether we are ORTE infrastructure or an ORTE application",
|
||||
false, false, (int)false, NULL);;
|
||||
mca_base_param_lookup_int(id, &flag);
|
||||
if (!flag) {
|
||||
orte_process_info.singleton = true;
|
||||
}
|
||||
return orte_ns_base_create_process_name(
|
||||
&(orte_process_info.my_name), 0, 0, 0);
|
||||
/* now need to create our name in a manner that puts our job info on the name service
|
||||
* tracker. This is necessary so that
|
||||
* functions like get_job_peers will work. Since we are the seed, these
|
||||
* functions will always return the proper jobid=0, vpid=0 values
|
||||
*/
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.create_my_name())) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user