diff --git a/doc/man/man1/sacct.1 b/doc/man/man1/sacct.1 index d0724dbef27e696967628fd7f77f390d41b8abbe..12de6a63e4cb0cbf0524cba86f3735063abf644b 100644 --- a/doc/man/man1/sacct.1 +++ b/doc/man/man1/sacct.1 @@ -133,10 +133,11 @@ MaxRSSNode MaxRSSTask MaxVMSize MaxVMSizeNode MaxVMSizeTask MinCPU MinCPUNode MinCPUTask NCPUS NNodes NodeList NTasks Priority Partition QOSRAW ReqCPUFreq -ReqCPUs Reserved ResvCPU ResvCPURAW -Start State Submit Suspended -SystemCPU Timelimit TotalCPU UID -User UserCPU WCKey WCKeyID +ReqCPUs ReqMem Reserved ResvCPU +ResvCPURAW Start State Submit +Suspended SystemCPU Timelimit TotalCPU +UID User UserCPU WCKey +WCKeyID .ft 1 .fi @@ -691,6 +692,12 @@ Note: This value applies only to a job step. No value is reported for the job. \f3reqcpus\fP Required CPUs. +.TP +\f3ReqMem\fP +Minimum required memory for the job, in MB. A 'c' at the end of +number represents Memory Per CPU, a 'n' represents Memory Per Node. +Note: This value is only from the job allocation, not the step. + .TP \f3reserved\fP How much wall clock time was used as reserved time for this job. This is diff --git a/slurm/slurmdb.h b/slurm/slurmdb.h index 82a049498160f47c13a7cbad176a3581c88d3704..43fd35d78029bbafb319a591e45508002b7754c3 100644 --- a/slurm/slurmdb.h +++ b/slurm/slurmdb.h @@ -565,6 +565,7 @@ typedef struct { uint32_t priority; uint32_t qosid; uint32_t req_cpus; + uint32_t req_mem; uint32_t requid; uint32_t resvid; uint32_t show_full; diff --git a/src/common/slurmdb_pack.c b/src/common/slurmdb_pack.c index 71cd609a2b004612cdca85e54b19f7b1f33d5b86..18b78ece2063c6bc2bdda58da4a36e75c94d3e80 100644 --- a/src/common/slurmdb_pack.c +++ b/src/common/slurmdb_pack.c @@ -6082,7 +6082,7 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t rpc_version, Buf buffer) slurmdb_step_rec_t *step = NULL; uint32_t count = 0; - if (rpc_version >= 8) { + if (rpc_version >= SLURMDBD_2_6_VERSION) { packstr(job->account, buffer); pack32(job->alloc_cpus, buffer); pack32(job->alloc_nodes, buffer); @@ -6107,6 +6107,7 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t rpc_version, Buf buffer) pack32(job->priority, buffer); pack32(job->qosid, buffer); pack32(job->req_cpus, buffer); + pack32(job->req_mem, buffer); pack32(job->requid, buffer); pack32(job->resvid, buffer); pack32(job->show_full, buffer); @@ -6138,13 +6139,15 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t rpc_version, Buf buffer) pack32(job->user_cpu_usec, buffer); packstr(job->wckey, buffer); /* added for rpc_version 4 */ pack32(job->wckeyid, buffer); /* added for rpc_version 4 */ - } else if (rpc_version >= 5) { + } else { + packstr(job->account, buffer); pack32(job->alloc_cpus, buffer); pack32(job->alloc_nodes, buffer); pack32(job->associd, buffer); - packstr(job->account, buffer); packstr(job->blockid, buffer); packstr(job->cluster, buffer); + pack32((uint32_t)job->derived_ec, buffer); + packstr(job->derived_es, buffer); pack32(job->elapsed, buffer); pack_time(job->eligible, buffer); pack_time(job->end, buffer); @@ -6156,17 +6159,17 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t rpc_version, Buf buffer) pack32(job->jobid, buffer); packstr(job->jobname, buffer); pack32(job->lft, buffer); - packstr(job->partition, buffer); packstr(job->nodes, buffer); + packstr(job->partition, buffer); pack32(job->priority, buffer); - pack16(job->qosid, buffer); - pack32(job->resvid, buffer); + pack32(job->qosid, buffer); pack32(job->req_cpus, buffer); pack32(job->requid, buffer); - _pack_slurmdb_stats(&job->stats, rpc_version, buffer); + pack32(job->resvid, buffer); pack32(job->show_full, buffer); pack_time(job->start, buffer); pack16((uint16_t)job->state, buffer); + _pack_slurmdb_stats(&job->stats, rpc_version, buffer); if (job->steps) count = list_count(job->steps); pack32(count, buffer); @@ -6206,7 +6209,7 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) *job = job_ptr; - if (rpc_version >= 8) { + if (rpc_version >= SLURMDBD_2_6_VERSION) { safe_unpackstr_xmalloc(&job_ptr->account, &uint32_tmp, buffer); safe_unpack32(&job_ptr->alloc_cpus, buffer); safe_unpack32(&job_ptr->alloc_nodes, buffer); @@ -6232,6 +6235,7 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) safe_unpack32(&job_ptr->priority, buffer); safe_unpack32(&job_ptr->qosid, buffer); safe_unpack32(&job_ptr->req_cpus, buffer); + safe_unpack32(&job_ptr->req_mem, buffer); safe_unpack32(&job_ptr->requid, buffer); safe_unpack32(&job_ptr->resvid, buffer); safe_unpack32(&job_ptr->show_full, buffer); @@ -6269,13 +6273,17 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) safe_unpack32(&job_ptr->user_cpu_usec, buffer); safe_unpackstr_xmalloc(&job_ptr->wckey, &uint32_tmp, buffer); safe_unpack32(&job_ptr->wckeyid, buffer); - } else if (rpc_version >= 5) { + } else { + safe_unpackstr_xmalloc(&job_ptr->account, &uint32_tmp, buffer); safe_unpack32(&job_ptr->alloc_cpus, buffer); safe_unpack32(&job_ptr->alloc_nodes, buffer); safe_unpack32(&job_ptr->associd, buffer); - safe_unpackstr_xmalloc(&job_ptr->account, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&job_ptr->blockid, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&job_ptr->cluster, &uint32_tmp, buffer); + safe_unpack32(&uint32_tmp, buffer); + job_ptr->derived_ec = (int32_t)uint32_tmp; + safe_unpackstr_xmalloc(&job_ptr->derived_es, &uint32_tmp, + buffer); safe_unpack32(&job_ptr->elapsed, buffer); safe_unpack_time(&job_ptr->eligible, buffer); safe_unpack_time(&job_ptr->end, buffer); @@ -6285,23 +6293,23 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t rpc_version, Buf buffer) safe_unpack32(&job_ptr->jobid, buffer); safe_unpackstr_xmalloc(&job_ptr->jobname, &uint32_tmp, buffer); safe_unpack32(&job_ptr->lft, buffer); + safe_unpackstr_xmalloc(&job_ptr->nodes, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&job_ptr->partition, &uint32_tmp, buffer); - safe_unpackstr_xmalloc(&job_ptr->nodes, &uint32_tmp, buffer); safe_unpack32(&job_ptr->priority, buffer); - safe_unpack16((uint16_t *)&job_ptr->qosid, buffer); - safe_unpack32(&job_ptr->resvid, buffer); + safe_unpack32(&job_ptr->qosid, buffer); safe_unpack32(&job_ptr->req_cpus, buffer); safe_unpack32(&job_ptr->requid, buffer); - if (_unpack_slurmdb_stats(&job_ptr->stats, rpc_version, buffer) - != SLURM_SUCCESS) - goto unpack_error; + safe_unpack32(&job_ptr->resvid, buffer); safe_unpack32(&job_ptr->show_full, buffer); safe_unpack_time(&job_ptr->start, buffer); safe_unpack16(&uint16_tmp, buffer); job_ptr->state = uint16_tmp; - safe_unpack32(&count, buffer); + if (_unpack_slurmdb_stats(&job_ptr->stats, rpc_version, buffer) + != SLURM_SUCCESS) + goto unpack_error; + safe_unpack32(&count, buffer); job_ptr->steps = list_create(slurmdb_destroy_step_rec); for(i=0; i<count; i++) { if (slurmdb_unpack_step_rec(&step, rpc_version, buffer) diff --git a/src/common/slurmdbd_defs.c b/src/common/slurmdbd_defs.c index 010da1b845657bd5eda2a4106a1f8884bd277d9a..fd1a1b39cb97f42c7f079d70151f02ac1b385a84 100644 --- a/src/common/slurmdbd_defs.c +++ b/src/common/slurmdbd_defs.c @@ -3168,7 +3168,35 @@ slurmdbd_pack_job_start_msg(void *in, uint16_t rpc_version, Buf buffer) { dbd_job_start_msg_t *msg = (dbd_job_start_msg_t *)in; - if (rpc_version >= SLURMDBD_2_5_VERSION) { + if (rpc_version >= SLURMDBD_2_6_VERSION) { + packstr(msg->account, buffer); + pack32(msg->alloc_cpus, buffer); + pack32(msg->alloc_nodes, buffer); + pack32(msg->assoc_id, buffer); + packstr(msg->block_id, buffer); + pack32(msg->db_index, buffer); + pack_time(msg->eligible_time, buffer); + pack32(msg->gid, buffer); + packstr(msg->gres_alloc, buffer); + packstr(msg->gres_req, buffer); + packstr(msg->gres_used, buffer); + pack32(msg->job_id, buffer); + pack16(msg->job_state, buffer); + packstr(msg->name, buffer); + packstr(msg->nodes, buffer); + packstr(msg->node_inx, buffer); + packstr(msg->partition, buffer); + pack32(msg->priority, buffer); + pack32(msg->qos_id, buffer); + pack32(msg->req_cpus, buffer); + pack32(msg->req_mem, buffer); + pack32(msg->resv_id, buffer); + pack_time(msg->start_time, buffer); + pack_time(msg->submit_time, buffer); + pack32(msg->timelimit, buffer); + pack32(msg->uid, buffer); + packstr(msg->wckey, buffer); + } else if (rpc_version >= SLURMDBD_2_5_VERSION) { packstr(msg->account, buffer); pack32(msg->alloc_cpus, buffer); pack32(msg->alloc_nodes, buffer); @@ -3230,7 +3258,39 @@ slurmdbd_unpack_job_start_msg(void **msg, dbd_job_start_msg_t *msg_ptr = xmalloc(sizeof(dbd_job_start_msg_t)); *msg = msg_ptr; - if (rpc_version >= SLURMDBD_2_5_VERSION) { + if (rpc_version >= SLURMDBD_2_6_VERSION) { + safe_unpackstr_xmalloc(&msg_ptr->account, &uint32_tmp, buffer); + safe_unpack32(&msg_ptr->alloc_cpus, buffer); + safe_unpack32(&msg_ptr->alloc_nodes, buffer); + safe_unpack32(&msg_ptr->assoc_id, buffer); + safe_unpackstr_xmalloc(&msg_ptr->block_id, &uint32_tmp, buffer); + safe_unpack32(&msg_ptr->db_index, buffer); + safe_unpack_time(&msg_ptr->eligible_time, buffer); + safe_unpack32(&msg_ptr->gid, buffer); + safe_unpackstr_xmalloc(&msg_ptr->gres_alloc, &uint32_tmp, + buffer); + safe_unpackstr_xmalloc(&msg_ptr->gres_req, &uint32_tmp, + buffer); + safe_unpackstr_xmalloc(&msg_ptr->gres_used, &uint32_tmp, + buffer); + safe_unpack32(&msg_ptr->job_id, buffer); + safe_unpack16(&msg_ptr->job_state, buffer); + safe_unpackstr_xmalloc(&msg_ptr->name, &uint32_tmp, buffer); + safe_unpackstr_xmalloc(&msg_ptr->nodes, &uint32_tmp, buffer); + safe_unpackstr_xmalloc(&msg_ptr->node_inx, &uint32_tmp, buffer); + safe_unpackstr_xmalloc(&msg_ptr->partition, + &uint32_tmp, buffer); + safe_unpack32(&msg_ptr->priority, buffer); + safe_unpack32(&msg_ptr->qos_id, buffer); + safe_unpack32(&msg_ptr->req_cpus, buffer); + safe_unpack32(&msg_ptr->req_mem, buffer); + safe_unpack32(&msg_ptr->resv_id, buffer); + safe_unpack_time(&msg_ptr->start_time, buffer); + safe_unpack_time(&msg_ptr->submit_time, buffer); + safe_unpack32(&msg_ptr->timelimit, buffer); + safe_unpack32(&msg_ptr->uid, buffer); + safe_unpackstr_xmalloc(&msg_ptr->wckey, &uint32_tmp, buffer); + } else if (rpc_version >= SLURMDBD_2_5_VERSION) { safe_unpackstr_xmalloc(&msg_ptr->account, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->alloc_cpus, buffer); safe_unpack32(&msg_ptr->alloc_nodes, buffer); diff --git a/src/common/slurmdbd_defs.h b/src/common/slurmdbd_defs.h index ca16df2a709ad0134c072b2ca73111e5c45c9269..0581839262468e6d66247b1db7224035902d1193 100644 --- a/src/common/slurmdbd_defs.h +++ b/src/common/slurmdbd_defs.h @@ -278,6 +278,7 @@ typedef struct dbd_job_start_msg { uint32_t priority; /* job priority */ uint32_t qos_id; /* qos job is running with */ uint32_t req_cpus; /* count of req processors */ + uint32_t req_mem; /* requested minimum memory */ uint32_t resv_id; /* reservation id */ time_t start_time; /* job start time */ time_t submit_time; /* job submit time */ diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c index 8738bab05c9513b572efdf9686429b0e4c91ae23..a8e65bcc8e35b4af8ae5ed75ead111c17197c63d 100644 --- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c +++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c @@ -935,6 +935,7 @@ extern int create_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name) { "id_user", "int unsigned not null" }, { "id_group", "int unsigned not null" }, { "kill_requid", "int default -1 not null" }, + { "mem_req", "int unsigned default 0 not null" }, { "nodelist", "text" }, { "nodes_alloc", "int unsigned not null" }, { "node_inx", "text" }, diff --git a/src/plugins/accounting_storage/mysql/as_mysql_archive.c b/src/plugins/accounting_storage/mysql/as_mysql_archive.c index 53c742b2b255e0a4a7e07b9c9b938841d067e4b2..8da0adcaecc5b1f1d0aca9f979893a96c4de5282 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_archive.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_archive.c @@ -79,6 +79,7 @@ typedef struct { char *priority; char *qos; char *req_cpus; + char *req_mem; char *resvid; char *start; char *state; @@ -209,6 +210,7 @@ static char *job_req_inx[] = { "priority", "id_qos", "cpus_req", + "mem_req", "id_resv", "time_start", "state", @@ -244,6 +246,7 @@ enum { JOB_REQ_PRIORITY, JOB_REQ_QOS, JOB_REQ_REQ_CPUS, + JOB_REQ_REQ_MEM, JOB_REQ_START, JOB_REQ_STATE, JOB_REQ_SUBMIT, @@ -459,6 +462,7 @@ static void _pack_local_job(local_job_t *object, packstr(object->priority, buffer); packstr(object->qos, buffer); packstr(object->req_cpus, buffer); + packstr(object->req_mem, buffer); packstr(object->resvid, buffer); packstr(object->start, buffer); packstr(object->state, buffer); @@ -477,38 +481,72 @@ static int _unpack_local_job(local_job_t *object, { uint32_t tmp32; - unpackstr_ptr(&object->account, &tmp32, buffer); - unpackstr_ptr(&object->alloc_cpus, &tmp32, buffer); - unpackstr_ptr(&object->alloc_nodes, &tmp32, buffer); - unpackstr_ptr(&object->associd, &tmp32, buffer); - unpackstr_ptr(&object->blockid, &tmp32, buffer); - unpackstr_ptr(&object->derived_ec, &tmp32, buffer); - unpackstr_ptr(&object->derived_es, &tmp32, buffer); - unpackstr_ptr(&object->exit_code, &tmp32, buffer); - unpackstr_ptr(&object->timelimit, &tmp32, buffer); - unpackstr_ptr(&object->eligible, &tmp32, buffer); - unpackstr_ptr(&object->end, &tmp32, buffer); - unpackstr_ptr(&object->gid, &tmp32, buffer); - unpackstr_ptr(&object->id, &tmp32, buffer); - unpackstr_ptr(&object->jobid, &tmp32, buffer); - unpackstr_ptr(&object->kill_requid, &tmp32, buffer); - unpackstr_ptr(&object->name, &tmp32, buffer); - unpackstr_ptr(&object->nodelist, &tmp32, buffer); - unpackstr_ptr(&object->node_inx, &tmp32, buffer); - unpackstr_ptr(&object->partition, &tmp32, buffer); - unpackstr_ptr(&object->priority, &tmp32, buffer); - unpackstr_ptr(&object->qos, &tmp32, buffer); - unpackstr_ptr(&object->req_cpus, &tmp32, buffer); - unpackstr_ptr(&object->resvid, &tmp32, buffer); - unpackstr_ptr(&object->start, &tmp32, buffer); - unpackstr_ptr(&object->state, &tmp32, buffer); - unpackstr_ptr(&object->submit, &tmp32, buffer); - unpackstr_ptr(&object->suspended, &tmp32, buffer); - unpackstr_ptr(&object->track_steps, &tmp32, buffer); - unpackstr_ptr(&object->uid, &tmp32, buffer); - unpackstr_ptr(&object->wckey, &tmp32, buffer); - unpackstr_ptr(&object->wckey_id, &tmp32, buffer); - + if (rpc_version >= SLURMDBD_2_6_VERSION) { + unpackstr_ptr(&object->account, &tmp32, buffer); + unpackstr_ptr(&object->alloc_cpus, &tmp32, buffer); + unpackstr_ptr(&object->alloc_nodes, &tmp32, buffer); + unpackstr_ptr(&object->associd, &tmp32, buffer); + unpackstr_ptr(&object->blockid, &tmp32, buffer); + unpackstr_ptr(&object->derived_ec, &tmp32, buffer); + unpackstr_ptr(&object->derived_es, &tmp32, buffer); + unpackstr_ptr(&object->exit_code, &tmp32, buffer); + unpackstr_ptr(&object->timelimit, &tmp32, buffer); + unpackstr_ptr(&object->eligible, &tmp32, buffer); + unpackstr_ptr(&object->end, &tmp32, buffer); + unpackstr_ptr(&object->gid, &tmp32, buffer); + unpackstr_ptr(&object->id, &tmp32, buffer); + unpackstr_ptr(&object->jobid, &tmp32, buffer); + unpackstr_ptr(&object->kill_requid, &tmp32, buffer); + unpackstr_ptr(&object->name, &tmp32, buffer); + unpackstr_ptr(&object->nodelist, &tmp32, buffer); + unpackstr_ptr(&object->node_inx, &tmp32, buffer); + unpackstr_ptr(&object->partition, &tmp32, buffer); + unpackstr_ptr(&object->priority, &tmp32, buffer); + unpackstr_ptr(&object->qos, &tmp32, buffer); + unpackstr_ptr(&object->req_cpus, &tmp32, buffer); + unpackstr_ptr(&object->req_mem, &tmp32, buffer); + unpackstr_ptr(&object->resvid, &tmp32, buffer); + unpackstr_ptr(&object->start, &tmp32, buffer); + unpackstr_ptr(&object->state, &tmp32, buffer); + unpackstr_ptr(&object->submit, &tmp32, buffer); + unpackstr_ptr(&object->suspended, &tmp32, buffer); + unpackstr_ptr(&object->track_steps, &tmp32, buffer); + unpackstr_ptr(&object->uid, &tmp32, buffer); + unpackstr_ptr(&object->wckey, &tmp32, buffer); + unpackstr_ptr(&object->wckey_id, &tmp32, buffer); + } else { + unpackstr_ptr(&object->account, &tmp32, buffer); + unpackstr_ptr(&object->alloc_cpus, &tmp32, buffer); + unpackstr_ptr(&object->alloc_nodes, &tmp32, buffer); + unpackstr_ptr(&object->associd, &tmp32, buffer); + unpackstr_ptr(&object->blockid, &tmp32, buffer); + unpackstr_ptr(&object->derived_ec, &tmp32, buffer); + unpackstr_ptr(&object->derived_es, &tmp32, buffer); + unpackstr_ptr(&object->exit_code, &tmp32, buffer); + unpackstr_ptr(&object->timelimit, &tmp32, buffer); + unpackstr_ptr(&object->eligible, &tmp32, buffer); + unpackstr_ptr(&object->end, &tmp32, buffer); + unpackstr_ptr(&object->gid, &tmp32, buffer); + unpackstr_ptr(&object->id, &tmp32, buffer); + unpackstr_ptr(&object->jobid, &tmp32, buffer); + unpackstr_ptr(&object->kill_requid, &tmp32, buffer); + unpackstr_ptr(&object->name, &tmp32, buffer); + unpackstr_ptr(&object->nodelist, &tmp32, buffer); + unpackstr_ptr(&object->node_inx, &tmp32, buffer); + unpackstr_ptr(&object->partition, &tmp32, buffer); + unpackstr_ptr(&object->priority, &tmp32, buffer); + unpackstr_ptr(&object->qos, &tmp32, buffer); + unpackstr_ptr(&object->req_cpus, &tmp32, buffer); + unpackstr_ptr(&object->resvid, &tmp32, buffer); + unpackstr_ptr(&object->start, &tmp32, buffer); + unpackstr_ptr(&object->state, &tmp32, buffer); + unpackstr_ptr(&object->submit, &tmp32, buffer); + unpackstr_ptr(&object->suspended, &tmp32, buffer); + unpackstr_ptr(&object->track_steps, &tmp32, buffer); + unpackstr_ptr(&object->uid, &tmp32, buffer); + unpackstr_ptr(&object->wckey, &tmp32, buffer); + unpackstr_ptr(&object->wckey_id, &tmp32, buffer); + } return SLURM_SUCCESS; } @@ -1546,6 +1584,7 @@ static uint32_t _archive_jobs(mysql_conn_t *mysql_conn, char *cluster_name, job.priority = row[JOB_REQ_PRIORITY]; job.qos = row[JOB_REQ_QOS]; job.req_cpus = row[JOB_REQ_REQ_CPUS]; + job.req_mem = row[JOB_REQ_REQ_MEM]; job.resvid = row[JOB_REQ_RESVID]; job.start = row[JOB_REQ_START]; job.state = row[JOB_REQ_STATE]; @@ -1626,6 +1665,7 @@ static char *_load_jobs(uint16_t rpc_version, Buf buffer, object.priority, object.qos, object.req_cpus, + object.req_mem, object.resvid, object.start, object.state, diff --git a/src/plugins/accounting_storage/mysql/as_mysql_convert.c b/src/plugins/accounting_storage/mysql/as_mysql_convert.c index 9bd95b4aab6ff15fc4e8a565f38d76eed36eff8d..5beb7f59bf80521e07c83eb29a7d26ffe4c6ef5c 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_convert.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_convert.c @@ -659,6 +659,7 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn) { "comp_code", "int default 0 not null" }, { "priority", "int not null" }, { "req_cpus", "int unsigned not null" }, + { "req_mem", "int unsigned default 0 not null" }, { "alloc_cpus", "int unsigned not null" }, { "alloc_nodes", "int unsigned not null" }, { "nodelist", "text" }, diff --git a/src/plugins/accounting_storage/mysql/as_mysql_job.c b/src/plugins/accounting_storage/mysql/as_mysql_job.c index 8846a7e2bd591049881a055c492919c08c0ffe82..87054cbc0e74f186d1724c0496895ac65f1ee126 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_job.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_job.c @@ -426,7 +426,7 @@ no_rollup_change: "id_group, nodelist, id_resv, timelimit, " "time_eligible, time_submit, time_start, " "job_name, track_steps, state, priority, cpus_req, " - "cpus_alloc, nodes_alloc", + "cpus_alloc, nodes_alloc, mem_req", mysql_conn->cluster_name, job_table); if (job_ptr->account) @@ -446,7 +446,7 @@ no_rollup_change: xstrfmtcat(query, ") values (%u, %u, %u, %u, %u, %u, '%s', %u, %u, " - "%ld, %ld, %ld, '%s', %u, %u, %u, %u, %u, %u", + "%ld, %ld, %ld, '%s', %u, %u, %u, %u, %u, %u, %u", job_ptr->job_id, job_ptr->assoc_id, job_ptr->qos_id, wckeyid, job_ptr->user_id, job_ptr->group_id, nodes, @@ -454,7 +454,8 @@ no_rollup_change: begin_time, submit_time, start_time, jname, track_steps, job_state, job_ptr->priority, job_ptr->details->min_cpus, - job_ptr->total_cpus, node_cnt); + job_ptr->total_cpus, node_cnt, + job_ptr->details->pn_min_memory); if (job_ptr->account) xstrfmtcat(query, ", '%s'", job_ptr->account); @@ -479,13 +480,15 @@ no_rollup_change: "time_submit=%ld, time_start=%ld, " "job_name='%s', track_steps=%u, id_qos=%u, " "state=greatest(state, %u), priority=%u, " - "cpus_req=%u, cpus_alloc=%u, nodes_alloc=%u", + "cpus_req=%u, cpus_alloc=%u, nodes_alloc=%u, " + "mem_req=%u", wckeyid, job_ptr->user_id, job_ptr->group_id, nodes, job_ptr->resv_id, job_ptr->time_limit, submit_time, start_time, jname, track_steps, job_ptr->qos_id, job_state, job_ptr->priority, job_ptr->details->min_cpus, - job_ptr->total_cpus, node_cnt); + job_ptr->total_cpus, node_cnt, + job_ptr->details->pn_min_memory); if (job_ptr->account) xstrfmtcat(query, ", account='%s'", job_ptr->account); @@ -542,12 +545,13 @@ no_rollup_change: xstrfmtcat(query, "time_start=%ld, job_name='%s', state=%u, " "cpus_alloc=%u, nodes_alloc=%u, id_qos=%u, " "id_assoc=%u, id_wckey=%u, id_resv=%u, " - "timelimit=%u, " + "timelimit=%u, mem_req=%u, " "time_eligible=%ld where job_db_inx=%d", start_time, jname, job_state, job_ptr->total_cpus, node_cnt, job_ptr->qos_id, job_ptr->assoc_id, wckeyid, job_ptr->resv_id, job_ptr->time_limit, + job_ptr->details->pn_min_memory, begin_time, job_ptr->db_index); debug3("%d(%s:%d) query\n%s", diff --git a/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c b/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c index 7d6eb1ff22e08720f280746f02cbd3bfa2c87349..9d2d8e9114df9f567133f9d9a6cc5302de735756 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c @@ -71,6 +71,7 @@ char *job_req_inx[] = { "t1.job_db_inx", "t1.job_name", "t1.kill_requid", + "t1.mem_req", "t1.node_inx", "t1.nodelist", "t1.nodes_alloc", @@ -108,6 +109,7 @@ enum { JOB_REQ_ID, JOB_REQ_NAME, JOB_REQ_KILL_REQUID, + JOB_REQ_REQ_MEM, JOB_REQ_NODE_INX, JOB_REQ_NODELIST, JOB_REQ_ALLOC_NODES, @@ -629,6 +631,7 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn, job->track_steps = slurm_atoul(row[JOB_REQ_TRACKSTEPS]); job->priority = slurm_atoul(row[JOB_REQ_PRIORITY]); job->req_cpus = slurm_atoul(row[JOB_REQ_REQ_CPUS]); + job->req_mem = slurm_atoul(row[JOB_REQ_REQ_MEM]); job->requid = slurm_atoul(row[JOB_REQ_KILL_REQUID]); job->qosid = slurm_atoul(row[JOB_REQ_QOS]); job->show_full = 1; diff --git a/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c b/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c index 367a7bfa8ce5256dfa12ceb48f07f40c5cb756fd..9ad66892fefde48ac956f849b715a71c27010a69 100644 --- a/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c +++ b/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c @@ -194,8 +194,10 @@ static int _setup_job_start_msg(dbd_job_start_msg_t *req, } req->alloc_cpus = job_ptr->total_cpus; req->partition = xstrdup(job_ptr->partition); - if (job_ptr->details) + if (job_ptr->details) { req->req_cpus = job_ptr->details->min_cpus; + req->req_mem = job_ptr->details->pn_min_memory; + } req->resv_id = job_ptr->resv_id; req->priority = job_ptr->priority; req->timelimit = job_ptr->time_limit; diff --git a/src/sacct/print.c b/src/sacct/print.c index 737c59cc3451aee97b2ba3fc3bd4509f3d6f2eec..0ea26a09cec5fab6a4d2607a6bfd01261a935e71 100644 --- a/src/sacct/print.c +++ b/src/sacct/print.c @@ -1272,6 +1272,38 @@ void print_fields(type_t type, void *object) tmp_int, (curr_inx == field_count)); break; + case PRINT_REQ_MEM: + switch(type) { + case JOB: + tmp_uint32 = job->req_mem; + break; + case JOBSTEP: + tmp_uint32 = step->job_ptr->req_mem; + break; + case JOBCOMP: + default: + tmp_uint32 = NO_VAL; + break; + } + + if (tmp_uint32 != (uint32_t)NO_VAL) { + bool per_cpu = false; + if (tmp_uint32 & MEM_PER_CPU) { + tmp_uint32 &= (~MEM_PER_CPU); + per_cpu = true; + } + convert_num_unit((float)tmp_uint32, + outbuf, sizeof(outbuf), + UNIT_MEGA); + if (per_cpu) + sprintf(outbuf+strlen(outbuf), "c"); + else + sprintf(outbuf+strlen(outbuf), "n"); + } + field->print_routine(field, + outbuf, + (curr_inx == field_count)); + break; case PRINT_RESV: switch(type) { case JOB: diff --git a/src/sacct/sacct.c b/src/sacct/sacct.c index 376bd52bd42d2428c24271ae205b3f4c6683a3ad..2f79802e090bf6cd0a10a766d5d6903dbca15a2c 100644 --- a/src/sacct/sacct.c +++ b/src/sacct/sacct.c @@ -98,6 +98,7 @@ print_field_t fields[] = { {6, "QOSRAW", print_fields_uint, PRINT_QOSRAW}, {10, "ReqCPUFreq", print_fields_str, PRINT_REQ_CPUFREQ}, {8, "ReqCPUS", print_fields_uint, PRINT_REQ_CPUS}, + {10, "ReqMem", print_fields_str, PRINT_REQ_MEM}, {10, "Reserved", print_fields_time_from_secs, PRINT_RESV}, {10, "ResvCPU", print_fields_time_from_secs, PRINT_RESV_CPU}, {10, "ResvCPURAW", print_fields_uint, PRINT_RESV_CPU}, diff --git a/src/sacct/sacct.h b/src/sacct/sacct.h index ca3ed2f11dbd37789ed6c1a170b10051877254d3..4ae1bc6b2e04735e95b26ffda4b8b6ffe8af2921 100644 --- a/src/sacct/sacct.h +++ b/src/sacct/sacct.h @@ -69,7 +69,7 @@ #define BRIEF_COMP_FIELDS "jobid,uid,state" #define DEFAULT_FIELDS "jobid,jobname,partition,account,alloccpus,state,exitcode" #define DEFAULT_COMP_FIELDS "jobid,uid,jobname,partition,nnodes,nodelist,state,end" -#define LONG_FIELDS "jobid,jobname,partition,maxvmsize,maxvmsizenode,maxvmsizetask,avevmsize,maxrss,maxrssnode,maxrsstask,averss,maxpages,maxpagesnode,maxpagestask,avepages,mincpu,mincpunode,mincputask,avecpu,ntasks,alloccpus,elapsed,state,exitcode,avecpufreq,reqcpufreq,consumedenergy,maxdiskread,maxdiskreadnode,maxdiskreadtask,avediskread,maxdiskwrite,maxdiskwritenode,maxdiskwritetask,avediskwrite" +#define LONG_FIELDS "jobid,jobname,partition,maxvmsize,maxvmsizenode,maxvmsizetask,avevmsize,maxrss,maxrssnode,maxrsstask,averss,maxpages,maxpagesnode,maxpagestask,avepages,mincpu,mincpunode,mincputask,avecpu,ntasks,alloccpus,elapsed,state,exitcode,avecpufreq,reqcpufreq,reqmem,consumedenergy,maxdiskread,maxdiskreadnode,maxdiskreadtask,avediskread,maxdiskwrite,maxdiskwritenode,maxdiskwritetask,avediskwrite" #define LONG_COMP_FIELDS "jobid,uid,jobname,partition,nnodes,nodelist,state,start,end,timelimit" @@ -145,6 +145,7 @@ typedef enum { PRINT_QOSRAW, PRINT_REQ_CPUFREQ, PRINT_REQ_CPUS, + PRINT_REQ_MEM, PRINT_RESV, PRINT_RESV_CPU, PRINT_RESV_CPU_RAW, diff --git a/src/slurmdbd/proc_req.c b/src/slurmdbd/proc_req.c index 9573c618f2c0c6b77b8aa19c0513f77914c94d9a..4deccee222946f64fc0f2ab6282edbed9d9071b9 100644 --- a/src/slurmdbd/proc_req.c +++ b/src/slurmdbd/proc_req.c @@ -2634,6 +2634,7 @@ static void _process_job_start(slurmdbd_conn_t *slurmdbd_conn, job.network = job_start_msg->node_inx; job.partition = job_start_msg->partition; details.min_cpus = job_start_msg->req_cpus; + details.pn_min_memory = job_start_msg->req_mem; job.qos_id = job_start_msg->qos_id; job.resv_id = job_start_msg->resv_id; job.priority = job_start_msg->priority;