File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed
Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 3838 nonzero exit code.
3939
4040 * - :option: `hwloc.xmlfile `
41- - Write hwloc XML gathered by job to a file and set ``HWLOC_XMLFILE ``
41+ - Write hwloc XML gathered by job to a file and set ``HWLOC_XMLFILE ``.
42+ Note that this option will also unset ``HWLOC_COMPONENTS `` if set, since
43+ presence of this environment variable may cause hwloc to ignore
44+ ``HWLOC_XMLFILE ``.
4245
4346 * - :option: `output.limit `
4447 - Set KVS output limit to SIZE bytes, where SIZE may be a floating point
Original file line number Diff line number Diff line change @@ -449,6 +449,8 @@ plugins include:
449449.. option :: hwloc.xmlfile
450450
451451 Write the job shell's copy of hwloc XML to a file and set ``HWLOC_XMLFILE ``.
452+ Note that this option will also unset ``HWLOC_COMPONENTS `` since presence
453+ of this environment variable may cause hwloc to ignore ``HWLOC_XMLFILE ``.
452454
453455.. warning ::
454456 The directory referenced by :envvar: `FLUX_JOB_TMPDIR ` is cleaned up when the
Original file line number Diff line number Diff line change @@ -62,6 +62,14 @@ static int create_xmlfile (flux_shell_t *shell)
6262 shell_log_errno ("failed to set HWLOC_XMLFILE in job environment" );
6363 goto error ;
6464 }
65+ /* Note: HWLOC_XMLFILE will be ignored if HWLOC_COMPONENTS is also set
66+ * in the environment, so unset that variable here.
67+ */
68+ if (flux_shell_unsetenv (shell , "HWLOC_COMPONENTS" ) < 0
69+ && errno != ENOENT ) {
70+ shell_log_errno ("failed to unset HWLOC_COMPONENTS" );
71+ goto error ;
72+ }
6573 return 0 ;
6674error :
6775 if (fd >= 0 )
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ test_expect_success 'shell: HWLOC_XMLFILE is not set for normal jobs' '
1414test_expect_success ' shell: -o hwloc.xmlfile sets HWLOC_XMLFILE' '
1515 flux run -o hwloc.xmlfile printenv HWLOC_XMLFILE
1616'
17+ test_expect_success ' shell: -o hwloc.xmlfile unsets HWLOC_COMPONENTS' '
18+ test_must_fail flux run --env=HWLOC_COMPONENTS=x86 -o hwloc.xmlfile \
19+ printenv HWLOC_COMPONENTS
20+ '
1721command -v hwloc-info > /dev/null && test_set_prereq HWLOC_INFO
1822test_expect_success HWLOC_INFO ' shell: -o hwloc.xmlfile HWLOC_XMLFILE is valid' '
1923 flux run -o hwloc.xmlfile sh -c "hwloc-info --input \$HWLOC_XMLFILE"
You can’t perform that action at this time.
0 commit comments