Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion src/slurm_plugin/slurm_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ static int set_spindle_args(spank_t spank, spindle_args_t *params, int argc, cha
static int get_spindle_args(spank_t spank, spindle_args_t *params);
#endif

static int forward_environment_to_slurmstepd(spank_t spank);
static int launchFE(char **hostlist, spindle_args_t *params);
static int launchBE(spank_t spank, spindle_args_t *params);
static int prepApp(spank_t spank, spindle_args_t *params);
Expand Down Expand Up @@ -80,6 +81,32 @@ struct spank_option spank_options[] =
SPANK_OPTIONS_TABLE_END
};

static int forward_environment_to_slurmstepd(spank_t spank)
{
char *debugEnv, *testEnv, *tmpEnv;

debugEnv= readSpankEnv(spank, "SPINDLE_DEBUG");
testEnv = readSpankEnv(spank, "SPINDLE_TEST");
tmpEnv = readSpankEnv(spank, "TMPDIR");

if (debugEnv) {
setenv("SPINDLE_DEBUG", debugEnv, 1);
free(debugEnv);
}

if (testEnv) {
setenv("SPINDLE_TEST", testEnv, 1);
free(testEnv);
}

if (tmpEnv) {
setenv("TMPDIR", tmpEnv, 1);
free(tmpEnv);
}

return 0;
}

int slurm_spank_task_init(spank_t spank, int site_argc, char *site_argv[])
{
spank_context_t context;
Expand Down Expand Up @@ -107,8 +134,13 @@ int slurm_spank_task_init(spank_t spank, int site_argc, char *site_argv[])
return 0;
}

push_env(spank, &env);
// We need to acquire the job environment before we do anything that
// will spawn the log daemon so that SPINDLE_DEBUG and SPINDLE_TEST
// are set appropriately.
forward_environment_to_slurmstepd(spank);

sdprintf(1, "Beginning spindle plugin\n");
push_env(spank, &env);

result = process_spindle_args(spank, site_argc, site_argv, &params, NULL, NULL);
if (result == -1) {
Expand Down