source: trunk/pbs_drmaa/pbs_attrib.gperf @ 1

Revision 1, 7.6 KB checked in by mmamonski, 14 years ago (diff)

Torque/PBS DRMAA initial commit

Line 
1%{
2/* $Id: pbs_attrib.gperf 2677 2009-09-08 14:32:22Z mmamonski $ */
3/*
4 *  FedStage DRMAA for PBS Pro
5 *  Copyright (C) 2006-2009  FedStage Systems
6 *
7 *  This program is free software: you can redistribute it and/or modify
8 *  it under the terms of the GNU General Public License as published by
9 *  the Free Software Foundation, either version 3 of the License, or
10 *  (at your option) any later version.
11 *
12 *  This program is distributed in the hope that it will be useful,
13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *  GNU General Public License for more details.
16 *
17 *  You should have received a copy of the GNU General Public License
18 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifdef HAVE_CONFIG_H
21#       include <config.h>
22#endif
23
24#include <drmaa_utils/drmaa_attrib.h>
25#include <drmaa_utils/template.h>
26#include <pbs_drmaa/pbs_attrib.h>
27
28#ifndef lint
29static char rcsid[]
30#       ifdef __GNUC__
31                __attribute__ ((unused))
32#       endif
33        = "$Id: pbs_attrib.gperf 2677 2009-09-08 14:32:22Z mmamonski $";
34#endif
35
36extern const fsd_attribute_t pbsdrmaa_pbs_attributes[];
37#define t(code) \
38        ( & pbsdrmaa_pbs_attributes[ code ] )
39%}
40
41%language=ANSI-C
42%includes
43%readonly-tables
44%pic
45%define lookup-function-name pbsdrmaa_pbs_attrib_lookup
46%struct-type
47struct pbs_attrib { int name; const fsd_attribute_t *attr; }
48
49%%
50Execution_Time, t(PBSDRMAA_ATTR_EXECUTION_TIME)
51Checkpoint, t(PBSDRMAA_ATTR_CHECKPOINT)
52Error_Path, t(PBSDRMAA_ATTR_ERROR_PATH)
53group_list, t(PBSDRMAA_ATTR_GROUPS)
54Hold_Types, t(PBSDRMAA_ATTR_HOLD_TYPES)
55Join_Path, t(PBSDRMAA_ATTR_JOIN_FILES)
56Keep_Files, t(PBSDRMAA_ATTR_KEEP_FILES)
57# Resource_List, t(PBSDRMAA_ATTR_RESOURCES)
58Resource_List.cput, t(PBSDRMAA_ATTR_CPU_TIME_LIMIT)
59Resource_List.file, t(PBSDRMAA_ATTR_FILE_SIZE_LIMIT)
60Resource_List.nice, t(PBSDRMAA_ATTR_NICE)
61Resource_List.vmem, t(PBSDRMAA_ATTR_VMEM_LIMIT)
62Resource_List.pcput, t(PBSDRMAA_ATTR_SINGLE_CPU_TIME_LIMIT)
63Resource_List.pmem, t(PBSDRMAA_ATTR_SINGLE_RSS_LIMIT)
64Resource_List.pvmem, t(PBSDRMAA_ATTR_SINGLE_VMEM_LIMIT)
65Resource_List.walltime, t(PBSDRMAA_ATTR_WALLTIME_LIMIT)
66Resource_List.arch, t(PBSDRMAA_ATTR_ARCHITECTURE)
67Resource_List.host, t(PBSDRMAA_ATTR_HOST)
68Resource_List.nodes, t(PBSDRMAA_ATTR_NODES)
69Resource_List.software, t(PBSDRMAA_ATTR_SOFTWARE)
70Mail_Points, t(PBSDRMAA_ATTR_MAIL_POINTS)
71Output_Path, t(PBSDRMAA_ATTR_OUTPUT_PATH)
72Priority, t(PBSDRMAA_ATTR_PRIORITY)
73destination, t(PBSDRMAA_ATTR_DESITINATION)
74Rerunable, t(PBSDRMAA_ATTR_RERUNABLE)
75job_array_request, t(PBSDRMAA_ATTR_BULK_REQ)
76job_array_id, t(PBSDRMAA_ATTR_BULK_IDX)
77User_List, t(PBSDRMAA_ATTR_USERS)
78Variable_List, t(PBSDRMAA_ATTR_JOB_ENVIRONMENT)
79Account_Name, t(PBSDRMAA_ATTR_ACCOUNT_NAME)
80Mail_Users, t(PBSDRMAA_ATTR_EMAIL)
81Job_Name, t(PBSDRMAA_ATTR_JOB_NAME)
82Shell_Path_List, t(PBSDRMAA_ATTR_SHELL)
83depend, t(PBSDRMAA_ATTR_DEPEND)
84interactive, t(PBSDRMAA_ATTR_INTERACTIVE)
85stagein, t(PBSDRMAA_ATTR_STAGEIN)
86stageout, t(PBSDRMAA_ATTR_STAGEOUT)
87# additional job and general attribute names
88exec_host, t(PBSDRMAA_ATTR_EXECUTION_HOST)
89Job_Owner, t(PBSDRMAA_ATTR_JOB_OWNER)
90resources_used, t(PBSDRMAA_ATTR_RESOURCES_USED)
91job_state, t(PBSDRMAA_ATTR_JOB_STATE)
92queue, t(PBSDRMAA_ATTR_QUEUE)
93server, t(PBSDRMAA_ATTR_SERVER)
94comment, t(PBSDRMAA_ATTR_COMMENT)
95exit_status, t(PBSDRMAA_ATTR_EXIT_STATUS)
96start_time, t(PBSDRMAA_ATTR_START_TIME)
97x, t(PBSDRMAA_ATTR_EXTENSION)
98submit_args, t(PBSDRMAA_ATTR_SUBMIT_ARGS)
99mtime, t(PBSDRMAA_ATTR_MTIME)
100# reservation attributes:
101# reserve_start,       t(PBSDRMAA_ATTR_RESERVATION_START)
102# reserve_end,         t(PBSDRMAA_ATTR_RESERVATION_END)
103# reserve_duration,    t(PBSDRMAA_ATTR_RESERVATION_DURATION)
104# reserve_state,       t(PBSDRMAA_ATTR_RESERVATION_STATE)
105# reserve_substate,    t(PBSDRMAA_ATTR_RESERVATION_SUBSTATE)
106%%
107#undef t
108
109int
110pbsdrmaa_pbs_attrib_by_name( const char *name )
111{
112        const struct pbs_attrib *found;
113        found = pbsdrmaa_pbs_attrib_lookup( name, strlen(name) );
114        if( found )
115                return found->attr->code;
116        else
117                return -1;
118}
119
120static const fsd_attribute_t *
121pbsdrmaa_pbs_template_by_name( const fsd_template_t *self, const char *name )
122{
123        const struct pbs_attrib *found;
124        found = pbsdrmaa_pbs_attrib_lookup( name, strlen(name) );
125        if( found != NULL )
126         {
127                fsd_assert( found->attr - pbsdrmaa_pbs_attributes == found->attr->code );
128                return found->attr;
129         }
130        else
131                fsd_exc_raise_fmt(
132                                FSD_ERRNO_INVALID_ARGUMENT,
133                                "invalid PBS attribute name: %s", name
134                                );
135}
136
137
138static const fsd_attribute_t *
139pbsdrmaa_pbs_template_by_code( const fsd_template_t *self, int code )
140{
141        if( 0 <= code  &&  code < PBSDRMAA_N_PBS_ATTRIBUTES )
142         {
143                fsd_assert( pbsdrmaa_pbs_attributes[code].code == code );
144                return & pbsdrmaa_pbs_attributes[ code ];
145         }
146        else
147                fsd_exc_raise_fmt(
148                                FSD_ERRNO_INVALID_ARGUMENT,
149                                "invalid PBS attribute code: %d", code
150                                );
151}
152
153
154fsd_template_t *
155pbsdrmaa_pbs_template_new(void)
156{
157        return fsd_template_new(
158                        pbsdrmaa_pbs_template_by_name,
159                        pbsdrmaa_pbs_template_by_code,
160                        PBSDRMAA_N_PBS_ATTRIBUTES
161                        );
162}
163
164const fsd_attribute_t pbsdrmaa_pbs_attributes[ PBSDRMAA_N_PBS_ATTRIBUTES ] = {
165        { "Execution_Time", PBSDRMAA_ATTR_EXECUTION_TIME, false },
166        { "Checkpoint", PBSDRMAA_ATTR_CHECKPOINT, false },
167        { "Error_Path", PBSDRMAA_ATTR_ERROR_PATH, false },
168        { "group_list", PBSDRMAA_ATTR_GROUPS, false },
169        { "Hold_Types", PBSDRMAA_ATTR_HOLD_TYPES, false },
170        { "Join_Path", PBSDRMAA_ATTR_JOIN_FILES, false },
171        { "Keep_Files", PBSDRMAA_ATTR_KEEP_FILES, false },
172        { "Resource_List.cput", PBSDRMAA_ATTR_CPU_TIME_LIMIT, false },
173        { "Resource_List.file", PBSDRMAA_ATTR_FILE_SIZE_LIMIT, false },
174        { "Resource_List.nice", PBSDRMAA_ATTR_NICE, false },
175        { "Resource_List.vmem", PBSDRMAA_ATTR_VMEM_LIMIT, false },
176        { "Resource_List.pcput", PBSDRMAA_ATTR_SINGLE_CPU_TIME_LIMIT, false },
177        { "Resource_List.pmem", PBSDRMAA_ATTR_SINGLE_RSS_LIMIT, false },
178        { "Resource_List.pvmem", PBSDRMAA_ATTR_SINGLE_VMEM_LIMIT, false },
179        { "Resource_List.walltime", PBSDRMAA_ATTR_WALLTIME_LIMIT, false },
180        { "Resource_List.arch", PBSDRMAA_ATTR_ARCHITECTURE, false },
181        { "Resource_List.host", PBSDRMAA_ATTR_HOST, false },
182        { "Resource_List.nodes", PBSDRMAA_ATTR_NODES, false },
183        { "Resource_List.software", PBSDRMAA_ATTR_SOFTWARE, false },
184        { "Mail_Points", PBSDRMAA_ATTR_MAIL_POINTS, false },
185        { "Output_Path", PBSDRMAA_ATTR_OUTPUT_PATH, false },
186        { "Priority", PBSDRMAA_ATTR_PRIORITY, false },
187        { "destination", PBSDRMAA_ATTR_DESITINATION, false },
188        { "Rerunable", PBSDRMAA_ATTR_RERUNABLE, false },
189        { "job_array_request", PBSDRMAA_ATTR_BULK_REQ, false },
190        { "job_array_id", PBSDRMAA_ATTR_BULK_IDX, false },
191        { "User_List", PBSDRMAA_ATTR_USERS, false },
192        { "Variable_List", PBSDRMAA_ATTR_JOB_ENVIRONMENT, false },
193        { "Account_Name", PBSDRMAA_ATTR_ACCOUNT_NAME, false },
194        { "Mail_Users", PBSDRMAA_ATTR_EMAIL, false },
195        { "Job_Name", PBSDRMAA_ATTR_JOB_NAME, false },
196        { "Shell_Path_List", PBSDRMAA_ATTR_SHELL, false },
197        { "depend", PBSDRMAA_ATTR_DEPEND, false },
198        { "interactive", PBSDRMAA_ATTR_INTERACTIVE, false },
199        { "stagein", PBSDRMAA_ATTR_STAGEIN, false },
200        { "stageout", PBSDRMAA_ATTR_STAGEOUT, false },
201        { "exec_host", PBSDRMAA_ATTR_EXECUTION_HOST, false },
202        { "Job_Owner", PBSDRMAA_ATTR_JOB_OWNER, false },
203        { "resources_used", PBSDRMAA_ATTR_RESOURCES_USED, false },
204        { "job_state", PBSDRMAA_ATTR_JOB_STATE, false },
205        { "queue", PBSDRMAA_ATTR_QUEUE, false },
206        { "server", PBSDRMAA_ATTR_SERVER, false },
207        { "comment", PBSDRMAA_ATTR_COMMENT, false },
208        { "exit_status", PBSDRMAA_ATTR_EXIT_STATUS, false },
209        { "start_time", PBSDRMAA_ATTR_START_TIME, false },
210        { "x", PBSDRMAA_ATTR_EXTENSION, false },
211        { "submit_args", PBSDRMAA_ATTR_SUBMIT_ARGS, false },
212        { "mtime", PBSDRMAA_ATTR_MTIME, false },
213};
214
215/* vim: set ft=c: */
Note: See TracBrowser for help on using the repository browser.