source: trunk/pbs_drmaa/submit.c @ 45

Revision 45, 18.6 KB checked in by mmamonski, 12 years ago (diff)

version 1.0.11 - ready to try

  • 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                int tries_left = ((pbsdrmaa_session_t *)self->session)->max_retries_count;
148                int sleep_time = 1;
149
150                for( i = 0;  i < PBSDRMAA_N_PBS_ATTRIBUTES;  i++ )
151                 {
152                        const char *name = pbs_tmpl->by_code( pbs_tmpl, i )->name;
153                        if( name  &&  name[0] != '!' && pbs_tmpl->get_attr( pbs_tmpl, name ) )
154                         {
155                                const char *value;
156
157                                value = pbs_tmpl->get_attr( pbs_tmpl, name );
158                                pbs_attr = pbsdrmaa_add_attr( pbs_attr, name, value );
159                         }
160                 }
161
162                conn_lock = fsd_mutex_lock( &self->session->drm_connection_mutex );
163retry:
164                job_id = pbs_submit( ((pbsdrmaa_session_t*)self->session)->pbs_conn,
165                                (struct attropl*)pbs_attr, self->script_filename,
166                                self->destination_queue, NULL );
167
168                fsd_log_info(("pbs_submit(%s, %s) =%s", self->script_filename, self->destination_queue, job_id));
169
170                if( job_id == NULL )
171                {
172                        if (pbs_errno == PBSE_PROTOCOL || pbs_errno == PBSE_EXPIRED)
173                         {
174                                pbsdrmaa_session_t *pbsself = (pbsdrmaa_session_t*)self->session;
175                                if (pbsself->pbs_conn >= 0 )
176                                        pbs_disconnect( pbsself->pbs_conn );
177retry_connect:
178                                sleep(sleep_time++);
179                                pbsself->pbs_conn = pbs_connect( pbsself->super.contact );
180                                if( pbsself->pbs_conn < 0)
181                                        if (tries_left--)
182                                                goto retry_connect;
183                                        else
184                                                pbsdrmaa_exc_raise_pbs( "pbs_connect" );
185                                else
186                                        goto retry;
187                         }
188                        else
189                         {
190                                pbsdrmaa_exc_raise_pbs( "pbs_submit" );
191                         }
192                }
193                conn_lock = fsd_mutex_unlock( &self->session->drm_connection_mutex );
194         }
195        EXCEPT_DEFAULT
196         {
197                fsd_free( job_id );
198                fsd_exc_reraise();
199         }
200        FINALLY
201         {
202                if( conn_lock )
203                        conn_lock = fsd_mutex_unlock( &self->session->drm_connection_mutex );
204                if( pbs_attr )
205                        pbsdrmaa_free_attrl( pbs_attr );
206         }
207        END_TRY
208        return job_id;
209}
210
211
212void
213pbsdrmaa_submit_eval( pbsdrmaa_submit_t *self )
214{
215        self->apply_defaults( self );
216        self->apply_job_category( self );
217        self->apply_job_script( self );
218        self->apply_job_state( self );
219        self->apply_job_files( self );
220        self->apply_file_staging( self );
221        self->apply_job_resources( self );
222        self->apply_job_environment( self );
223        self->apply_email_notification( self );
224        self->apply_native_specification( self, NULL );
225}
226
227
228void
229pbsdrmaa_submit_set( pbsdrmaa_submit_t *self, const char *name,
230                 char *value, unsigned placeholders )
231{
232        fsd_template_t *pbs_attr = self->pbs_job_attributes;
233        TRY
234         {
235                if( placeholders )
236                        value = self->expand_ph->expand(
237                                        self->expand_ph, value, placeholders );
238                pbs_attr->set_attr( pbs_attr, name, value );
239         }
240        FINALLY
241         {
242                fsd_free( value );
243         }
244        END_TRY
245}
246
247
248void
249pbsdrmaa_submit_apply_defaults( pbsdrmaa_submit_t *self )
250{
251        fsd_template_t *pbs_attr = self->pbs_job_attributes;
252        pbs_attr->set_attr( pbs_attr, PBSDRMAA_CHECKPOINT, "u" );
253        pbs_attr->set_attr( pbs_attr, PBSDRMAA_KEEP_FILES, "n" );
254        pbs_attr->set_attr( pbs_attr, PBSDRMAA_PRIORITY, "0" );
255}
256
257
258void
259pbsdrmaa_submit_apply_job_script( pbsdrmaa_submit_t *self )
260{
261        const fsd_template_t *jt = self->job_template;
262        /* fsd_template_t *pbs_attr = self->pbs_job_attributes; */
263        fsd_expand_drmaa_ph_t *expand = self->expand_ph;
264        char *script = NULL;
265        size_t script_len;
266        const char *executable;
267        const char *wd;
268        const char *const *argv;
269        const char *input_path;
270        const char *const *i;
271
272        executable   = jt->get_attr( jt, DRMAA_REMOTE_COMMAND );
273        wd           = jt->get_attr( jt, DRMAA_WD );
274        argv         = jt->get_v_attr( jt, DRMAA_V_ARGV );
275        input_path   = jt->get_attr( jt, DRMAA_INPUT_PATH );
276
277        if( wd )
278         {
279                char *cwd = NULL;
280                cwd = expand->expand( expand, fsd_strdup(wd),
281                                FSD_DRMAA_PH_HD | FSD_DRMAA_PH_INCR );
282                expand->set( expand, FSD_DRMAA_PH_WD, cwd );
283         }
284
285        if( executable == NULL )
286                fsd_exc_raise_code( FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE );
287
288        if( input_path != NULL )
289         {
290                if( input_path[0] == ':' )
291                        input_path++;
292         }
293
294         { /* compute script length */
295                script_len = 0;
296                if( wd != NULL )
297                        script_len += strlen("cd ") + strlen(wd) + strlen("; ");
298                script_len += strlen("exec ") + strlen(executable);
299                if( argv != NULL )
300                        for( i = argv;  *i != NULL;  i++ )
301                                script_len += 3+strlen(*i);
302                if( input_path != NULL )
303                        script_len += strlen(" <") + strlen(input_path);
304         }
305
306        fsd_calloc( script, script_len+1, char );
307
308         {
309                char *s;
310                s = script;
311                if( wd != NULL )
312                        s += sprintf( s, "cd %s; ", wd );
313                s += sprintf( s, "exec %s", executable );
314                if( argv != NULL )
315                        for( i = argv;  *i != NULL;  i++ )
316                                s += sprintf( s, " '%s'", *i );
317                if( input_path != NULL )
318                        s += sprintf( s, " <%s", input_path );
319                fsd_assert( s == script+script_len );
320         }
321
322        script = expand->expand( expand, script,
323                        FSD_DRMAA_PH_HD | FSD_DRMAA_PH_WD | FSD_DRMAA_PH_INCR );
324
325        /* pbs_attr->set_attr( pbs_attr, "!script", script ); */
326
327        self->script_filename = pbsdrmaa_write_tmpfile( script, strlen(script) );
328        fsd_free( script );
329}
330
331
332void
333pbsdrmaa_submit_apply_job_state( pbsdrmaa_submit_t *self )
334{
335        const fsd_template_t *jt = self->job_template;
336        fsd_template_t *pbs_attr = self->pbs_job_attributes;
337        const char *job_name = NULL;
338        const char *submit_state = NULL;
339        const char *drmaa_start_time = NULL;
340
341        job_name = jt->get_attr( jt, DRMAA_JOB_NAME );
342        submit_state = jt->get_attr( jt, DRMAA_JS_STATE );
343        drmaa_start_time = jt->get_attr( jt, DRMAA_START_TIME );
344
345        if( job_name != NULL )
346                pbs_attr->set_attr( pbs_attr, PBSDRMAA_JOB_NAME, job_name );
347
348        if( submit_state != NULL )
349         {
350                const char *hold_types;
351                if( !strcmp(submit_state, DRMAA_SUBMISSION_STATE_ACTIVE) )
352                        hold_types = "n";
353                else if( !strcmp(submit_state, DRMAA_SUBMISSION_STATE_HOLD) )
354                        hold_types = "u";
355                else
356                        fsd_exc_raise_fmt( FSD_ERRNO_INVALID_VALUE,
357                                        "invalid value of %s attribute (%s|%s)",
358                                        DRMAA_JS_STATE, DRMAA_SUBMISSION_STATE_ACTIVE,
359                                        DRMAA_SUBMISSION_STATE_HOLD );
360                pbs_attr->set_attr( pbs_attr, PBSDRMAA_HOLD_TYPES, hold_types );
361         }
362
363        if( drmaa_start_time != NULL )
364         {
365                time_t start_time;
366                char pbs_start_time[20];
367                struct tm start_time_tm;
368                start_time = fsd_datetime_parse( drmaa_start_time );
369                localtime_r( &start_time, &start_time_tm );
370                sprintf( pbs_start_time, "%04d%02d%02d%02d%02d.%02d",
371                                start_time_tm.tm_year + 1900,
372                                start_time_tm.tm_mon + 1,
373                                start_time_tm.tm_mday,
374                                start_time_tm.tm_hour,
375                                start_time_tm.tm_min,
376                                start_time_tm.tm_sec
377                                );
378                pbs_attr->set_attr( pbs_attr, PBSDRMAA_EXECUTION_TIME, pbs_start_time );
379         }
380}
381
382
383void
384pbsdrmaa_submit_apply_job_files( pbsdrmaa_submit_t *self )
385{
386        const fsd_template_t *jt = self->job_template;
387        fsd_template_t *pbs_attr = self->pbs_job_attributes;
388        const char *join_files;
389        bool b_join_files;
390        int i;
391
392        for( i = 0;  i < 2;  i++ )
393         {
394                const char *drmaa_name;
395                const char *pbs_name;
396                const char *path;
397
398                if( i == 0 )
399                 {
400                        drmaa_name = DRMAA_OUTPUT_PATH;
401                        pbs_name = PBSDRMAA_OUTPUT_PATH;
402                 }
403                else
404                 {
405                        drmaa_name = DRMAA_ERROR_PATH;
406                        pbs_name = PBSDRMAA_ERROR_PATH;
407                 }
408
409                path = jt->get_attr( jt, drmaa_name );
410                if( path != NULL )
411                 {
412                        if( path[0] == ':' )
413                                path++;
414                        self->set(self, pbs_name, fsd_strdup(path), FSD_DRMAA_PH_HD | FSD_DRMAA_PH_WD | FSD_DRMAA_PH_INCR);
415                 }
416         }
417
418        join_files = jt->get_attr( jt, DRMAA_JOIN_FILES );
419        b_join_files = join_files != NULL  &&  !strcmp(join_files,"1");
420        pbs_attr->set_attr( pbs_attr, PBSDRMAA_JOIN_FILES, (b_join_files ? "y" : "n") );
421}
422
423
424void
425pbsdrmaa_submit_apply_file_staging( pbsdrmaa_submit_t *self )
426{
427        /* TODO */
428}
429
430
431void
432pbsdrmaa_submit_apply_job_resources( pbsdrmaa_submit_t *self )
433{
434        const fsd_template_t *jt = self->job_template;
435        fsd_template_t *pbs_attr = self->pbs_job_attributes;
436        const char *cpu_time_limit = NULL;
437        const char *walltime_limit = NULL;
438
439        cpu_time_limit = jt->get_attr( jt, DRMAA_DURATION_HLIMIT );
440        walltime_limit = jt->get_attr( jt, DRMAA_WCT_HLIMIT );
441        if( cpu_time_limit )
442         {
443                pbs_attr->set_attr( pbs_attr, "Resource_List.pcput", cpu_time_limit );
444                pbs_attr->set_attr( pbs_attr, "Resource_List.cput", cpu_time_limit );
445         }
446        if( walltime_limit )
447                pbs_attr->set_attr( pbs_attr, "Resource_List.walltime", walltime_limit );
448}
449
450void
451pbsdrmaa_submit_apply_job_environment( pbsdrmaa_submit_t *self )
452{
453        const fsd_template_t *jt = self->job_template;
454        const char *const *env_v;
455        const char *jt_wd;
456        char *wd;
457        char *env_c = NULL;
458        int ii = 0, len = 0;
459
460        env_v = jt->get_v_attr( jt, DRMAA_V_ENV);
461        jt_wd    = jt->get_attr( jt, DRMAA_WD );
462       
463        if (!jt_wd)
464        {
465                wd = fsd_getcwd();
466        }
467        else
468        {
469                wd = fsd_strdup(jt_wd);
470        }
471
472        if (env_v)
473        {
474                ii = 0;
475                while (env_v[ii]) {
476                        len += strlen(env_v[ii]) + 1;
477                        ii++;
478                }
479        }
480       
481        len+= strlen("PBS_O_WORKDIR=") + strlen(wd);
482
483        fsd_calloc(env_c, len + 1, char);
484        env_c[0] = '\0';
485
486        if (env_v)
487        {
488                ii = 0;
489                while (env_v[ii]) {
490                        strcat(env_c, env_v[ii]);
491                        strcat(env_c, ",");
492                        ii++;
493                }
494
495        }
496       
497        strcat(env_c, "PBS_O_WORKDIR=");
498        strcat(env_c, wd);
499
500        self->pbs_job_attributes->set_attr(self->pbs_job_attributes, "Variable_List", env_c);
501
502        fsd_free(env_c);
503        fsd_free(wd);
504}
505
506
507void
508pbsdrmaa_submit_apply_email_notification( pbsdrmaa_submit_t *self )
509{
510        /* TODO */
511}
512
513
514void
515pbsdrmaa_submit_apply_job_category( pbsdrmaa_submit_t *self )
516{
517        const char *job_category = NULL;
518        const char *category_spec = NULL;
519        fsd_conf_option_t *value = NULL;
520
521        job_category = self->job_template->get_attr(
522                        self->job_template, DRMAA_JOB_CATEGORY );
523        if( job_category == NULL  ||  job_category[0] == '\0' )
524                job_category = "default";
525        value = fsd_conf_dict_get( self->session->job_categories,
526                        job_category );
527        if( value != NULL  &&  value->type == FSD_CONF_STRING )
528                category_spec = value->val.string;
529        if( category_spec != NULL )
530                self->apply_native_specification( self, category_spec );
531}
532
533static void parse_resources(fsd_template_t *pbs_attr,const char *resources)
534{
535        char * volatile name = NULL;
536        char *arg = NULL;
537        char *value = NULL;
538        char *ctxt = NULL;
539        char * volatile resources_copy = fsd_strdup(resources);
540
541        TRY
542          {
543                for (arg = strtok_r(resources_copy, ",", &ctxt); arg; arg = strtok_r(NULL, ",",&ctxt) )
544                {
545                        char *psep = strchr(arg, '=');
546
547                        if (psep)
548                        {
549                                *psep = '\0';
550                                name = fsd_asprintf("Resource_List.%s", arg);
551                                value = ++psep;
552                                pbs_attr->set_attr( pbs_attr, name , value );
553                                fsd_free(name);
554                                name = NULL;
555                        }
556                        else
557                        {
558                                fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE, "Invalid native specification: %s (Invalid resource specification: %s)", resources, arg);
559                        }
560                }
561          }
562        FINALLY
563          {
564                fsd_free(name);
565                fsd_free(resources_copy);
566          }
567        END_TRY
568}
569
570static void parse_additional_attr(fsd_template_t *pbs_attr,const char *add_attr)
571{
572        char * volatile name = NULL;
573        char *arg = NULL;
574        char *value = NULL;
575        char *ctxt = NULL, *ctxt2 = NULL;
576        char * volatile add_attr_copy = fsd_strdup(add_attr);
577
578        TRY
579          {
580                for (arg = strtok_r(add_attr_copy, ";", &ctxt); arg; arg = strtok_r(NULL, ";",&ctxt) )
581                {
582                        name = fsd_strdup(strtok_r(arg, "=", &ctxt2));
583                        value = strtok_r(NULL, "=", &ctxt2);
584                        pbs_attr->set_attr( pbs_attr, name , value );
585                        fsd_free(name);
586                        name = NULL;
587                }
588          }
589        FINALLY
590          {
591                fsd_free(name);
592                fsd_free(add_attr_copy);
593          }
594        END_TRY
595}
596
597
598void
599pbsdrmaa_submit_apply_native_specification( pbsdrmaa_submit_t *self,
600                const char *native_specification )
601{
602        fsd_log_enter(( "({native_specification=%s})", native_specification ));
603
604        if( native_specification == NULL )
605                native_specification = self->job_template->get_attr(
606                                self->job_template, DRMAA_NATIVE_SPECIFICATION );
607        if( native_specification == NULL )
608                return;
609
610        {
611                fsd_iter_t * volatile args_list = fsd_iter_new(NULL, 0);
612                fsd_template_t *pbs_attr = self->pbs_job_attributes;
613                char *arg = NULL;
614                volatile char * native_spec_copy = fsd_strdup(native_specification);
615                char * ctxt = NULL;
616                int opt = 0;
617
618                TRY
619                  {
620                        for (arg = strtok_r((char *)native_spec_copy, " \t", &ctxt); arg; arg = strtok_r(NULL, " \t",&ctxt) ) {
621                                if (!opt)
622                                  {
623                                        if ( (arg[0] != '-') || (strlen(arg) != 2) )
624                                                fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
625                                                        "Invalid native specification: -o(ption) expected (arg=%s native=%s).",
626                                                        arg, native_specification);
627
628                                        opt = arg[1];
629
630                                        /* handle NO-arg options */
631
632                                        switch (opt) {
633                                                case 'h' :
634                                                        pbs_attr->set_attr( pbs_attr, "Hold_Types" , "u" );
635                                                        break;
636                                                default :
637                                                        continue; /*no NO-ARG option */
638                                        }
639
640                                        opt = 0;
641                                  }
642                                else
643                                  {
644                                        switch (opt) {
645                                               
646                                                case 'W' :
647                                                        parse_additional_attr(pbs_attr, arg);
648                                                        break;
649                                                case 'N' :
650                                                        pbs_attr->set_attr( pbs_attr, "Job_Name" , arg );
651                                                        break;
652                                                case 'o' :
653                                                        pbs_attr->set_attr( pbs_attr, "Output_Path" , arg );
654                                                        break;
655                                                case 'e' :
656                                                        pbs_attr->set_attr( pbs_attr, "Error_Path" , arg );
657                                                        break;
658                                                case 'j' :
659                                                        pbs_attr->set_attr( pbs_attr, "Join_Path" , arg );
660                                                        break;
661                                                case 'm' :
662                                                        pbs_attr->set_attr( pbs_attr, "Mail_Points" , arg );
663                                                        break;
664                                                case 'a' :
665                                                        pbs_attr->set_attr( pbs_attr, "Execution_Time" , arg );
666                                                        break;
667                                                case 'A' :
668                                                        pbs_attr->set_attr( pbs_attr, "Account_Name" , arg );
669                                                        break;
670                                                case 'c' :
671                                                        pbs_attr->set_attr( pbs_attr, "Checkpoint" , arg );
672                                                        break;
673                                                case 'k' :
674                                                        pbs_attr->set_attr( pbs_attr, "Keep_Files" , arg );
675                                                        break;
676                                                case 'p' :
677                                                        pbs_attr->set_attr( pbs_attr, "Priority" , arg );
678                                                        break;
679                                                case 'q' :
680                                                        if (self->destination_queue)
681                                                                fsd_free(self->destination_queue);
682
683                                                        self->destination_queue = fsd_strdup( arg );
684                                                        fsd_log_debug(("self->destination_queue = %s", self->destination_queue));
685                                                        break;
686                                                case 'r' :
687                                                        pbs_attr->set_attr( pbs_attr, "Rerunable" , arg );
688                                                        break;
689                                                case 'S' :
690                                                        pbs_attr->set_attr( pbs_attr, "Shell_Path_List" , arg );
691                                                        break;
692                                                case 'u' :
693                                                        pbs_attr->set_attr( pbs_attr, "User_List" , arg );
694                                                        break;
695                                                case 'v' :
696                                                        pbs_attr->set_attr( pbs_attr, "Variable_List" , arg );
697                                                        break;
698                                                case 'M' :
699                                                        pbs_attr->set_attr( pbs_attr, "Mail_Users" , arg );
700                                                        break;
701                                                case 'l' :
702                                                        parse_resources(pbs_attr, arg);
703                                                        break;                                                 
704                                                default :
705                                                       
706                                                        fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
707                                                                        "Invalid native specification: %s (Unsupported option: -%c)",
708                                                                        native_specification, opt);
709                                        }
710                                        opt = 0;
711                                }
712                        }
713
714                        if (opt) /* option without optarg */
715                                fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
716                                                "Invalid native specification: %s",
717                                                native_specification);
718
719                 }
720                FINALLY
721                 {
722#ifndef PBS_PROFESSIONAL
723                        pbs_attr->set_attr( pbs_attr, "submit_args", native_specification);
724#endif
725                        args_list->destroy(args_list);
726                        fsd_free((char *)native_spec_copy);
727                 }
728                END_TRY
729        }
730}
731
Note: See TracBrowser for help on using the repository browser.