source: trunk/pbs_drmaa/submit.c @ 16

Revision 16, 18.5 KB checked in by mmamonski, 13 years ago (diff)

painfull copy/paste bug

  • Property svn:keywords set to Id
Line 
1/* $Id$ */
2/*
3 *  FedStage DRMAA for PBS Pro
4 *  Copyright (C) 2006-2009  FedStage Systems
5 *
6 *  This program is free software: you can redistribute it and/or modify
7 *  it under the terms of the GNU General Public License as published by
8 *  the Free Software Foundation, either version 3 of the License, or
9 *  (at your option) any later version.
10 *
11 *  This program is distributed in the hope that it will be useful,
12 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 *  GNU General Public License for more details.
15 *
16 *  You should have received a copy of the GNU General Public License
17 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifdef HAVE_CONFIG_H
21#       include <config.h>
22#endif
23
24#include <unistd.h>
25#include <string.h>
26
27#include <pbs_ifl.h>
28#include <pbs_error.h>
29
30#include <drmaa_utils/conf.h>
31#include <drmaa_utils/drmaa.h>
32#include <drmaa_utils/drmaa_util.h>
33#include <drmaa_utils/datetime.h>
34#include <drmaa_utils/iter.h>
35#include <drmaa_utils/template.h>
36#include <pbs_drmaa/pbs_attrib.h>
37#include <pbs_drmaa/session.h>
38#include <pbs_drmaa/submit.h>
39#include <pbs_drmaa/util.h>
40
41
42
43#ifndef lint
44static char rcsid[]
45#       ifdef __GNUC__
46                __attribute__ ((unused))
47#       endif
48        = "$Id$";
49#endif
50
51static void
52pbsdrmaa_submit_destroy( pbsdrmaa_submit_t *self );
53
54static char *
55pbsdrmaa_submit_submit( pbsdrmaa_submit_t *self );
56
57static void
58pbsdrmaa_submit_eval( pbsdrmaa_submit_t *self );
59
60
61static void
62pbsdrmaa_submit_set( pbsdrmaa_submit_t *self, const char *pbs_attr,
63                char *value, unsigned placeholders );
64
65static void pbsdrmaa_submit_apply_defaults( pbsdrmaa_submit_t *self );
66static void pbsdrmaa_submit_apply_job_script( pbsdrmaa_submit_t *self );
67static void pbsdrmaa_submit_apply_job_state( pbsdrmaa_submit_t *self );
68static void pbsdrmaa_submit_apply_job_files( pbsdrmaa_submit_t *self );
69static void pbsdrmaa_submit_apply_file_staging( pbsdrmaa_submit_t *self );
70static void pbsdrmaa_submit_apply_job_resources( pbsdrmaa_submit_t *self );
71static void pbsdrmaa_submit_apply_job_environment( pbsdrmaa_submit_t *self );
72static void pbsdrmaa_submit_apply_email_notification( pbsdrmaa_submit_t *self );
73static void pbsdrmaa_submit_apply_job_category( pbsdrmaa_submit_t *self );
74
75
76pbsdrmaa_submit_t *
77pbsdrmaa_submit_new( fsd_drmaa_session_t *session,
78                const fsd_template_t *job_template, int bulk_idx )
79{
80        pbsdrmaa_submit_t *volatile self = NULL;
81        TRY
82         {
83                fsd_malloc( self, pbsdrmaa_submit_t );
84                self->session = session;
85                self->job_template = job_template;
86                self->script_filename = NULL;
87                self->destination_queue = NULL;
88                self->pbs_job_attributes = NULL;
89                self->expand_ph = NULL;
90                self->destroy = pbsdrmaa_submit_destroy;
91                self->submit = pbsdrmaa_submit_submit;
92                self->eval = pbsdrmaa_submit_eval;
93                self->set = pbsdrmaa_submit_set;
94                self->apply_defaults = pbsdrmaa_submit_apply_defaults;
95                self->apply_job_category = pbsdrmaa_submit_apply_job_category;
96                self->apply_job_script = pbsdrmaa_submit_apply_job_script;
97                self->apply_job_state = pbsdrmaa_submit_apply_job_state;
98                self->apply_job_files = pbsdrmaa_submit_apply_job_files;
99                self->apply_file_staging = pbsdrmaa_submit_apply_file_staging;
100                self->apply_job_resources = pbsdrmaa_submit_apply_job_resources;
101                self->apply_job_environment = pbsdrmaa_submit_apply_job_environment;
102                self->apply_email_notification = pbsdrmaa_submit_apply_email_notification;
103                self->apply_native_specification =
104                        pbsdrmaa_submit_apply_native_specification;
105
106                self->pbs_job_attributes = pbsdrmaa_pbs_template_new();
107                self->expand_ph = fsd_expand_drmaa_ph_new( NULL, NULL,
108                                (bulk_idx >= 0) ? fsd_asprintf("%d", bulk_idx) : NULL );
109         }
110        EXCEPT_DEFAULT
111         {
112                if( self )
113                        self->destroy( self );
114         }
115        END_TRY
116        return self;
117}
118
119
120void
121pbsdrmaa_submit_destroy( pbsdrmaa_submit_t *self )
122{
123        if( self->script_filename )
124         {
125                unlink( self->script_filename );
126                fsd_free( self->script_filename );
127         }
128        if( self->pbs_job_attributes )
129                self->pbs_job_attributes->destroy( self->pbs_job_attributes );
130        if( self->expand_ph )
131                self->expand_ph->destroy( self->expand_ph );
132        fsd_free( self->destination_queue );
133        fsd_free( self );
134}
135
136
137char *
138pbsdrmaa_submit_submit( pbsdrmaa_submit_t *self )
139{
140        volatile bool conn_lock = false;
141        struct attrl *volatile pbs_attr = NULL;
142        char *volatile job_id = NULL;
143        TRY
144         {
145                const fsd_template_t *pbs_tmpl = self->pbs_job_attributes;
146                unsigned i;
147
148                for( i = 0;  i < PBSDRMAA_N_PBS_ATTRIBUTES;  i++ )
149                 {
150                        const char *name = pbs_tmpl->by_code( pbs_tmpl, i )->name;
151                        if( name  &&  name[0] != '!' && pbs_tmpl->get_attr( pbs_tmpl, name ) )
152                         {
153                                struct attrl *p;
154                                const char *resource;
155                                const char *value;
156                                value = pbs_tmpl->get_attr( pbs_tmpl, name );
157                                fsd_malloc( p, struct attrl );
158                                memset( p, 0, sizeof(struct attrl) );
159                                p->next = pbs_attr;
160                                pbs_attr = p;
161                                resource = strchr( name, '.' );
162                                if( resource )
163                                 {
164                                        p->name = fsd_strndup( name, resource-name );
165                                        p->resource = fsd_strdup( resource+1 );
166                                 }
167                                else
168                                        p->name = fsd_strdup( name );
169                                fsd_log_debug(("set attr: %s = %s", name, value));
170                                p->value = fsd_strdup( value );
171                                p->op = SET;
172                         }
173                 }
174
175                conn_lock = fsd_mutex_lock( &self->session->drm_connection_mutex );
176retry:
177                job_id = pbs_submit( ((pbsdrmaa_session_t*)self->session)->pbs_conn,
178                                (struct attropl*)pbs_attr, self->script_filename,
179                                self->destination_queue, NULL );
180
181                fsd_log_info(("pbs_submit(%s, %s) =%s", self->script_filename, self->destination_queue, job_id));
182
183                if( job_id == NULL )
184                {
185                        if (pbs_errno == PBSE_PROTOCOL || pbs_errno == PBSE_EXPIRED)
186                         {
187                                pbsdrmaa_session_t *pbsself = (pbsdrmaa_session_t*)self->session;
188                                if (pbsself->pbs_conn >= 0 )
189                                        pbs_disconnect( pbsself->pbs_conn );
190                                sleep(1);
191                                pbsself->pbs_conn = pbs_connect( pbsself->super.contact );
192                                if( pbsself->pbs_conn < 0 )
193                                        pbsdrmaa_exc_raise_pbs( "pbs_connect" );
194                                else
195                                        goto retry;
196                         }
197                        else
198                         {
199                                pbsdrmaa_exc_raise_pbs( "pbs_submit" );
200                         }
201                }
202                conn_lock = fsd_mutex_unlock( &self->session->drm_connection_mutex );
203         }
204        EXCEPT_DEFAULT
205         {
206                fsd_free( job_id );
207                fsd_exc_reraise();
208         }
209        FINALLY
210         {
211                if( conn_lock )
212                        conn_lock = fsd_mutex_unlock( &self->session->drm_connection_mutex );
213                if( pbs_attr )
214                        pbsdrmaa_free_attrl( pbs_attr );
215         }
216        END_TRY
217        return job_id;
218}
219
220
221void
222pbsdrmaa_submit_eval( pbsdrmaa_submit_t *self )
223{
224        self->apply_defaults( self );
225        self->apply_job_category( self );
226        self->apply_job_script( self );
227        self->apply_job_state( self );
228        self->apply_job_files( self );
229        self->apply_file_staging( self );
230        self->apply_job_resources( self );
231        self->apply_job_environment( self );
232        self->apply_email_notification( self );
233        self->apply_native_specification( self, NULL );
234}
235
236
237void
238pbsdrmaa_submit_set( pbsdrmaa_submit_t *self, const char *name,
239                 char *value, unsigned placeholders )
240{
241        fsd_template_t *pbs_attr = self->pbs_job_attributes;
242        TRY
243         {
244                if( placeholders )
245                        value = self->expand_ph->expand(
246                                        self->expand_ph, value, placeholders );
247                pbs_attr->set_attr( pbs_attr, name, value );
248         }
249        FINALLY
250         {
251                fsd_free( value );
252         }
253        END_TRY
254}
255
256
257void
258pbsdrmaa_submit_apply_defaults( pbsdrmaa_submit_t *self )
259{
260        fsd_template_t *pbs_attr = self->pbs_job_attributes;
261        pbs_attr->set_attr( pbs_attr, PBSDRMAA_CHECKPOINT, "u" );
262        pbs_attr->set_attr( pbs_attr, PBSDRMAA_KEEP_FILES, "n" );
263        pbs_attr->set_attr( pbs_attr, PBSDRMAA_PRIORITY, "0" );
264}
265
266
267void
268pbsdrmaa_submit_apply_job_script( pbsdrmaa_submit_t *self )
269{
270        const fsd_template_t *jt = self->job_template;
271        /* fsd_template_t *pbs_attr = self->pbs_job_attributes; */
272        fsd_expand_drmaa_ph_t *expand = self->expand_ph;
273        char *script = NULL;
274        size_t script_len;
275        const char *executable;
276        const char *wd;
277        const char *const *argv;
278        const char *input_path;
279        const char *const *i;
280
281        executable   = jt->get_attr( jt, DRMAA_REMOTE_COMMAND );
282        wd           = jt->get_attr( jt, DRMAA_WD );
283        argv         = jt->get_v_attr( jt, DRMAA_V_ARGV );
284        input_path   = jt->get_attr( jt, DRMAA_INPUT_PATH );
285
286        if( wd )
287         {
288                char *cwd = NULL;
289                cwd = expand->expand( expand, fsd_strdup(wd),
290                                FSD_DRMAA_PH_HD | FSD_DRMAA_PH_INCR );
291                expand->set( expand, FSD_DRMAA_PH_WD, cwd );
292         }
293
294        if( executable == NULL )
295                fsd_exc_raise_code( FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE );
296
297        if( input_path != NULL )
298         {
299                if( input_path[0] == ':' )
300                        input_path++;
301         }
302
303         { /* compute script length */
304                script_len = 0;
305                if( wd != NULL )
306                        script_len += strlen("cd ") + strlen(wd) + strlen("; ");
307                script_len += strlen("exec ") + strlen(executable);
308                if( argv != NULL )
309                        for( i = argv;  *i != NULL;  i++ )
310                                script_len += 3+strlen(*i);
311                if( input_path != NULL )
312                        script_len += strlen(" <") + strlen(input_path);
313         }
314
315        fsd_calloc( script, script_len+1, char );
316
317         {
318                char *s;
319                s = script;
320                if( wd != NULL )
321                        s += sprintf( s, "cd %s; ", wd );
322                s += sprintf( s, "exec %s", executable );
323                if( argv != NULL )
324                        for( i = argv;  *i != NULL;  i++ )
325                                s += sprintf( s, " '%s'", *i );
326                if( input_path != NULL )
327                        s += sprintf( s, " <%s", input_path );
328                fsd_assert( s == script+script_len );
329         }
330
331        script = expand->expand( expand, script,
332                        FSD_DRMAA_PH_HD | FSD_DRMAA_PH_WD | FSD_DRMAA_PH_INCR );
333
334        /* pbs_attr->set_attr( pbs_attr, "!script", script ); */
335
336        self->script_filename = pbsdrmaa_write_tmpfile( script, strlen(script) );
337        fsd_free( script );
338}
339
340
341void
342pbsdrmaa_submit_apply_job_state( pbsdrmaa_submit_t *self )
343{
344        const fsd_template_t *jt = self->job_template;
345        fsd_template_t *pbs_attr = self->pbs_job_attributes;
346        const char *job_name = NULL;
347        const char *submit_state = NULL;
348        const char *drmaa_start_time = NULL;
349
350        job_name = jt->get_attr( jt, DRMAA_JOB_NAME );
351        submit_state = jt->get_attr( jt, DRMAA_JS_STATE );
352        drmaa_start_time = jt->get_attr( jt, DRMAA_START_TIME );
353
354        if( job_name != NULL )
355                pbs_attr->set_attr( pbs_attr, PBSDRMAA_JOB_NAME, job_name );
356
357        if( submit_state != NULL )
358         {
359                const char *hold_types;
360                if( !strcmp(submit_state, DRMAA_SUBMISSION_STATE_ACTIVE) )
361                        hold_types = "n";
362                else if( !strcmp(submit_state, DRMAA_SUBMISSION_STATE_HOLD) )
363                        hold_types = "u";
364                else
365                        fsd_exc_raise_fmt( FSD_ERRNO_INVALID_VALUE,
366                                        "invalid value of %s attribute (%s|%s)",
367                                        DRMAA_JS_STATE, DRMAA_SUBMISSION_STATE_ACTIVE,
368                                        DRMAA_SUBMISSION_STATE_HOLD );
369                pbs_attr->set_attr( pbs_attr, PBSDRMAA_HOLD_TYPES, hold_types );
370         }
371
372        if( drmaa_start_time != NULL )
373         {
374                time_t start_time;
375                char pbs_start_time[20];
376                struct tm start_time_tm;
377                start_time = fsd_datetime_parse( drmaa_start_time );
378                localtime_r( &start_time, &start_time_tm );
379                sprintf( pbs_start_time, "%04d%02d%02d%02d%02d.%02d",
380                                start_time_tm.tm_year + 1900,
381                                start_time_tm.tm_mon + 1,
382                                start_time_tm.tm_mday,
383                                start_time_tm.tm_hour,
384                                start_time_tm.tm_min,
385                                start_time_tm.tm_sec
386                                );
387                pbs_attr->set_attr( pbs_attr, PBSDRMAA_EXECUTION_TIME, pbs_start_time );
388         }
389}
390
391
392void
393pbsdrmaa_submit_apply_job_files( pbsdrmaa_submit_t *self )
394{
395        const fsd_template_t *jt = self->job_template;
396        fsd_template_t *pbs_attr = self->pbs_job_attributes;
397        const char *join_files;
398        bool b_join_files;
399        int i;
400
401        for( i = 0;  i < 2;  i++ )
402         {
403                const char *drmaa_name;
404                const char *pbs_name;
405                const char *path;
406
407                if( i == 0 )
408                 {
409                        drmaa_name = DRMAA_OUTPUT_PATH;
410                        pbs_name = PBSDRMAA_OUTPUT_PATH;
411                 }
412                else
413                 {
414                        drmaa_name = DRMAA_ERROR_PATH;
415                        pbs_name = PBSDRMAA_ERROR_PATH;
416                 }
417
418                path = jt->get_attr( jt, drmaa_name );
419                if( path != NULL )
420                 {
421                        if( path[0] == ':' )
422                                path++;
423                        self->set(self, pbs_name, fsd_strdup(path), FSD_DRMAA_PH_HD | FSD_DRMAA_PH_WD | FSD_DRMAA_PH_INCR);
424                 }
425         }
426
427        join_files = jt->get_attr( jt, DRMAA_JOIN_FILES );
428        b_join_files = join_files != NULL  &&  !strcmp(join_files,"1");
429        pbs_attr->set_attr( pbs_attr, PBSDRMAA_JOIN_FILES, (b_join_files ? "y" : "n") );
430}
431
432
433void
434pbsdrmaa_submit_apply_file_staging( pbsdrmaa_submit_t *self )
435{
436        /* TODO */
437}
438
439
440void
441pbsdrmaa_submit_apply_job_resources( pbsdrmaa_submit_t *self )
442{
443        const fsd_template_t *jt = self->job_template;
444        fsd_template_t *pbs_attr = self->pbs_job_attributes;
445        const char *cpu_time_limit = NULL;
446        const char *walltime_limit = NULL;
447
448        cpu_time_limit = jt->get_attr( jt, DRMAA_DURATION_HLIMIT );
449        walltime_limit = jt->get_attr( jt, DRMAA_WCT_HLIMIT );
450        if( cpu_time_limit )
451         {
452                pbs_attr->set_attr( pbs_attr, "Resource_List.pcput", cpu_time_limit );
453                pbs_attr->set_attr( pbs_attr, "Resource_List.cput", cpu_time_limit );
454         }
455        if( walltime_limit )
456                pbs_attr->set_attr( pbs_attr, "Resource_List.walltime", walltime_limit );
457}
458
459void
460pbsdrmaa_submit_apply_job_environment( pbsdrmaa_submit_t *self )
461{
462        const fsd_template_t *jt = self->job_template;
463        const char *const *env_v;
464
465        env_v = jt->get_v_attr( jt, DRMAA_V_ENV);
466
467        if (env_v)
468        {
469                char *env_c = NULL;
470                int ii = 0, len = 0;
471
472                ii = 0;
473                while (env_v[ii]) {
474                        len += strlen(env_v[ii]) + 1;
475                        ii++;
476                }
477
478                fsd_calloc(env_c, len + 1, char);
479                env_c[0] = '\0';
480
481                ii = 0;
482                while (env_v[ii]) {
483                        strcat(env_c, env_v[ii]);
484                        strcat(env_c, ",");
485                        ii++;
486                }
487
488                env_c[strlen(env_c) -1 ] = '\0'; /*remove the last ',' */
489
490                self->pbs_job_attributes->set_attr(self->pbs_job_attributes, "Variable_List", env_c);
491
492                fsd_free(env_c);
493        }
494}
495
496
497void
498pbsdrmaa_submit_apply_email_notification( pbsdrmaa_submit_t *self )
499{
500        /* TODO */
501}
502
503
504void
505pbsdrmaa_submit_apply_job_category( pbsdrmaa_submit_t *self )
506{
507        const char *job_category = NULL;
508        const char *category_spec = NULL;
509        fsd_conf_option_t *value = NULL;
510
511        job_category = self->job_template->get_attr(
512                        self->job_template, DRMAA_JOB_CATEGORY );
513        if( job_category == NULL  ||  job_category[0] == '\0' )
514                job_category = "default";
515        value = fsd_conf_dict_get( self->session->job_categories,
516                        job_category );
517        if( value != NULL  &&  value->type == FSD_CONF_STRING )
518                category_spec = value->val.string;
519        if( category_spec != NULL )
520                self->apply_native_specification( self, category_spec );
521}
522
523static void parse_resources(fsd_template_t *pbs_attr,const char *resources)
524{
525        char * volatile name = NULL;
526        char *arg = NULL;
527        char *value = NULL;
528        char *ctxt = NULL;
529        char * volatile resources_copy = fsd_strdup(resources);
530
531        TRY
532          {
533                for (arg = strtok_r(resources_copy, ",", &ctxt); arg; arg = strtok_r(NULL, ",",&ctxt) )
534                {
535                        char *psep = strchr(arg, '=');
536
537                        if (psep)
538                        {
539                                *psep = '\0';
540                                name = fsd_asprintf("Resource_List.%s", arg);
541                                value = ++psep;
542                                pbs_attr->set_attr( pbs_attr, name , value );
543                                fsd_free(name);
544                                name = NULL;
545                        }
546                        else
547                        {
548                                fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE, "Invalid native specification: %s (Invalid resource specification: %s)", resources, arg);
549                        }
550                }
551          }
552        FINALLY
553          {
554                fsd_free(name);
555                fsd_free(resources_copy);
556          }
557        END_TRY
558}
559
560static void parse_additional_attr(fsd_template_t *pbs_attr,const char *add_attr)
561{
562        char * volatile name = NULL;
563        char *arg = NULL;
564        char *value = NULL;
565        char *ctxt = NULL, *ctxt2 = NULL;
566        char * volatile add_attr_copy = fsd_strdup(add_attr);
567
568        TRY
569          {
570                for (arg = strtok_r(add_attr_copy, ";", &ctxt); arg; arg = strtok_r(NULL, ";",&ctxt) )
571                {
572                        name = fsd_strdup(strtok_r(arg, "=", &ctxt2));
573                        value = strtok_r(NULL, "=", &ctxt2);
574                        pbs_attr->set_attr( pbs_attr, name , value );
575                        fsd_free(name);
576                        name = NULL;
577                }
578          }
579        FINALLY
580          {
581                fsd_free(name);
582                fsd_free(add_attr_copy);
583          }
584        END_TRY
585}
586
587
588void
589pbsdrmaa_submit_apply_native_specification( pbsdrmaa_submit_t *self,
590                const char *native_specification )
591{
592        fsd_log_enter(( "({native_specification=%s})", native_specification ));
593
594        if( native_specification == NULL )
595                native_specification = self->job_template->get_attr(
596                                self->job_template, DRMAA_NATIVE_SPECIFICATION );
597        if( native_specification == NULL )
598                return;
599
600        {
601                fsd_iter_t * volatile args_list = fsd_iter_new(NULL, 0);
602                fsd_template_t *pbs_attr = self->pbs_job_attributes;
603                char *arg = NULL;
604                volatile char * native_spec_copy = fsd_strdup(native_specification);
605                char * ctxt = NULL;
606                int opt = 0;
607
608                TRY
609                  {
610                        for (arg = strtok_r(native_spec_copy, " \t", &ctxt); arg; arg = strtok_r(NULL, " \t",&ctxt) ) {
611                                if (!opt)
612                                  {
613                                        if ( (arg[0] != '-') || (strlen(arg) != 2) )
614                                                fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
615                                                        "Invalid native specification: -o(ption) expected (arg=%s native=%s).",
616                                                        arg, native_specification);
617
618                                        opt = arg[1];
619
620                                        /* handle NO-arg options */
621
622                                        switch (opt) {
623                                                case 'h' :
624                                                        pbs_attr->set_attr( pbs_attr, "Hold_Types" , "u" );
625                                                        break;
626                                                default :
627                                                        continue; /*no NO-ARG option */
628                                        }
629
630                                        opt = 0;
631                                  }
632                                else
633                                  {
634                                        switch (opt) {
635                                               
636                                                case 'W' :
637                                                        parse_additional_attr(pbs_attr, arg);
638                                                        break;
639                                                case 'N' :
640                                                        pbs_attr->set_attr( pbs_attr, "Job_Name" , arg );
641                                                        break;
642                                                case 'o' :
643                                                        pbs_attr->set_attr( pbs_attr, "Output_Path" , arg );
644                                                        break;
645                                                case 'e' :
646                                                        pbs_attr->set_attr( pbs_attr, "Error_Path" , arg );
647                                                        break;
648                                                case 'j' :
649                                                        pbs_attr->set_attr( pbs_attr, "Join_Path" , arg );
650                                                        break;
651                                                case 'm' :
652                                                        pbs_attr->set_attr( pbs_attr, "Mail_Points" , arg );
653                                                        break;
654                                                case 'a' :
655                                                        pbs_attr->set_attr( pbs_attr, "Execution_Time" , arg );
656                                                        break;
657                                                case 'A' :
658                                                        pbs_attr->set_attr( pbs_attr, "Account_Name" , arg );
659                                                        break;
660                                                case 'c' :
661                                                        pbs_attr->set_attr( pbs_attr, "Checkpoint" , arg );
662                                                        break;
663                                                case 'k' :
664                                                        pbs_attr->set_attr( pbs_attr, "Keep_Files" , arg );
665                                                        break;
666                                                case 'p' :
667                                                        pbs_attr->set_attr( pbs_attr, "Priority" , arg );
668                                                        break;
669                                                case 'q' :
670                                                        self->destination_queue = fsd_strdup( arg );
671                                                        fsd_log_debug(("self->destination_queue = %s", self->destination_queue));
672                                                        break;
673                                                case 'r' :
674                                                        pbs_attr->set_attr( pbs_attr, "Rerunable" , arg );
675                                                        break;
676                                                case 'S' :
677                                                        pbs_attr->set_attr( pbs_attr, "Shell_Path_List" , arg );
678                                                        break;
679                                                case 'u' :
680                                                        pbs_attr->set_attr( pbs_attr, "User_List" , arg );
681                                                        break;
682                                                case 'v' :
683                                                        pbs_attr->set_attr( pbs_attr, "Variable_List" , arg );
684                                                        break;
685                                                case 'M' :
686                                                        pbs_attr->set_attr( pbs_attr, "Mail_Users" , arg );
687                                                        break;
688                                                case 'l' :
689                                                        parse_resources(pbs_attr, arg);
690                                                        break;                                                 
691                                                default :
692                                                       
693                                                        fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
694                                                                        "Invalid native specification: %s (Unsupported option: -%c)",
695                                                                        native_specification, opt);
696                                        }
697                                        opt = 0;
698                                }
699                        }
700
701                        if (opt) /* option without optarg */
702                                fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
703                                                "Invalid native specification: %s",
704                                                native_specification);
705
706                 }
707                FINALLY
708                 {
709#ifndef PBS_PROFESSIONAL
710                        pbs_attr->set_attr( pbs_attr, "submit_args", native_specification);
711#endif
712                        args_list->destroy(args_list);
713                        fsd_free(native_spec_copy);
714                 }
715                END_TRY
716        }
717}
718
Note: See TracBrowser for help on using the repository browser.