Skip to content

Commit

Permalink
Read config files only once per node in spank plugin
Browse files Browse the repository at this point in the history
Read system and user config files (io-watchdog.conf and .io-watchdogrc)
in slurm_spank_user_init() instead of slurm_spank_task_init() so that
the config files are read once per node instead of once per task.
  • Loading branch information
grondo committed May 11, 2012
1 parent 26ee001 commit ff12ef9
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/spank/io-watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,22 @@ static int read_and_apply_config (spank_t sp, io_watchdog_conf_t conf)
return (0);
}

int slurm_spank_user_init (spank_t sp, int ac, char **av)
{
int rc;
io_watchdog_conf_t conf = io_watchdog_conf_create ();
if (conf == NULL) {
slurm_error ("io-watchdog: Failed to create conf object!");
return (-1);
}
rc = read_and_apply_config (sp, conf);
io_watchdog_conf_destroy (conf);
return (rc);
}

int slurm_spank_task_init (spank_t sp, int ac, char **av)
{
int taskid;
io_watchdog_conf_t conf;
char prefix [64];

if (!opts.enabled)
Expand All @@ -358,13 +370,6 @@ int slurm_spank_task_init (spank_t sp, int ac, char **av)

log_verbose ("Initializing task %d\n", taskid);

conf = io_watchdog_conf_create ();

if (read_and_apply_config (sp, conf) < 0)
return (-1);

io_watchdog_conf_destroy (conf);

if (taskid != opts.rank) {
log_verbose ("this rank (%d) != %d. No action\n", taskid, opts.rank);
return (0);
Expand Down

0 comments on commit ff12ef9

Please sign in to comment.