Skip to content
Snippets Groups Projects
Commit 6eb7ccfe authored by Moe Jette's avatar Moe Jette
Browse files

Changed job_id to 32 bits per DPCS requirement. Jobs without job_id

specified at submit time start with a value of 1<<16 and DPCS uses
values 1 to 0xffffffff. This preclude effective use of a max job_id
in search function, which was able to quickly indicate that a job_id
requested by DPCS was not already in use. I added a job_id hash table
to restore quick job find operations.
parent 68582783
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ main (int argc, char *argv[]) ...@@ -30,7 +30,7 @@ main (int argc, char *argv[])
{ {
int error_code; int error_code;
char *node_list; char *node_list;
uint16_t job_id; uint32_t job_id;
error_code = slurm_allocate error_code = slurm_allocate
("User=1500 JobName=job01 TotalNodes=400 TotalProcs=1000 ReqNodes=lx[3000-3003] Partition=batch MinRealMemory=1024 MinTmpDisk=2034 Groups=students,employee MinProcs=4 Contiguous=YES Key=1234", ("User=1500 JobName=job01 TotalNodes=400 TotalProcs=1000 ReqNodes=lx[3000-3003] Partition=batch MinRealMemory=1024 MinTmpDisk=2034 Groups=students,employee MinProcs=4 Contiguous=YES Key=1234",
...@@ -94,7 +94,7 @@ main (int argc, char *argv[]) ...@@ -94,7 +94,7 @@ main (int argc, char *argv[])
* NOTE: the calling function must free the allocated storage at node_list[0] * NOTE: the calling function must free the allocated storage at node_list[0]
*/ */
int int
slurm_allocate (char *spec, char **node_list, uint16_t *job_id) slurm_allocate (char *spec, char **node_list, uint32_t *job_id)
{ {
int buffer_offset, buffer_size, in_size; int buffer_offset, buffer_size, in_size;
char *request_msg, *buffer, *job_id_ptr; char *request_msg, *buffer, *job_id_ptr;
...@@ -161,9 +161,8 @@ slurm_allocate (char *spec, char **node_list, uint16_t *job_id) ...@@ -161,9 +161,8 @@ slurm_allocate (char *spec, char **node_list, uint16_t *job_id)
return EINVAL; return EINVAL;
} }
job_id_ptr = strchr(buffer, (int) ' '); job_id_ptr = strchr(buffer, (int) ' ');
if (job_id_ptr != NULL) { if (job_id_ptr != NULL)
*job_id = (uint16_t) atoi (&job_id_ptr[1]); *job_id = (uint32_t) strtol (&job_id_ptr[1], (char **)NULL, 10);
}
node_list[0] = buffer; node_list[0] = buffer;
return 0; return 0;
} }
...@@ -36,7 +36,7 @@ main (int argc, char *argv[]) ...@@ -36,7 +36,7 @@ main (int argc, char *argv[])
} }
for (i=1; i<argc; i++) { for (i=1; i<argc; i++) {
error_code = slurm_cancel ((uint16_t) atoi(argv[i])); error_code = slurm_cancel ((uint32_t) atoi(argv[i]));
if (error_code != 0) if (error_code != 0)
printf ("slurm_cancel error %d for job %s\n", printf ("slurm_cancel error %d for job %s\n",
error_code, argv[i]); error_code, argv[i]);
...@@ -54,7 +54,7 @@ main (int argc, char *argv[]) ...@@ -54,7 +54,7 @@ main (int argc, char *argv[])
* EAGAIN if the request can not be satisfied at present * EAGAIN if the request can not be satisfied at present
*/ */
int int
slurm_cancel (uint16_t job_id) slurm_cancel (uint32_t job_id)
{ {
int buffer_offset, buffer_size, in_size; int buffer_offset, buffer_size, in_size;
char *request_msg, *buffer, id_str[20]; char *request_msg, *buffer, id_str[20];
......
...@@ -213,7 +213,7 @@ slurm_load_job (time_t update_time, struct job_buffer **job_buffer_ptr) ...@@ -213,7 +213,7 @@ slurm_load_job (time_t update_time, struct job_buffer **job_buffer_ptr)
free (buffer); free (buffer);
return ENOMEM; return ENOMEM;
} }
unpack16 (&job[i].job_id, &buf_ptr, &buffer_size); unpack32 (&job[i].job_id, &buf_ptr, &buffer_size);
unpack32 (&job[i].user_id, &buf_ptr, &buffer_size); unpack32 (&job[i].user_id, &buf_ptr, &buffer_size);
unpack16 (&job[i].job_state, &buf_ptr, &buffer_size); unpack16 (&job[i].job_state, &buf_ptr, &buffer_size);
unpack32 (&job[i].time_limit, &buf_ptr, &buffer_size); unpack32 (&job[i].time_limit, &buf_ptr, &buffer_size);
......
...@@ -84,7 +84,7 @@ struct build_buffer { ...@@ -84,7 +84,7 @@ struct build_buffer {
}; };
struct job_table { struct job_table {
uint16_t job_id; /* job ID */ uint32_t job_id; /* job ID */
char *name; /* name of the job */ char *name; /* name of the job */
uint32_t user_id; /* user the job runs as */ uint32_t user_id; /* user the job runs as */
uint16_t job_state; /* state of the job, see enum job_states */ uint16_t job_state; /* state of the job, see enum job_states */
...@@ -176,7 +176,7 @@ struct part_buffer { ...@@ -176,7 +176,7 @@ struct part_buffer {
* TotalProcs=<count> * TotalProcs=<count>
* NOTE: the calling function must free the allocated storage at node_list[0] * NOTE: the calling function must free the allocated storage at node_list[0]
*/ */
extern int slurm_allocate (char *spec, char **node_list, uint16_t *job_id); extern int slurm_allocate (char *spec, char **node_list, uint32_t *job_id);
/* /*
* slurm_cancel - cancel the specified job * slurm_cancel - cancel the specified job
...@@ -184,7 +184,7 @@ extern int slurm_allocate (char *spec, char **node_list, uint16_t *job_id); ...@@ -184,7 +184,7 @@ extern int slurm_allocate (char *spec, char **node_list, uint16_t *job_id);
* output: returns 0 if no error, EINVAL if the request is invalid, * output: returns 0 if no error, EINVAL if the request is invalid,
* EAGAIN if the request can not be satisfied at present * EAGAIN if the request can not be satisfied at present
*/ */
extern int slurm_cancel (uint16_t job_id); extern int slurm_cancel (uint32_t job_id);
/* /*
* slurm_free_build_info - free the build information buffer (if allocated) * slurm_free_build_info - free the build information buffer (if allocated)
...@@ -284,17 +284,15 @@ extern int slurm_load_part (time_t update_time, struct part_buffer **part_buffer ...@@ -284,17 +284,15 @@ extern int slurm_load_part (time_t update_time, struct part_buffer **part_buffer
* Shared=<YES|NO> TimeLimit=<minutes> TotalNodes=<count> * Shared=<YES|NO> TimeLimit=<minutes> TotalNodes=<count>
* TotalProcs=<count> Immediate=<YES|NO> * TotalProcs=<count> Immediate=<YES|NO>
*/ */
extern int slurm_submit (char *spec, uint16_t *job_id); extern int slurm_submit (char *spec, uint32_t *job_id);
/* /*
* slurm_will_run - determine if a job would execute immediately * slurm_will_run - determine if a job would execute immediately
* if submitted. * if submitted.
* input: spec - specification of the job's constraints * input: spec - specification of the job's constraints
* job_id - place to store id of submitted job
* output: returns 0 if job would run now, EINVAL if the request * output: returns 0 if job would run now, EINVAL if the request
* would never run, EAGAIN if job would run later * would never run, EAGAIN if job would run later
* NOTE: required specification include: Script=<script_path_name> * NOTE: required specification include: User=<uid>
* User=<uid>
* NOTE: optional specifications include: Contiguous=<YES|NO> * NOTE: optional specifications include: Contiguous=<YES|NO>
* Features=<features> Groups=<groups> * Features=<features> Groups=<groups>
* Key=<key> MinProcs=<count> * Key=<key> MinProcs=<count>
...@@ -303,7 +301,7 @@ extern int slurm_submit (char *spec, uint16_t *job_id); ...@@ -303,7 +301,7 @@ extern int slurm_submit (char *spec, uint16_t *job_id);
* Shared=<YES|NO> TimeLimit=<minutes> TotalNodes=<count> * Shared=<YES|NO> TimeLimit=<minutes> TotalNodes=<count>
* TotalProcs=<count> * TotalProcs=<count>
*/ */
extern int slurm_will_run (char *spec, uint16_t *job_id); extern int slurm_will_run (char *spec);
/* /*
* parse_node_name - parse the node name for regular expressions and return a sprintf format * parse_node_name - parse the node name for regular expressions and return a sprintf format
......
...@@ -29,7 +29,7 @@ int ...@@ -29,7 +29,7 @@ int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
int error_code, i, count; int error_code, i, count;
uint16_t job_id; uint32_t job_id;
error_code = slurm_submit error_code = slurm_submit
("User=1500 Script=/bin/hostname JobName=job01 TotalNodes=400 TotalProcs=1000 ReqNodes=lx[3000-3003] Partition=batch MinRealMemory=1024 MinTmpDisk=2034 Groups=students,employee MinProcs=4 Contiguous=YES Key=1234", ("User=1500 Script=/bin/hostname JobName=job01 TotalNodes=400 TotalProcs=1000 ReqNodes=lx[3000-3003] Partition=batch MinRealMemory=1024 MinTmpDisk=2034 Groups=students,employee MinProcs=4 Contiguous=YES Key=1234",
...@@ -81,7 +81,7 @@ main (int argc, char *argv[]) ...@@ -81,7 +81,7 @@ main (int argc, char *argv[])
* TotalProcs=<count> Immediate=<YES|NO> * TotalProcs=<count> Immediate=<YES|NO>
*/ */
int int
slurm_submit (char *spec, uint16_t *job_id) slurm_submit (char *spec, uint32_t *job_id)
{ {
int buffer_offset, buffer_size, in_size; int buffer_offset, buffer_size, in_size;
char *request_msg, *buffer; char *request_msg, *buffer;
...@@ -146,6 +146,6 @@ slurm_submit (char *spec, uint16_t *job_id) ...@@ -146,6 +146,6 @@ slurm_submit (char *spec, uint16_t *job_id)
free (buffer); free (buffer);
return EINVAL; return EINVAL;
} }
*job_id = (uint16_t) atoi (buffer); *job_id = (uint32_t) strtol (buffer, (char **)NULL, 10);
return 0; return 0;
} }
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