source: trunk/pbs_drmaa/pbs_attrib.gperf @ 42

Revision 42, 7.8 KB checked in by mmamonski, 10 years ago (diff)

procs support

  • Property svn:keywords set to Id
Line 
1%{
2/* $Id$ */
3/*
4 *  FedStage DRMAA for PBS Pro
5 *  Copyright (C) 2006-2009  FedStage Systems
6 *  Copyright (C) 2011 Poznan Supercomputing and Networking Center
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$";
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.mem, t(PBSDRMAA_ATTR_MEM_LIMIT)
63Resource_List.pcput, t(PBSDRMAA_ATTR_SINGLE_CPU_TIME_LIMIT)
64Resource_List.pmem, t(PBSDRMAA_ATTR_SINGLE_RSS_LIMIT)
65Resource_List.pvmem, t(PBSDRMAA_ATTR_SINGLE_VMEM_LIMIT)
66Resource_List.walltime, t(PBSDRMAA_ATTR_WALLTIME_LIMIT)
67Resource_List.arch, t(PBSDRMAA_ATTR_ARCHITECTURE)
68Resource_List.host, t(PBSDRMAA_ATTR_HOST)
69Resource_List.nodes, t(PBSDRMAA_ATTR_NODES)
70Resource_List.software, t(PBSDRMAA_ATTR_SOFTWARE)
71Resource_List.procs, t(PBSDRMAA_ATTR_PROCS)
72Mail_Points, t(PBSDRMAA_ATTR_MAIL_POINTS)
73Output_Path, t(PBSDRMAA_ATTR_OUTPUT_PATH)
74Priority, t(PBSDRMAA_ATTR_PRIORITY)
75destination, t(PBSDRMAA_ATTR_DESITINATION)
76Rerunable, t(PBSDRMAA_ATTR_RERUNABLE)
77job_array_request, t(PBSDRMAA_ATTR_BULK_REQ)
78job_array_id, t(PBSDRMAA_ATTR_BULK_IDX)
79User_List, t(PBSDRMAA_ATTR_USERS)
80Variable_List, t(PBSDRMAA_ATTR_JOB_ENVIRONMENT)
81Account_Name, t(PBSDRMAA_ATTR_ACCOUNT_NAME)
82Mail_Users, t(PBSDRMAA_ATTR_EMAIL)
83Job_Name, t(PBSDRMAA_ATTR_JOB_NAME)
84Shell_Path_List, t(PBSDRMAA_ATTR_SHELL)
85depend, t(PBSDRMAA_ATTR_DEPEND)
86interactive, t(PBSDRMAA_ATTR_INTERACTIVE)
87stagein, t(PBSDRMAA_ATTR_STAGEIN)
88stageout, t(PBSDRMAA_ATTR_STAGEOUT)
89# additional job and general attribute names
90exec_host, t(PBSDRMAA_ATTR_EXECUTION_HOST)
91exec_vnode, t(PBSDRMAA_ATTR_EXECUTION_VNODE)
92Job_Owner, t(PBSDRMAA_ATTR_JOB_OWNER)
93resources_used, t(PBSDRMAA_ATTR_RESOURCES_USED)
94job_state, t(PBSDRMAA_ATTR_JOB_STATE)
95queue, t(PBSDRMAA_ATTR_QUEUE)
96server, t(PBSDRMAA_ATTR_SERVER)
97comment, t(PBSDRMAA_ATTR_COMMENT)
98exit_status, t(PBSDRMAA_ATTR_EXIT_STATUS)
99start_time, t(PBSDRMAA_ATTR_START_TIME)
100x, t(PBSDRMAA_ATTR_EXTENSION)
101submit_args, t(PBSDRMAA_ATTR_SUBMIT_ARGS)
102mtime, t(PBSDRMAA_ATTR_MTIME)
103# reservation attributes:
104# reserve_start,       t(PBSDRMAA_ATTR_RESERVATION_START)
105# reserve_end,         t(PBSDRMAA_ATTR_RESERVATION_END)
106# reserve_duration,    t(PBSDRMAA_ATTR_RESERVATION_DURATION)
107# reserve_state,       t(PBSDRMAA_ATTR_RESERVATION_STATE)
108# reserve_substate,    t(PBSDRMAA_ATTR_RESERVATION_SUBSTATE)
109%%
110#undef t
111
112int
113pbsdrmaa_pbs_attrib_by_name( const char *name )
114{
115        const struct pbs_attrib *found;
116        found = pbsdrmaa_pbs_attrib_lookup( name, strlen(name) );
117        if( found )
118                return found->attr->code;
119        else
120                return -1;
121}
122
123static const fsd_attribute_t *
124pbsdrmaa_pbs_template_by_name( const fsd_template_t *self, const char *name )
125{
126        const struct pbs_attrib *found;
127        found = pbsdrmaa_pbs_attrib_lookup( name, strlen(name) );
128        if( found != NULL )
129         {
130                fsd_assert( found->attr - pbsdrmaa_pbs_attributes == found->attr->code );
131                return found->attr;
132         }
133        else
134                fsd_exc_raise_fmt(
135                                FSD_ERRNO_INVALID_ARGUMENT,
136                                "invalid PBS attribute name: %s", name
137                                );
138}
139
140
141static const fsd_attribute_t *
142pbsdrmaa_pbs_template_by_code( const fsd_template_t *self, int code )
143{
144        if( 0 <= code  &&  code < PBSDRMAA_N_PBS_ATTRIBUTES )
145         {
146                fsd_assert( pbsdrmaa_pbs_attributes[code].code == code );
147                return & pbsdrmaa_pbs_attributes[ code ];
148         }
149        else
150                fsd_exc_raise_fmt(
151                                FSD_ERRNO_INVALID_ARGUMENT,
152                                "invalid PBS attribute code: %d", code
153                                );
154}
155
156
157fsd_template_t *
158pbsdrmaa_pbs_template_new(void)
159{
160        return fsd_template_new(
161                        pbsdrmaa_pbs_template_by_name,
162                        pbsdrmaa_pbs_template_by_code,
163                        PBSDRMAA_N_PBS_ATTRIBUTES
164                        );
165}
166
167const fsd_attribute_t pbsdrmaa_pbs_attributes[ PBSDRMAA_N_PBS_ATTRIBUTES ] = {
168        { "Execution_Time", PBSDRMAA_ATTR_EXECUTION_TIME, false },
169        { "Checkpoint", PBSDRMAA_ATTR_CHECKPOINT, false },
170        { "Error_Path", PBSDRMAA_ATTR_ERROR_PATH, false },
171        { "group_list", PBSDRMAA_ATTR_GROUPS, false },
172        { "Hold_Types", PBSDRMAA_ATTR_HOLD_TYPES, false },
173        { "Join_Path", PBSDRMAA_ATTR_JOIN_FILES, false },
174        { "Keep_Files", PBSDRMAA_ATTR_KEEP_FILES, false },
175        { "Resource_List.cput", PBSDRMAA_ATTR_CPU_TIME_LIMIT, false },
176        { "Resource_List.file", PBSDRMAA_ATTR_FILE_SIZE_LIMIT, false },
177        { "Resource_List.nice", PBSDRMAA_ATTR_NICE, false },
178        { "Resource_List.vmem", PBSDRMAA_ATTR_VMEM_LIMIT, false },
179        { "Resource_List.mem", PBSDRMAA_ATTR_MEM_LIMIT, false },
180        { "Resource_List.pcput", PBSDRMAA_ATTR_SINGLE_CPU_TIME_LIMIT, false },
181        { "Resource_List.pmem", PBSDRMAA_ATTR_SINGLE_RSS_LIMIT, false },
182        { "Resource_List.pvmem", PBSDRMAA_ATTR_SINGLE_VMEM_LIMIT, false },
183        { "Resource_List.walltime", PBSDRMAA_ATTR_WALLTIME_LIMIT, false },
184        { "Resource_List.arch", PBSDRMAA_ATTR_ARCHITECTURE, false },
185        { "Resource_List.host", PBSDRMAA_ATTR_HOST, false },
186        { "Resource_List.nodes", PBSDRMAA_ATTR_NODES, false },
187        { "Resource_List.software", PBSDRMAA_ATTR_SOFTWARE, false },
188        { "Resource_List.procs", PBSDRMAA_ATTR_PROCS, false },
189        { "Mail_Points", PBSDRMAA_ATTR_MAIL_POINTS, false },
190        { "Output_Path", PBSDRMAA_ATTR_OUTPUT_PATH, false },
191        { "Priority", PBSDRMAA_ATTR_PRIORITY, false },
192        { "destination", PBSDRMAA_ATTR_DESITINATION, false },
193        { "Rerunable", PBSDRMAA_ATTR_RERUNABLE, false },
194        { "job_array_request", PBSDRMAA_ATTR_BULK_REQ, false },
195        { "job_array_id", PBSDRMAA_ATTR_BULK_IDX, false },
196        { "User_List", PBSDRMAA_ATTR_USERS, false },
197        { "Variable_List", PBSDRMAA_ATTR_JOB_ENVIRONMENT, false },
198        { "Account_Name", PBSDRMAA_ATTR_ACCOUNT_NAME, false },
199        { "Mail_Users", PBSDRMAA_ATTR_EMAIL, false },
200        { "Job_Name", PBSDRMAA_ATTR_JOB_NAME, false },
201        { "Shell_Path_List", PBSDRMAA_ATTR_SHELL, false },
202        { "depend", PBSDRMAA_ATTR_DEPEND, false },
203        { "interactive", PBSDRMAA_ATTR_INTERACTIVE, false },
204        { "stagein", PBSDRMAA_ATTR_STAGEIN, false },
205        { "stageout", PBSDRMAA_ATTR_STAGEOUT, false },
206        { "exec_host", PBSDRMAA_ATTR_EXECUTION_HOST, false },
207        { "exec_vnode", PBSDRMAA_ATTR_EXECUTION_VNODE, false },
208        { "Job_Owner", PBSDRMAA_ATTR_JOB_OWNER, false },
209        { "resources_used", PBSDRMAA_ATTR_RESOURCES_USED, false },
210        { "job_state", PBSDRMAA_ATTR_JOB_STATE, false },
211        { "queue", PBSDRMAA_ATTR_QUEUE, false },
212        { "server", PBSDRMAA_ATTR_SERVER, false },
213        { "comment", PBSDRMAA_ATTR_COMMENT, false },
214        { "exit_status", PBSDRMAA_ATTR_EXIT_STATUS, false },
215        { "start_time", PBSDRMAA_ATTR_START_TIME, false },
216        { "x", PBSDRMAA_ATTR_EXTENSION, false },
217        { "submit_args", PBSDRMAA_ATTR_SUBMIT_ARGS, false },
218        { "mtime", PBSDRMAA_ATTR_MTIME, false },
219};
220
221/* vim: set ft=c: */
Note: See TracBrowser for help on using the repository browser.