Skip to content
Snippets Groups Projects
Commit 94bebf38 authored by Danny Auble's avatar Danny Auble
Browse files

Accounting - if jobacct_gather/none is used don't start polling thread

and alloc and such jobacctinfo.
parent d3da7afd
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,7 @@ static pthread_mutex_t task_list_lock = PTHREAD_MUTEX_INITIALIZER; ...@@ -106,6 +106,7 @@ static pthread_mutex_t task_list_lock = PTHREAD_MUTEX_INITIALIZER;
static bool jobacct_shutdown = true; static bool jobacct_shutdown = true;
static bool jobacct_suspended = 0; static bool jobacct_suspended = 0;
static bool plugin_polling = true;
static uint32_t jobacct_job_id = 0; static uint32_t jobacct_job_id = 0;
static uint32_t jobacct_step_id = 0; static uint32_t jobacct_step_id = 0;
...@@ -226,8 +227,10 @@ extern int jobacct_gather_init(void) ...@@ -226,8 +227,10 @@ extern int jobacct_gather_init(void)
goto done; goto done;
} }
if (!strcasecmp(type, "jobacct_gather/none")) if (!strcasecmp(type, "jobacct_gather/none")) {
plugin_polling = false;
goto done; goto done;
}
plugin_type = type; plugin_type = type;
type = slurm_get_proctrack_type(); type = slurm_get_proctrack_type();
...@@ -277,6 +280,9 @@ extern int jobacct_gather_startpoll(uint16_t frequency) ...@@ -277,6 +280,9 @@ extern int jobacct_gather_startpoll(uint16_t frequency)
pthread_attr_t attr; pthread_attr_t attr;
pthread_t _watch_tasks_thread_id; pthread_t _watch_tasks_thread_id;
if (!plugin_polling)
return SLURM_SUCCESS;
if (jobacct_gather_init() < 0) if (jobacct_gather_init() < 0)
return SLURM_ERROR; return SLURM_ERROR;
...@@ -291,7 +297,7 @@ extern int jobacct_gather_startpoll(uint16_t frequency) ...@@ -291,7 +297,7 @@ extern int jobacct_gather_startpoll(uint16_t frequency)
task_list = list_create(jobacctinfo_destroy); task_list = list_create(jobacctinfo_destroy);
if (frequency == 0) { /* don't want dynamic monitoring? */ if (frequency == 0) { /* don't want dynamic monitoring? */
debug2("jobacct AIX dynamic logging disabled"); debug2("jobacct_gather dynamic logging disabled");
return retval; return retval;
} }
...@@ -302,11 +308,11 @@ extern int jobacct_gather_startpoll(uint16_t frequency) ...@@ -302,11 +308,11 @@ extern int jobacct_gather_startpoll(uint16_t frequency)
if (pthread_create(&_watch_tasks_thread_id, &attr, if (pthread_create(&_watch_tasks_thread_id, &attr,
&_watch_tasks, NULL)) { &_watch_tasks, NULL)) {
debug("jobacct-gather failed to create _watch_tasks " debug("jobacct_gather failed to create _watch_tasks "
"thread: %m"); "thread: %m");
frequency = 0; frequency = 0;
} else } else
debug3("jobacct-gather AIX dynamic logging enabled"); debug3("jobacct_gather dynamic logging enabled");
slurm_attr_destroy(&attr); slurm_attr_destroy(&attr);
return retval; return retval;
...@@ -336,7 +342,7 @@ extern void jobacct_gather_change_poll(uint16_t frequency) ...@@ -336,7 +342,7 @@ extern void jobacct_gather_change_poll(uint16_t frequency)
if (jobacct_gather_init() < 0) if (jobacct_gather_init() < 0)
return; return;
if (freq == 0 && frequency != 0) { if (plugin_polling && freq == 0 && frequency != 0) {
pthread_attr_t attr; pthread_attr_t attr;
pthread_t _watch_tasks_thread_id; pthread_t _watch_tasks_thread_id;
/* create polling thread */ /* create polling thread */
...@@ -381,6 +387,9 @@ extern int jobacct_gather_add_task(pid_t pid, jobacct_id_t *jobacct_id) ...@@ -381,6 +387,9 @@ extern int jobacct_gather_add_task(pid_t pid, jobacct_id_t *jobacct_id)
if (jobacct_gather_init() < 0) if (jobacct_gather_init() < 0)
return SLURM_ERROR; return SLURM_ERROR;
if (!plugin_polling)
return SLURM_SUCCESS;
if (jobacct_shutdown) if (jobacct_shutdown)
return SLURM_ERROR; return SLURM_ERROR;
...@@ -413,7 +422,7 @@ error: ...@@ -413,7 +422,7 @@ error:
extern jobacctinfo_t *jobacct_gather_stat_task(pid_t pid) extern jobacctinfo_t *jobacct_gather_stat_task(pid_t pid)
{ {
if (jobacct_shutdown) if (!plugin_polling || jobacct_shutdown)
return NULL; return NULL;
else if (pid) { else if (pid) {
struct jobacctinfo *jobacct = NULL; struct jobacctinfo *jobacct = NULL;
...@@ -460,7 +469,7 @@ extern jobacctinfo_t *jobacct_gather_remove_task(pid_t pid) ...@@ -460,7 +469,7 @@ extern jobacctinfo_t *jobacct_gather_remove_task(pid_t pid)
struct jobacctinfo *jobacct = NULL; struct jobacctinfo *jobacct = NULL;
ListIterator itr = NULL; ListIterator itr = NULL;
if (jobacct_shutdown) if (!plugin_polling || jobacct_shutdown)
return NULL; return NULL;
slurm_mutex_lock(&task_list_lock); slurm_mutex_lock(&task_list_lock);
...@@ -490,7 +499,7 @@ error: ...@@ -490,7 +499,7 @@ error:
extern int jobacct_gather_set_proctrack_container_id(uint64_t id) extern int jobacct_gather_set_proctrack_container_id(uint64_t id)
{ {
if (pgid_plugin) if (!plugin_polling || pgid_plugin)
return SLURM_SUCCESS; return SLURM_SUCCESS;
if (cont_id != (uint64_t)NO_VAL) if (cont_id != (uint64_t)NO_VAL)
...@@ -511,6 +520,9 @@ extern int jobacct_gather_set_proctrack_container_id(uint64_t id) ...@@ -511,6 +520,9 @@ extern int jobacct_gather_set_proctrack_container_id(uint64_t id)
extern int jobacct_gather_set_mem_limit(uint32_t job_id, uint32_t step_id, extern int jobacct_gather_set_mem_limit(uint32_t job_id, uint32_t step_id,
uint32_t mem_limit) uint32_t mem_limit)
{ {
if (!plugin_polling)
return SLURM_SUCCESS;
if ((job_id == 0) || (mem_limit == 0)) { if ((job_id == 0) || (mem_limit == 0)) {
error("jobacct_gather_set_mem_limit: jobid:%u mem_limit:%u", error("jobacct_gather_set_mem_limit: jobid:%u mem_limit:%u",
job_id, mem_limit); job_id, mem_limit);
...@@ -528,6 +540,9 @@ extern int jobacct_gather_set_mem_limit(uint32_t job_id, uint32_t step_id, ...@@ -528,6 +540,9 @@ extern int jobacct_gather_set_mem_limit(uint32_t job_id, uint32_t step_id,
extern void jobacct_gather_handle_mem_limit( extern void jobacct_gather_handle_mem_limit(
uint32_t total_job_mem, uint32_t total_job_vsize) uint32_t total_job_mem, uint32_t total_job_vsize)
{ {
if (!plugin_polling)
return;
if (jobacct_mem_limit) { if (jobacct_mem_limit) {
if (jobacct_step_id == NO_VAL) { if (jobacct_step_id == NO_VAL) {
debug("Job %u memory used:%u limit:%u KB", debug("Job %u memory used:%u limit:%u KB",
...@@ -568,7 +583,12 @@ extern void jobacct_gather_handle_mem_limit( ...@@ -568,7 +583,12 @@ extern void jobacct_gather_handle_mem_limit(
extern jobacctinfo_t *jobacctinfo_create(jobacct_id_t *jobacct_id) extern jobacctinfo_t *jobacctinfo_create(jobacct_id_t *jobacct_id)
{ {
struct jobacctinfo *jobacct = xmalloc(sizeof(struct jobacctinfo)); struct jobacctinfo *jobacct;
if (!plugin_polling)
return NULL;
jobacct = xmalloc(sizeof(struct jobacctinfo));
if (!jobacct_id) { if (!jobacct_id) {
jobacct_id_t temp_id; jobacct_id_t temp_id;
...@@ -614,6 +634,9 @@ extern int jobacctinfo_setinfo(jobacctinfo_t *jobacct, ...@@ -614,6 +634,9 @@ extern int jobacctinfo_setinfo(jobacctinfo_t *jobacct,
jobacct_id_t *jobacct_id = (jobacct_id_t *) data; jobacct_id_t *jobacct_id = (jobacct_id_t *) data;
struct jobacctinfo *send = (struct jobacctinfo *) data; struct jobacctinfo *send = (struct jobacctinfo *) data;
if (!plugin_polling)
return SLURM_SUCCESS;
switch (type) { switch (type) {
case JOBACCT_DATA_TOTAL: case JOBACCT_DATA_TOTAL:
memcpy(jobacct, send, sizeof(struct jobacctinfo)); memcpy(jobacct, send, sizeof(struct jobacctinfo));
...@@ -682,6 +705,9 @@ extern int jobacctinfo_getinfo( ...@@ -682,6 +705,9 @@ extern int jobacctinfo_getinfo(
struct rusage *rusage = (struct rusage *)data; struct rusage *rusage = (struct rusage *)data;
struct jobacctinfo *send = (struct jobacctinfo *) data; struct jobacctinfo *send = (struct jobacctinfo *) data;
if (!plugin_polling)
return SLURM_SUCCESS;
switch (type) { switch (type) {
case JOBACCT_DATA_TOTAL: case JOBACCT_DATA_TOTAL:
memcpy(send, jobacct, sizeof(struct jobacctinfo)); memcpy(send, jobacct, sizeof(struct jobacctinfo));
...@@ -746,6 +772,9 @@ extern void jobacctinfo_pack(jobacctinfo_t *jobacct, ...@@ -746,6 +772,9 @@ extern void jobacctinfo_pack(jobacctinfo_t *jobacct,
{ {
int i = 0; int i = 0;
if (!plugin_polling && (protocol_type != PROTOCOL_TYPE_DBD))
return;
/* The function can take calls from both DBD and from regular /* The function can take calls from both DBD and from regular
* SLURM functions. We choose to standardize on using the * SLURM functions. We choose to standardize on using the
* SLURM_PROTOCOL_VERSION here so if PROTOCOL_TYPE_DBD comes * SLURM_PROTOCOL_VERSION here so if PROTOCOL_TYPE_DBD comes
...@@ -759,7 +788,8 @@ extern void jobacctinfo_pack(jobacctinfo_t *jobacct, ...@@ -759,7 +788,8 @@ extern void jobacctinfo_pack(jobacctinfo_t *jobacct,
if (protocol_type == PROTOCOL_TYPE_DBD) if (protocol_type == PROTOCOL_TYPE_DBD)
rpc_version = slurmdbd_translate_rpc(rpc_version); rpc_version = slurmdbd_translate_rpc(rpc_version);
if (!jobacct) { /* pack an empty record */
if (!jobacct || (jobacct->min_cpu == NO_VAL)) {
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
pack32((uint32_t)NO_VAL, buffer); pack32((uint32_t)NO_VAL, buffer);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
...@@ -792,6 +822,9 @@ extern int jobacctinfo_unpack(jobacctinfo_t **jobacct, ...@@ -792,6 +822,9 @@ extern int jobacctinfo_unpack(jobacctinfo_t **jobacct,
{ {
uint32_t uint32_tmp; uint32_t uint32_tmp;
if (!plugin_polling && (protocol_type != PROTOCOL_TYPE_DBD))
return SLURM_SUCCESS;
/* The function can take calls from both DBD and from regular /* The function can take calls from both DBD and from regular
* SLURM functions. We choose to standardize on using the * SLURM functions. We choose to standardize on using the
* SLURM_PROTOCOL_VERSION here so if PROTOCOL_TYPE_DBD comes * SLURM_PROTOCOL_VERSION here so if PROTOCOL_TYPE_DBD comes
...@@ -847,6 +880,9 @@ unpack_error: ...@@ -847,6 +880,9 @@ unpack_error:
extern void jobacctinfo_aggregate(jobacctinfo_t *dest, jobacctinfo_t *from) extern void jobacctinfo_aggregate(jobacctinfo_t *dest, jobacctinfo_t *from)
{ {
if (!plugin_polling)
return;
xassert(dest); xassert(dest);
if (!from || (from->min_cpu == (uint32_t)NO_VAL)) if (!from || (from->min_cpu == (uint32_t)NO_VAL))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment