File: sge_order.c

package info (click to toggle)
gridengine 8.1.9%2Bdfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 56,880 kB
  • sloc: ansic: 432,689; java: 87,068; cpp: 31,958; sh: 29,429; jsp: 7,757; perl: 6,336; xml: 5,828; makefile: 4,701; csh: 3,928; ruby: 2,221; tcl: 1,676; lisp: 669; yacc: 519; python: 503; lex: 361; javascript: 200
file content (170 lines) | stat: -rw-r--r-- 7,555 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*___INFO__MARK_BEGIN__*/
/*************************************************************************
 * 
 *  The Contents of this file are made available subject to the terms of
 *  the Sun Industry Standards Source License Version 1.2
 * 
 *  Sun Microsystems Inc., March, 2001
 * 
 * 
 *  Sun Industry Standards Source License Version 1.2
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.2 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 * 
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 * 
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 * 
 *   Copyright: 2001 by Sun Microsystems, Inc.
 * 
 *   All Rights Reserved.
 * 
 ************************************************************************/
/*___INFO__MARK_END__*/

#include "sgeobj/sge_conf.h"
#include "sgeobj/sge_order.h"
#include "sgeobj/sge_ja_task.h"
#include "sgeobj/sge_job.h"

#include "sge.h"

/****** sge_order/sge_free_cull_order_pos() ************************************
*  NAME
*     sge_free_cull_order_pos() -- frees a cull order struct
*
*  SYNOPSIS
*     void sge_free_cull_order_pos(order_pos_t **cull_order_pos) 
*
*  FUNCTION
*     frees a cull order struct
*
*  INPUTS
*     order_pos_t **cull_order_pos - a douple pointer to the struct. Will be
*                                    set to NULL
*
*  NOTES
*     MT-NOTE: sge_free_cull_order_pos() is MT safe 
*
*******************************************************************************/
void
sge_free_cull_order_pos(order_pos_t **cull_order_pos)
{
   sge_free(cull_order_pos);
}

/****** sge_order/sge_create_cull_order_pos() **********************************
*  NAME
*     sge_create_cull_order_pos() -- generates a cull order position struct
*
*  SYNOPSIS
*     void sge_create_cull_order_pos(order_pos_t **cull_order_pos, lListElem 
*     *jep, lListElem *jatp, lListElem *joker, lListElem *joker_task) 
*
*  FUNCTION
*     generates a cull order position struct
*
*  INPUTS
*     order_pos_t **cull_order_pos - struct to init. if not NULL, the old struct will be freed
*     lListElem *jep               - job structure
*     lListElem *jatp              - ja task structure
*     lListElem *joker             - job order structure
*     lListElem *joker_task        - ja task order structure
*
*  NOTES
*     MT-NOTE: sge_create_cull_order_pos() is MT safe 
*
*******************************************************************************/
void 
sge_create_cull_order_pos(order_pos_t **cull_order_pos, lListElem *jep, lListElem *jatp,
                      lListElem *joker, lListElem *joker_task) 
{
   ja_task_pos_t *ja_pos;
   ja_task_pos_t *order_ja_pos;   
   job_pos_t   *job_pos;
   job_pos_t   *order_job_pos; 

   if (*cull_order_pos != NULL) {
      sge_free(&cull_order_pos);
   }

   *cull_order_pos = malloc(sizeof(order_pos_t));

   ja_pos = &((*cull_order_pos)->ja_task);
   order_ja_pos = &((*cull_order_pos)->order_ja_task);
   job_pos = &((*cull_order_pos)->job);
   order_job_pos = &((*cull_order_pos)->order_job);   

   if (jep != NULL) {
      job_pos->JB_version_pos = lGetPosViaElem(jep,JB_version, SGE_NO_ABORT);
      job_pos->JB_nppri_pos = lGetPosViaElem(jep,JB_nppri, SGE_NO_ABORT);
      job_pos->JB_nurg_pos = lGetPosViaElem(jep,JB_nurg, SGE_NO_ABORT);
      job_pos->JB_urg_pos = lGetPosViaElem(jep,JB_urg, SGE_NO_ABORT);
      job_pos->JB_rrcontr_pos = lGetPosViaElem(jep,JB_rrcontr, SGE_NO_ABORT);
      job_pos->JB_dlcontr_pos = lGetPosViaElem(jep,JB_dlcontr, SGE_NO_ABORT);
      job_pos->JB_wtcontr_pos = lGetPosViaElem(jep,JB_wtcontr, SGE_NO_ABORT);  
/*      
DPRINTF(("job prio pos: %d %d %d %d %d %d %d\n", job_pos->JB_version_pos, job_pos->JB_nppri_pos,  job_pos->JB_nurg_pos,
                                  job_pos->JB_urg_pos, job_pos->JB_rrcontr_pos, job_pos->JB_dlcontr_pos,
                                  job_pos->JB_wtcontr_pos));#
*/                                  
   }

   if (jatp != NULL) {
      ja_pos->JAT_status_pos = lGetPosViaElem(jatp,JAT_status, SGE_NO_ABORT);
      ja_pos->JAT_tix_pos = lGetPosViaElem(jatp,JAT_tix, SGE_NO_ABORT);

      ja_pos->JAT_oticket_pos = lGetPosViaElem(jatp,JAT_oticket, SGE_NO_ABORT);
      ja_pos->JAT_fticket_pos = lGetPosViaElem(jatp,JAT_fticket, SGE_NO_ABORT);
      ja_pos->JAT_sticket_pos = lGetPosViaElem(jatp,JAT_sticket, SGE_NO_ABORT);
      ja_pos->JAT_share_pos = lGetPosViaElem(jatp,JAT_share, SGE_NO_ABORT);
      ja_pos->JAT_prio_pos = lGetPosViaElem(jatp,JAT_prio, SGE_NO_ABORT);
      ja_pos->JAT_ntix_pos = lGetPosViaElem(jatp,JAT_ntix, SGE_NO_ABORT);
/*
DPRINTF(("ja task prio pos: %d %d %d %d %d %d %d %d\n", ja_pos->JAT_status_pos, ja_pos->JAT_tix_pos, ja_pos->JAT_oticket_pos,
                                        ja_pos->JAT_fticket_pos, ja_pos->JAT_sticket_pos, 
                                        ja_pos->JAT_share_pos, ja_pos->JAT_prio_pos, ja_pos->JAT_ntix_pos)); 
*/                                        
   }

   if (joker != NULL) {
      order_job_pos->JB_version_pos = -1;
      order_job_pos->JB_nppri_pos = lGetPosViaElem(joker,JB_nppri, SGE_NO_ABORT);
      order_job_pos->JB_nurg_pos = lGetPosViaElem(joker,JB_nurg, SGE_NO_ABORT);
      order_job_pos->JB_urg_pos = lGetPosViaElem(joker,JB_urg, SGE_NO_ABORT);
      order_job_pos->JB_rrcontr_pos = lGetPosViaElem(joker,JB_rrcontr, SGE_NO_ABORT);
      order_job_pos->JB_dlcontr_pos = lGetPosViaElem(joker,JB_dlcontr, SGE_NO_ABORT);
      order_job_pos->JB_wtcontr_pos = lGetPosViaElem(joker,JB_wtcontr, SGE_NO_ABORT);
/*
      DPRINTF(("job order pos: %d %d %d %d %d %d %d\n", order_job_pos->JB_version_pos, order_job_pos->JB_nppri_pos,  order_job_pos->JB_nurg_pos,
                                  order_job_pos->JB_urg_pos, order_job_pos->JB_rrcontr_pos, order_job_pos->JB_dlcontr_pos,
                                  order_job_pos->JB_wtcontr_pos));
*/                                  
   }

   if (joker_task != NULL) {
      order_ja_pos->JAT_status_pos = -1;
      order_ja_pos->JAT_tix_pos = -1;

      order_ja_pos->JAT_oticket_pos = lGetPosViaElem(joker_task,JAT_oticket, SGE_NO_ABORT);
      order_ja_pos->JAT_fticket_pos = lGetPosViaElem(joker_task,JAT_fticket, SGE_NO_ABORT);
      order_ja_pos->JAT_sticket_pos = lGetPosViaElem(joker_task,JAT_sticket, SGE_NO_ABORT);
      order_ja_pos->JAT_share_pos = lGetPosViaElem(joker_task,JAT_share, SGE_NO_ABORT);
      order_ja_pos->JAT_prio_pos = lGetPosViaElem(joker_task,JAT_prio, SGE_NO_ABORT);
      order_ja_pos->JAT_ntix_pos = lGetPosViaElem(joker_task,JAT_ntix, SGE_NO_ABORT);  
/*
      DPRINTF(("ja task order pos: %d %d %d %d %d %d %d %d\n", order_ja_pos->JAT_status_pos, order_ja_pos->JAT_tix_pos, order_ja_pos->JAT_oticket_pos,
                                        order_ja_pos->JAT_fticket_pos, order_ja_pos->JAT_sticket_pos, 
                                        order_ja_pos->JAT_share_pos, order_ja_pos->JAT_prio_pos, order_ja_pos->JAT_ntix_pos));  
*/                                        
   }
}