1
1

Added some user friendly output to the hostfile RDS component.

This is more of a usability feature, but a very useful one. So I 
suggest that it go into the release branches.

This commit was SVN r10153.
Этот коммит содержится в:
Josh Hursey 2006-05-31 20:07:59 +00:00
родитель 8a22272ffb
Коммит bb95df9bf2
3 изменённых файлов: 95 добавлений и 7 удалений

Просмотреть файл

@ -19,6 +19,7 @@
# Use the top-level Makefile.options
dist_pkgdata_DATA = help-rds-hostfile.txt
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la

54
orte/mca/rds/hostfile/help-rds-hostfile.txt Обычный файл
Просмотреть файл

@ -0,0 +1,54 @@
# -*- text -*-
#
# Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This is the US/English general help file for Open RTE's RDS component.
#
[rds:no-hostfile]
Open RTE was unable to open the hostfile:
%s
Check to make sure the path and filename are correct.
[rds:slots]
Open RTE detected a bad parameter in the hostfile:
%s
The slots parameter is less than 0:
slots=%d
[rds:max_slots]
Open RTE detected a bad parameter in the hostfile:
%s
The max_slots parameter is less than 0:
max_slots=%d
[rds:max_slots_lt]
Open RTE detected a bad parameter in the hostfile:
%s
The max_slots parameter is less than the slots parameter:
slots=%d
max_slots=%d
[rds:parse_error_string]
Open RTE detected a parse error in the hostfile:
%s
It occured on line number %d on token %d:
%s
[rds:parse_error_int]
Open RTE detected a parse error in the hostfile:
%s
It occured on line number %d on token %d:
%d
[rds:parse_error]
Open RTE detected a parse error in the hostfile:
%s
It occured on line number %d on token %d.

Просмотреть файл

@ -27,6 +27,8 @@
#include "opal/util/argv.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/util/show_help.h"
#include "orte/orte_constants.h"
#include "orte/util/sys_info.h"
#include "orte/mca/ns/ns.h"
@ -42,22 +44,34 @@
static orte_cellid_t local_cellid;
static bool need_cellid = true;
static char *cur_hostfile_name = NULL;
static void orte_rds_hostfile_parse_error(int token)
{
switch (token) {
case ORTE_RDS_HOSTFILE_STRING:
opal_output(0, "Error reading hostfile at line %d: token:%d %s\n",
orte_rds_hostfile_line, token, orte_rds_hostfile_value.sval);
opal_show_help("help-rds-hostfile.txt", "rds:parse_error_string",
true,
cur_hostfile_name,
orte_rds_hostfile_line,
token,
orte_rds_hostfile_value.sval);
break;
case ORTE_RDS_HOSTFILE_IPV4:
case ORTE_RDS_HOSTFILE_INT:
opal_output(0, "Error reading hostfile at line %d: token:%d %d\n",
orte_rds_hostfile_line, token, orte_rds_hostfile_value.ival);
opal_show_help("help-rds-hostfile.txt", "rds:parse_error_int",
true,
cur_hostfile_name,
orte_rds_hostfile_line,
token,
orte_rds_hostfile_value.ival);
break;
default:
opal_output(0, "Error reading hostfile at line %d token:%d\n",
orte_rds_hostfile_line, token);
opal_show_help("help-rds-hostfile.txt", "rds:parse_error",
true,
cur_hostfile_name,
orte_rds_hostfile_line,
token );
break;
}
}
@ -220,6 +234,9 @@ static int orte_rds_hostfile_parse_line(int token, opal_list_t* existing, opal_l
case ORTE_RDS_HOSTFILE_SLOTS:
rc = orte_rds_hostfile_parse_int();
if (rc < 0) {
opal_show_help("help-rds-hostfile.txt", "rds:slots",
true,
cur_hostfile_name, rc);
OBJ_RELEASE(node);
return ORTE_ERROR;
}
@ -236,6 +253,9 @@ static int orte_rds_hostfile_parse_line(int token, opal_list_t* existing, opal_l
case ORTE_RDS_HOSTFILE_SLOTS_MAX:
rc = orte_rds_hostfile_parse_int();
if (rc < 0) {
opal_show_help("help-rds-hostfile.txt", "rds:max_slots",
true,
cur_hostfile_name, ((size_t) rc));
OBJ_RELEASE(node);
return ORTE_ERROR;
}
@ -246,6 +266,9 @@ static int orte_rds_hostfile_parse_line(int token, opal_list_t* existing, opal_l
update = true;
}
} else {
opal_show_help("help-rds-hostfile.txt", "rds:max_slots_lt",
true,
cur_hostfile_name, node->node_slots, rc);
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
OBJ_RELEASE(node);
return ORTE_ERROR;
@ -282,10 +305,15 @@ static int orte_rds_hostfile_parse(const char *hostfile, opal_list_t* existing,
int rc = ORTE_SUCCESS;
OPAL_LOCK(&mca_rds_hostfile_component.lock);
cur_hostfile_name = strdup(hostfile);
orte_rds_hostfile_done = false;
orte_rds_hostfile_in = fopen(hostfile, "r");
if (NULL == orte_rds_hostfile_in) {
opal_show_help("help-rds-hostfile.txt", "rds:no-hostfile",
true,
cur_hostfile_name);
rc = ORTE_ERR_NOT_FOUND;
goto unlock;
}
@ -326,6 +354,11 @@ static int orte_rds_hostfile_parse(const char *hostfile, opal_list_t* existing,
orte_rds_hostfile_in = NULL;
unlock:
if(NULL != cur_hostfile_name) {
free(cur_hostfile_name);
cur_hostfile_name = NULL;
}
OPAL_UNLOCK(&mca_rds_hostfile_component.lock);
return rc;
}