1212 * All rights reserved.
1313 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1414 * reserved.
15- * Copyright (c) 2016 Intel, Inc. All rights reserved.
15+ * Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
1616 * $COPYRIGHT$
1717 *
1818 * Additional copyrights may follow
3333#include "opal/mca/pmix/base/base.h"
3434
3535#include "orte/util/proc_info.h"
36+ #include "orte/util/show_help.h"
3637#include "orte/mca/schizo/schizo.h"
3738
3839#include "orte/mca/ess/ess.h"
@@ -131,6 +132,32 @@ static int component_query(mca_base_module_t **module, int *priority)
131132 return ORTE_ERROR ;
132133 }
133134
135+ /* we may be incorrectly trying to run as a singleton - e.g.,
136+ * someone direct-launched us under SLURM without building
137+ * ORTE --with-slurm or in a slurm environment (so we didn't
138+ * autodetect slurm). Try to detect that here. Sadly, we
139+ * cannot just use the schizo framework to help us here as
140+ * the corresponding schizo component may not have even
141+ * been build. So we have to do things a little uglier */
142+
143+ if (ORTE_SCHIZO_UNMANAGED_SINGLETON == ret ) {
144+ /* see if we are in a SLURM allocation */
145+ if (NULL != getenv ("SLURM_NODELIST" )) {
146+ /* emit a hopefully helpful error message and abort */
147+ orte_show_help ("help-ess-base.txt" , "slurm-error2" , true);
148+ * module = NULL ;
149+ * priority = 0 ;
150+ return ORTE_ERR_SILENT ;
151+ }
152+ /* see if we are under ALPS */
153+ if (NULL != getenv ("ALPS_APP_ID" )) {
154+ orte_show_help ("help-ess-base.txt" , "alps-error2" , true);
155+ * module = NULL ;
156+ * priority = 0 ;
157+ return ORTE_ERR_SILENT ;
158+ }
159+ }
160+
134161 /* okay, we want to be selected as we must be a singleton */
135162 * priority = 100 ;
136163 * module = (mca_base_module_t * )& orte_ess_singleton_module ;
@@ -142,4 +169,3 @@ static int component_close(void)
142169{
143170 return ORTE_SUCCESS ;
144171}
145-
0 commit comments