From 48cd54da6127beeab59d57a00347d9e3583d42eb Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 14 Jan 2003 22:57:59 +0000 Subject: [PATCH] Describe new scontrol command pid2jobid New API defined slurm_pid2jobid. Minor format clean-up on other man pages. --- doc/man/man3/hostlist_create.3 | 6 +-- doc/man/man3/slurm_allocate_resources.3 | 8 ++-- doc/man/man3/slurm_free_ctl_conf.3 | 4 +- doc/man/man3/slurm_free_job_info_msg.3 | 42 ++++++++++++++++--- .../slurm_free_job_step_info_response_msg.3 | 6 +-- doc/man/man3/slurm_free_node_info.3 | 6 +-- doc/man/man3/slurm_free_partition_info.3 | 6 +-- doc/man/man3/slurm_get_errno.3 | 9 ++-- doc/man/man3/slurm_pid2jobid.3 | 1 + 9 files changed, 60 insertions(+), 28 deletions(-) create mode 100644 doc/man/man3/slurm_pid2jobid.3 diff --git a/doc/man/man3/hostlist_create.3 b/doc/man/man3/hostlist_create.3 index da62704a7a8..4fb4c7ccb74 100644 --- a/doc/man/man3/hostlist_create.3 +++ b/doc/man/man3/hostlist_create.3 @@ -1,4 +1,4 @@ -.TH "Slurm API" "3" "November 2002" "Morris Jette" "Slurm host list support functions" +.TH "Slurm API" "3" "January 2003" "Morris Jette" "Slurm host list support functions" .SH "NAME" hostlist_create \- Slurm host list support functions .SH "SYNTAX" @@ -81,7 +81,7 @@ int main (int argc, char *argv[]) .br if (my_hostlist == NULL) { .br - fprintf (stderr, "No memory\n"); + fprintf (stderr, "No memory\\n"); .br exit (1); .br @@ -89,7 +89,7 @@ int main (int argc, char *argv[]) .LP while ( (host = hostlist_shift(my_hostlist)) ) .br - printf ("host = %s\n", host); + printf ("host = %s\\n", host); .LP hostlist_destroy (my_hostlist) ; .br diff --git a/doc/man/man3/slurm_allocate_resources.3 b/doc/man/man3/slurm_allocate_resources.3 index 3698153bc08..577c933edfc 100644 --- a/doc/man/man3/slurm_allocate_resources.3 +++ b/doc/man/man3/slurm_allocate_resources.3 @@ -1,4 +1,4 @@ -.TH "Slurm API" "3" "December 2002" "Morris Jette" "Slurm job initiation functions" +.TH "Slurm API" "3" "January 2003" "Morris Jette" "Slurm job initiation functions" .SH "NAME" slurm_allocate_resources, slurm_allocate_resources_and_run, slurm_confirm_allocation, @@ -232,7 +232,7 @@ int main (int argc, char *argv[]) .br } .br - printf ("Allocated nodes %s to job_id %u\n", + printf ("Allocated nodes %s to job_id %u\\n", .br slurm_alloc_msg_ptr->node_list, .br @@ -242,13 +242,13 @@ int main (int argc, char *argv[]) .br job_id)) { .br - printf ("cancel errno %d\n", slurm_get_errno()); + printf ("cancel errno %d\\n", slurm_get_errno()); .br exit (1); .br } .br - printf ("canceled job_id %u\n", + printf ("canceled job_id %u\\n", .br slurm_alloc_msg_ptr->job_id ); .br diff --git a/doc/man/man3/slurm_free_ctl_conf.3 b/doc/man/man3/slurm_free_ctl_conf.3 index 253c6fc0953..6cffc5a21e4 100644 --- a/doc/man/man3/slurm_free_ctl_conf.3 +++ b/doc/man/man3/slurm_free_ctl_conf.3 @@ -100,11 +100,11 @@ int main (int argc, char *argv[]) .LP /* The hard way */ .br - printf ("control_machine = %s\n", + printf ("control_machine = %s\\n", .br slurm_ctl_conf_ptr->control_machine); .br - printf ("server_timeout = %u\n", + printf ("server_timeout = %u\\n", .br slurm_ctl_conf_ptr->server_timeout); .LP diff --git a/doc/man/man3/slurm_free_job_info_msg.3 b/doc/man/man3/slurm_free_job_info_msg.3 index 5b11099fd0a..154cd16a80f 100644 --- a/doc/man/man3/slurm_free_job_info_msg.3 +++ b/doc/man/man3/slurm_free_job_info_msg.3 @@ -1,4 +1,4 @@ -.TH "Slurm API" "3" "October 2002" "Morris Jette" "Slurm job information reporting functions" +.TH "Slurm API" "3" "January 2003" "Morris Jette" "Slurm job information reporting functions" .SH "NAME" slurm_free_job_info_msg, slurm_load_jobs, slurm_print_job_info, slurm_print_job_info_msg @@ -8,6 +8,8 @@ slurm_print_job_info, slurm_print_job_info_msg #include <stdio.h> .br #include <slurm.h> +.br +#include <sys/types.h> .LP void \fBslurm_free_job_info_msg\fR ( .br @@ -23,9 +25,17 @@ int \fBslurm_load_jobs\fR ( .br ); .LP +int \fBslurm_pid2jobid\fR ( +.br + pid_t \fIjob_pid\fP, +.br + uint32_t *\fIjob_id_ptr\fP +.br +); +.LP void \fBslurm_print_job_info\fR ( .br - FILE *\fIout_file\fp, + FILE *\fIout_file\fP, .br job_info_t *\fIjob_ptr\fP .br @@ -33,7 +43,7 @@ void \fBslurm_print_job_info\fR ( .LP void \fBslurm_print_job_info_msg\fR ( .br - FILE *\fIout_file\fp, + FILE *\fIout_file\fP, .br job_info_msg_t *\fIjob_info_msg_ptr\fP .br @@ -51,14 +61,20 @@ of integers with pairs of start and end index number into the node information records and the data is terminated with a value of -1. See slurm.h for full details on the data structure's contents. .TP +\fIjob_id_ptr\fP +Specifies a pointer to a storage location into which a Slurm job id may be placed. +.TP \fIjob_info_msg_ptr\fP Specifies the pointer to the structure created by \fBslurm_load_jobs\fR. +.TP +\fIjob_pid\fP +Specifies a process id of some process on the current node. .TP \fIjob_ptr\fP Specifies a pointer to a single job records from the \fIjob_info_msg_ptr\fP data structure. .TP -\fIout_file\ +\fIout_file\fP Specifies the file to print data to. .TP \fIupdate_time\fP @@ -70,6 +86,8 @@ function. .LP \fBslurm_load_jobs\fR Returns a job_info_msg_t that contains an update time, record count, and array of job_table records for all jobs. .LP +\fBslurm_pid2jobid\fR Returns a Slurm job id corresponding to the supplied local process id. +.LP \fBslurm_print_job_info\fR Prints the contents of the data structure describing a single job records from the data loaded by the \fBslurm_load_node\fR function. .LP @@ -88,6 +106,8 @@ On success, zero is returned. On error, -1 is returned, and Slurm error code is #include <stdio.h> .br #include <slurm.h> +.br +#include <sys/types.h> .LP int main (int argc, char *argv[]) .br @@ -98,6 +118,8 @@ int main (int argc, char *argv[]) job_info_msg_t * job_info_msg = NULL; .br job_info_t * job_ptr; +.br + uint32_t job_id; .LP /* get and dump some job information */ .br @@ -127,7 +149,7 @@ int main (int argc, char *argv[]) .LP /* The hardest way. */ .br - printf ("Jobs updated at %lx, record count %d\n", + printf ("Jobs updated at %lx, record count %d\\n", .br job_buffer_ptr->last_update, .br @@ -135,7 +157,7 @@ int main (int argc, char *argv[]) .br for (i = 0; i < job_buffer_ptr->record_count; i++) { .br - printf ("JobId=%u UserId=%u\n", + printf ("JobId=%u UserId=%u\\n", .br job_buffer_ptr->job_array[i].job_id, .br @@ -144,6 +166,14 @@ int main (int argc, char *argv[]) } .LP slurm_free_job_info_msg (job_buffer_ptr); +.LP + if (slurm_pid2jobid (getpid(), &job_id)) +.br + slurm_perror ("slurm_load_jobs error"); +.br + else +.br + printf ("Slurm job id = %u\\n", job_id); .br exit (0); .br diff --git a/doc/man/man3/slurm_free_job_step_info_response_msg.3 b/doc/man/man3/slurm_free_job_step_info_response_msg.3 index bce4dc6dd80..8f19c854bbf 100644 --- a/doc/man/man3/slurm_free_job_step_info_response_msg.3 +++ b/doc/man/man3/slurm_free_job_step_info_response_msg.3 @@ -1,4 +1,4 @@ -.TH "Slurm API" "3" "October 2002" "Morris Jette" "Slurm job step information functions" +.TH "Slurm API" "3" "January 2003" "Morris Jette" "Slurm job step information functions" .SH "NAME" \fBslurm_free_job_step_info_response_msg, slurm_get_job_steps, slurm_print_job_step_info, slurm_print_job_step_info_msg @@ -142,7 +142,7 @@ int main (int argc, char *argv[]) .LP /* The hardest way. */ .br - printf ("Steps updated at %lx, record count %d\n", + printf ("Steps updated at %lx, record count %d\\n", .br step_info_ptr->last_update, .br @@ -150,7 +150,7 @@ int main (int argc, char *argv[]) .br for (i = 0; i < step_info_ptr->job_step_count; i++) { .br - printf ("JobId=%u StepId=%u\n", + printf ("JobId=%u StepId=%u\\n", .br step_info_ptr->job_steps[i].job_id, .br diff --git a/doc/man/man3/slurm_free_node_info.3 b/doc/man/man3/slurm_free_node_info.3 index 94adb48a5b5..5d76bac282f 100644 --- a/doc/man/man3/slurm_free_node_info.3 +++ b/doc/man/man3/slurm_free_node_info.3 @@ -1,4 +1,4 @@ -.TH "Slurm API" "3" "October 2002" "Morris Jette" "Slurm node informational calls" +.TH "Slurm API" "3" "January 2003" "Morris Jette" "Slurm node informational calls" .SH "NAME" slurm_free_node_info, slurm_load_node, slurm_print_node_info_msg, slurm_print_node_table @@ -141,7 +141,7 @@ int main (int argc, char *argv[]) .br for (i = 0; i < node_buffer_ptr->node_count; i++) { .br - printf ("NodeName=%s CPUs=%u\n", + printf ("NodeName=%s CPUs=%u\\n", .br node_buffer_ptr->node_array[i].name, .br @@ -195,7 +195,7 @@ int main (int argc, char *argv[]) .br } .br - printf("\n\n"); + printf("\\n\\n"); .br } .br diff --git a/doc/man/man3/slurm_free_partition_info.3 b/doc/man/man3/slurm_free_partition_info.3 index c37d4f28887..a05620bfc85 100644 --- a/doc/man/man3/slurm_free_partition_info.3 +++ b/doc/man/man3/slurm_free_partition_info.3 @@ -1,4 +1,4 @@ -.TH "Slurm API" "3" "October 2002" "Morris Jette" "Slurm partition information reporting functions" +.TH "Slurm API" "3" "January 2003" "Morris Jette" "Slurm partition information reporting functions" .SH "NAME" slurm_free_partition_info, slurm_load_partitions, slurm_print_partition_info, slurm_print_partition_info_msg @@ -118,7 +118,7 @@ int main (int argc, char *argv[]) .LP /* The hardest way. */ .br - printf("Partitions updated at %lx, records=%d\n", + printf("Partitions updated at %lx, records=%d\\n", .br part_buffer_ptr->last_update, .br @@ -126,7 +126,7 @@ int main (int argc, char *argv[]) .br for (i = 0; i < part_buffer_ptr->record_count; i++) { .br - printf ("PartitionName=%s Nodes=%s\n", + printf ("PartitionName=%s Nodes=%s\\n", .br part_info_ptr->partition_array[i].name, .br diff --git a/doc/man/man3/slurm_get_errno.3 b/doc/man/man3/slurm_get_errno.3 index 4b608f125c9..7d83a31cc64 100644 --- a/doc/man/man3/slurm_get_errno.3 +++ b/doc/man/man3/slurm_get_errno.3 @@ -1,4 +1,4 @@ -.TH "Slurm API" "3" "October 2002" "Morris Jette" "Slurm error handling functions" +.TH "Slurm API" "3" "January 2003" "Morris Jette" "Slurm error handling functions" .SH "NAME" slurm_get_errno, slurm_perror, slurm_strerror \- Slurm error handling functions .SH "SYNTAX" @@ -48,11 +48,11 @@ int main (int argc, char *argv[]) .br /* assume Slurm API function failed here */ .br - fprintf (stderr, "Slurm function errno = %d\n", + fprintf (stderr, "Slurm function errno = %d\\n", .br slurm_get_errno ()); .br - fprintf (stderr, "Slurm function errno = %d %s\n", + fprintf (stderr, "Slurm function errno = %d %s\\n", .br slurm_get_errno (), .br @@ -93,10 +93,11 @@ details. \fBslurm_free_resource_allocation_response_msg\fR(3), \fBslurm_free_submit_response_response_msg\fR(3), \fBslurm_get_job_steps\fR(3), -\fBslurm_init_job_desc_msg\fR(3), \fBslurm_init_part_desc_msg\fR(3), +\fBslurm_init_job_desc_msg\fR(3), \fBslurm_init_part_desc_msg\fR(3), \fBslurm_job_step_create\fR(3), \fBslurm_job_will_run\fR(3), \fBslurm_load_ctl_conf\fR(3), \fBslurm_load_jobs\fR(3), \fBslurm_load_node\fR(3), \fBslurm_load_partitions\fR(3), +\fBslurm_pid2jobid\fR(3), \fBslurm_reconfigure\fR(3), \fBslurm_shutdown\fR(3), \fBslurm_submit_batch_job\fR(3), \fBslurm_update_job\fR(3), \fBslurm_update_node\fR(3), \fBslurm_update_partition\fR(3) diff --git a/doc/man/man3/slurm_pid2jobid.3 b/doc/man/man3/slurm_pid2jobid.3 new file mode 100644 index 00000000000..836ffa79b47 --- /dev/null +++ b/doc/man/man3/slurm_pid2jobid.3 @@ -0,0 +1 @@ +.so man3/slurm_free_job_info_msg.3 -- GitLab