source: trunk/pbs_drmaa/pbs_attrib.gperf @ 71

Revision 71, 8.1 KB checked in by mmamonski, 7 years ago (diff)

PBS Pro PBSE_HISTJOBID handled properlly

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