1
/*___INFO__MARK_BEGIN__*/
2
/*************************************************************************
4
* The Contents of this file are made available subject to the terms of
5
* the Sun Industry Standards Source License Version 1.2
7
* Sun Microsystems Inc., March, 2001
10
* Sun Industry Standards Source License Version 1.2
11
* =================================================
12
* The contents of this file are subject to the Sun Industry Standards
13
* Source License Version 1.2 (the "License"); You may not use this file
14
* except in compliance with the License. You may obtain a copy of the
15
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
17
* Software provided under this License is provided on an "AS IS" basis,
18
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
19
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
20
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
21
* See the License for the specific provisions governing your rights and
22
* obligations concerning the Software.
24
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
26
* Copyright: 2001 by Sun Microsystems, Inc.
28
* All Rights Reserved.
30
************************************************************************/
31
/*___INFO__MARK_END__*/
35
#include "sge_usageL.h"
37
#include "sge_ja_task.h"
38
#include "sge_pe_task.h"
39
#include "sge_report.h"
41
#include "msg_sgeobjlib.h"
45
/****** sgeobj/report/job_report_print_usage() *******************************
47
* job_report_print_usage() -- Print usage contained in job report
50
* void job_report_print_usage(const lListElem *job_report,
54
* Print usage information conatines in "job_report". Print the
55
* information to the given file stream "fp" or as debug messages.
58
* const lListElem *job_report - JR_Type element
59
* FILE *fp - file stream or NULL
60
******************************************************************************/
61
void job_report_print_usage(const lListElem *job_report, FILE *fp)
65
DENTER(TOP_LAYER, "job_report_print_usage");
72
for_each(uep, lGetList(job_report, JR_usage)) {
74
fprintf(fp, " \"%s\" = %.99g\n", lGetString(uep, UA_name),
75
lGetDouble(uep, UA_value));
77
DPRINTF((" \"%s\" = %.99g\n", lGetString(uep, UA_name),
78
lGetDouble(uep, UA_value)));
87
/****** sgeobj/report/job_report_init_from_job() *****************************
89
* job_report_init_from_job() -- initialize job report
92
* void job_report_init_from_job(lListElem *job_report,
93
* const lListElem *job,
94
* const lListElem *ja_task,
95
* const lListElem *pe_task)
98
* Initialize "job_report" from the attributes obtained from
99
* "job", "ja_task" and "pe_task".
102
* lListElem *job_report - JR_Type object
103
* const lListElem *job - JB_Type object
104
* const lListElem *ja_task - JAT_Type object
105
* const lListElem *pe_task - PET_Type object
106
******************************************************************************/
107
void job_report_init_from_job(lListElem *job_report,
108
const lListElem *job,
109
const lListElem *ja_task,
110
const lListElem *pe_task)
112
u_long32 job_id = lGetUlong(job, JB_job_number);
113
u_long32 ja_task_id = lGetUlong(ja_task, JAT_task_number);
114
lListElem *queue = NULL; /* QU_Type */
116
DENTER(TOP_LAYER, "job_report_init_from_job");
118
lSetUlong(job_report, JR_job_number, job_id);
119
lSetUlong(job_report, JR_ja_task_number, ja_task_id);
121
if (pe_task != NULL) {
122
lSetString(job_report, JR_pe_task_id_str, lGetString(pe_task, PET_id));
123
queue = lFirst(lGetList(pe_task, PET_granted_destin_identifier_list));
125
queue = lFirst(lGetList(ja_task, JAT_granted_destin_identifier_list));
128
if (lGetUlong(ja_task, JAT_status) == JSLAVE){
129
if (pe_task == NULL) {
130
lSetUlong(job_report, JR_state, JSLAVE);
132
lSetUlong(job_report, JR_state, JWRITTEN);
135
lSetUlong(job_report, JR_state, JWRITTEN);
139
lSetString(job_report, JR_queue_name, lGetString(queue, JG_qname));