From 981bed16bc0e293bdcf729ae3ce9b0b327a2d4c8 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 3 Dec 2002 16:43:22 +0000 Subject: [PATCH] Minor tweaks to output formating. --- src/srun/io.c | 8 ++++---- src/srun/launch.c | 6 +++--- src/srun/srun.c | 30 ++++++++++++++++++++---------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/srun/io.c b/src/srun/io.c index de7788834a1..4b70a58cc77 100644 --- a/src/srun/io.c +++ b/src/srun/io.c @@ -343,11 +343,11 @@ void report_task_status(job_t *job) break; } if (first_task == last_task) - printf("task:%d state:%s\n", first_task, - _task_state_name(current_state)); + info("task:%d state:%s\n", first_task, + _task_state_name(current_state)); else - printf("tasks:%d-%d state:%s\n", first_task, - last_task, _task_state_name(current_state)); + info("tasks:%d-%d state:%s\n", first_task, + last_task, _task_state_name(current_state)); i = last_task; } } diff --git a/src/srun/launch.c b/src/srun/launch.c index 2bd9df7f4d0..bc76fd263a1 100644 --- a/src/srun/launch.c +++ b/src/srun/launch.c @@ -312,9 +312,9 @@ _print_launch_msg(launch_tasks_request_msg_t *msg, char * hostname) } } - printf("launching %u.%u on host %s, %u tasks: %s\n", - msg->job_id, msg->job_step_id, hostname, - msg->tasks_to_launch, task_list); + info("launching %u.%u on host %s, %u tasks: %s", + msg->job_id, msg->job_step_id, hostname, + msg->tasks_to_launch, task_list); debug3("uid:%ld cwd:%s %d", (long) msg->uid, msg->cwd, msg->srun_node_id); diff --git a/src/srun/srun.c b/src/srun/srun.c index 725e9363068..fe056749ad9 100644 --- a/src/srun/srun.c +++ b/src/srun/srun.c @@ -161,7 +161,7 @@ main(int ac, char **av) exit (1); exit (0); } else if (opt.no_alloc) { - printf("do not allocate resources\n"); + info("do not allocate resources"); job = job_create(NULL); #ifdef HAVE_LIBELAN3 _qsw_standalone(job); @@ -175,7 +175,7 @@ main(int ac, char **av) if ( !(resp = _allocate_nodes()) ) exit(1); job = job_create(resp); - if (_debug) + if (_verbose || _debug) _print_job_information(resp); _run_job_script(resp->job_id); slurm_complete_job(resp->job_id, 0, 0); @@ -185,7 +185,7 @@ main(int ac, char **av) } else { if ( !(resp = _allocate_nodes()) ) exit(1); - if (_debug) + if (_verbose || _debug) _print_job_information(resp); job = job_create(resp); @@ -487,13 +487,23 @@ static void _print_job_information(allocation_resp *resp) { int i; - printf("jobid %d: `%s', cpu counts: ", resp->job_id, resp->node_list); + char tmp_str[10], job_details[4096]; + + sprintf(job_details, "jobid %d: `%s', cpu counts: ", + resp->job_id, resp->node_list); for (i = 0; i < resp->num_cpu_groups; i++) { - printf("%u(x%u), ", resp->cpus_per_node[i], - resp->cpu_count_reps[i]); + sprintf(tmp_str, ",%u(x%u)", resp->cpus_per_node[i], + resp->cpu_count_reps[i]); + if (i == 0) + strcat(job_details, &tmp_str[1]); + else if ((strlen(tmp_str) + strlen(job_details)) < + sizeof(job_details)) + strcat(job_details, tmp_str); + else + break; } - printf("\n"); + info("%s",job_details); } static void @@ -528,13 +538,13 @@ _sig_thr(void *arg) switch (signo) { case SIGINT: if ((time(NULL) - last_intr) > 1) { - printf("interrupt (one more within 1 sec to abort)\n"); + info("interrupt (one more within 1 sec to abort)"); report_task_status(job); last_intr = time(NULL); } else { /* second Ctrl-C in half as many seconds */ /* terminate job */ if (job->state != SRUN_JOB_OVERDONE) { - printf("sending Ctrl-C to job\n"); + info("sending Ctrl-C to job"); last_intr = time(NULL); _fwd_signal(job, signo); } else { @@ -766,7 +776,7 @@ _run_batch_job(void) if (rc == 0) { - printf ("jobid %u\n",resp->job_id); + info("jobid %u",resp->job_id); slurm_free_submit_response_response_msg (resp); } xfree (job_script); -- GitLab