~ubuntu-branches/ubuntu/utopic/nordugrid-arc/utopic

« back to all changes in this revision

Viewing changes to src/hed/acc/JobDescriptionParser/XRSLParser.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2014-05-01 20:51:02 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140501205102-icy9t3348uxobyx7
Tags: 4.1.0-1
* 4.1.0 Release
* Call dh_autoreconf to support ppc64le (Closes: #744639)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
namespace Arc {
21
21
 
 
22
  /// \mapname xRSL xRSL (nordugrid:xrsl)
 
23
  /// The libarccompute library has full support for xRSL. The
 
24
  /// reference manual is located <a href="http://www.nordugrid.org/documents/xrsl.pdf">here</a>.
 
25
  /// By default the xRSL parser expects and produces user-side RSL (see
 
26
  /// reference manual), however if GM-side RSL is passed as input or wanted as
 
27
  /// output, then the "GRIDMANAGER" dialect should be used.
22
28
  XRSLParser::XRSLParser(PluginArgument* parg)
23
29
    : JobDescriptionParserPlugin(parg) {
24
30
    supportedLanguages.push_back("nordugrid:xrsl");
62
68
    return l;
63
69
  }
64
70
 
 
71
  /// \mapattr executables -> InputFileType::IsExecutable
65
72
  bool XRSLParser::ParseExecutablesAttribute(JobDescription& j) {
66
73
    std::map<std::string, std::string>::iterator itExecsAtt = j.OtherAttributes.find("nordugrid:xrsl;executables");
67
74
    if (itExecsAtt == j.OtherAttributes.end()) {
105
112
    return true;
106
113
  }
107
114
 
 
115
  /// TODO \mapattr executables -> InputFileType::IsExecutable
108
116
  bool XRSLParser::ParseFTPThreadsAttribute(JobDescription& j) {
109
117
    std::map<std::string, std::string>::iterator itAtt;
110
118
    itAtt = j.OtherAttributes.find("nordugrid:xrsl;ftpthreads");
139
147
    return true;
140
148
  }
141
149
 
 
150
  /// TODO \mapattr executables -> InputFileType::IsExecutable
142
151
  bool XRSLParser::ParseCacheAttribute(JobDescription& j) {
143
152
    std::map<std::string, std::string>::iterator itAtt;
144
153
    itAtt = j.OtherAttributes.find("nordugrid:xrsl;cache");
161
170
    return true;
162
171
  }
163
172
 
 
173
  /// TODO \mapattr executables -> InputFileType::IsExecutable
164
174
  bool XRSLParser::ParseJoinAttribute(JobDescription& j) {
165
175
    std::map<std::string, std::string>::iterator itAtt;
166
176
    itAtt = j.OtherAttributes.find("nordugrid:xrsl;join");
187
197
    return true;
188
198
  }
189
199
 
 
200
  /// TODO \mapattr executables -> InputFileType::IsExecutable
190
201
  bool XRSLParser::ParseGridTimeAttribute(JobDescription& j) { // Must be called after the 'count' attribute has been parsed.
191
202
    std::map<std::string, std::string>::iterator itAtt;
192
203
    itAtt = j.OtherAttributes.find("nordugrid:xrsl;gridtime");
216
227
    return true;
217
228
  }
218
229
 
 
230
  /// TODO \mapattr executables -> InputFileType::IsExecutable
219
231
  bool XRSLParser::ParseCountPerNodeAttribute(JobDescription& j) { // Must be called after the 'count' attribute has been parsed.
220
232
    std::map<std::string, std::string>::iterator   itAtt;
221
233
    itAtt = j.OtherAttributes.find("nordugrid:xrsl;countpernode");
555
567
      }
556
568
    }
557
569
    else if ((c = dynamic_cast<const RSLCondition*>(r))) {
 
570
      /// \mapattr executable -> ExecutableType::Path
558
571
      if (c->Attr() == "executable") {
559
572
        bool r = SingleValue(c, j.Application.Executable.Path);
560
573
        for (std::list<JobDescription>::iterator it = j.GetAlternatives().begin();
565
578
        return r;
566
579
      }
567
580
 
 
581
      /// \mapattr arguments -> ExecutableType::Argument
568
582
      if (c->Attr() == "arguments") {
569
583
        bool r = ListValue(c, j.Application.Executable.Argument);
570
584
        for (std::list<JobDescription>::iterator it = j.GetAlternatives().begin();
575
589
        return r;
576
590
      }
577
591
 
 
592
      /// \mapattr stdin -> Input
578
593
      if (c->Attr() == "stdin") {
579
594
        bool r = SingleValue(c, j.Application.Input);
580
595
        for (std::list<JobDescription>::iterator it = j.GetAlternatives().begin();
585
600
        return r;
586
601
      }
587
602
 
 
603
      /// \mapattr stdout -> Output
588
604
      if (c->Attr() == "stdout") {
589
605
        bool r = SingleValue(c, j.Application.Output);
590
606
        for (std::list<JobDescription>::iterator it = j.GetAlternatives().begin();
595
611
        return r;
596
612
      }
597
613
 
 
614
      /// \mapattr stderr -> Error
598
615
      if (c->Attr() == "stderr") {
599
616
        bool r = SingleValue(c, j.Application.Error);
600
617
        for (std::list<JobDescription>::iterator it = j.GetAlternatives().begin();
605
622
        return r;
606
623
      }
607
624
 
 
625
      /// TODO \mapattr inputfiles -> DataStagingType::InputFiles
608
626
      if (c->Attr() == "inputfiles") {
609
627
        std::list<std::list<std::string> > ll;
610
628
        if (!SeqListValue(c, ll))
611
629
          return false;
612
630
        for (std::list<std::list<std::string> >::iterator it = ll.begin();
613
 
             it != ll.end(); it++) {
614
 
          std::list<std::string>::iterator it2 = it->begin();
615
 
 
616
 
          // Check whether the first string exists in the list
617
 
          if (it2 == it->end()) {
 
631
             it != ll.end(); ++it) {
 
632
          /* Each of the elements of the inputfiles attribute should have at
 
633
           * least two values.
 
634
           */
 
635
          if (it->size() < 2) {
 
636
            logger.msg(VERBOSE, "At least two values are needed for the 'inputfiles' attribute.");
 
637
            return false;
 
638
          }
 
639
          
 
640
          if (it->front().empty()) {
 
641
            logger.msg(VERBOSE, "filename cannot be empty.");
618
642
            return false;
619
643
          }
620
644
 
621
645
          InputFileType file;
622
 
          file.Name = *it2++;
623
 
 
624
 
          // Check whether the second string exists in the list
625
 
          if (it2 == it->end()) {
626
 
            return false;
627
 
          }
628
 
 
629
 
          bool is_file = true;
630
 
          long fileSize = -1;
631
 
          std::string fileChecksum;
632
 
          // The second string in the list (it2) might either be a URL or filesize.checksum.
633
 
          if (!it2->empty()) {
634
 
            std::string::size_type sep = it2->find('.');
635
 
            if(sep == std::string::npos) {
636
 
              if(!stringto(*it2, fileSize)) is_file = false;
637
 
            } else {
638
 
              fileChecksum = it2->substr(sep+1);
639
 
              if(!stringto(it2->substr(0,sep), fileSize)) is_file = false;
 
646
          file.Name = it->front();
 
647
 
 
648
          // For USER dialect (default) the second string must be empty, a path to a file or an URL.
 
649
          // For GRIDMANAGER dialect the second string in the list might either be a URL or filesize.checksum.
 
650
          std::list<std::string>::iterator itValues = ++(it->begin());
 
651
          bool is_size_and_checksum = false;
 
652
          if (dialect == "GRIDMANAGER") {
 
653
            long fileSize = -1;
 
654
            std::string::size_type sep = itValues->find('.');
 
655
            if(stringto(itValues->substr(0,sep), fileSize)) {
 
656
              is_size_and_checksum = true;
 
657
              file.FileSize = fileSize;
 
658
              if(sep != std::string::npos) {
 
659
                file.Checksum = itValues->substr(sep+1);                  
 
660
              }
640
661
            }
641
 
            if(fileSize < 0) is_file = false;
642
662
          }
643
 
          if (!is_file) {
644
 
            URL turl(*it2);
 
663
          if (!itValues->empty() && !is_size_and_checksum) {
 
664
            URL turl(*itValues);
645
665
            if (!turl) {
646
666
              return false;
647
667
            }
648
668
            URLLocation location;
649
 
            for (it2++; it2 != it->end(); ++it2) {
 
669
            for (++itValues; itValues != it->end(); ++itValues) {
650
670
              // add any options and locations
651
671
              // an option applies to the URL preceding it (main or location)
652
 
              std::string::size_type pos = it2->find('=');
 
672
              std::string::size_type pos = itValues->find('=');
653
673
              if (pos == std::string::npos) {
654
 
                logger.msg(ERROR, "Invalid URL option syntax in option %s for input file %s", *it2, file.Name);
 
674
                logger.msg(ERROR, "Invalid URL option syntax in option %s for input file %s", *itValues, file.Name);
655
675
                return false;
656
676
              }
657
 
              std::string attr_name(it2->substr(0, pos));
658
 
              std::string attr_value(it2->substr(pos+1));
 
677
              std::string attr_name(itValues->substr(0, pos));
 
678
              std::string attr_value(itValues->substr(pos+1));
659
679
              if (attr_name == "location") {
660
680
                if (location)
661
681
                  turl.AddLocation(location);
674
694
              turl.AddLocation(location);
675
695
            file.Sources.push_back(turl);
676
696
          }
677
 
          else {
678
 
            file.FileSize = fileSize;
679
 
            file.Checksum = fileChecksum;
680
 
            if(dialect != "GRIDMANAGER") file.Sources.push_back(URL(file.Name));
 
697
          else if (itValues->empty()) {
 
698
            file.Sources.push_back(URL(file.Name));
681
699
          }
682
700
          file.IsExecutable = false;
683
701
 
684
702
          j.DataStaging.InputFiles.push_back(file);
685
 
          for (std::list<JobDescription>::iterator it = j.GetAlternatives().begin();
686
 
               it != j.GetAlternatives().end(); it++) {
687
 
            it->DataStaging.InputFiles.push_back(file);
 
703
          for (std::list<JobDescription>::iterator itAlt = j.GetAlternatives().begin();
 
704
               itAlt != j.GetAlternatives().end(); ++itAlt) {
 
705
            itAlt->DataStaging.InputFiles.push_back(file);
688
706
          }
689
707
        }
690
708
        return true;
691
709
      }
692
710
 
 
711
      // Mapping documented above
693
712
      if (c->Attr() == "executables") {
694
713
        std::list<std::string> execs;
695
714
        if (!ListValue(c, execs))
708
727
        return true;
709
728
      }
710
729
 
 
730
      // Mapping documented above
711
731
      if (c->Attr() == "cache") {
712
732
        std::string cache;
713
733
        if (!SingleValue(c, cache))
724
744
        return true;
725
745
      }
726
746
 
 
747
      /// TODO \mapattr outputfiles -> DataStagingType::OutputFiles
727
748
      if (c->Attr() == "outputfiles") {
728
749
        std::list<std::list<std::string> > ll;
729
750
        if (!SeqListValue(c, ll))
790
811
        return true;
791
812
      }
792
813
 
 
814
      /// \mapattr queue -> QueueName
 
815
      /// TODO \mapattr queue -> JobDescription::OtherAttributes["nordugrid:broker;reject_queue"]
793
816
      if (c->Attr() == "queue") {
794
817
        std::string queueName;
795
818
        if (!SingleValue(c, queueName))
821
844
        return true;
822
845
      }
823
846
 
 
847
      /// \mapattr starttime -> ProcessingStartTime
824
848
      if (c->Attr() == "starttime") {
825
849
        std::string time;
826
850
        if (!SingleValue(c, time))
833
857
        return true;
834
858
      }
835
859
 
 
860
      /// \mapattr lifetime -> SessionLifeTime
836
861
      if (c->Attr() == "lifetime") {
837
862
        std::string time;
838
863
        if (!SingleValue(c, time))
850
875
        return true;
851
876
      }
852
877
 
 
878
      /// \mapattr cputime -> TotalCPUTime "With user-side RSL minutes is expected, while for GM-side RSL seconds."
853
879
      if (c->Attr() == "cputime") {
854
880
        std::string time;
855
881
        if (!SingleValue(c, time))
867
893
        return true;
868
894
      }
869
895
 
 
896
      /// TotalWallTime is a reference to IndividualWallTime
 
897
      /// \mapattr walltime -> IndividualWallTime
 
898
      /// TODO cputime dialect/units
870
899
      if (c->Attr() == "walltime") {
871
900
        std::string time;
872
901
        if (!SingleValue(c, time))
884
913
        return true;
885
914
      }
886
915
 
 
916
      // Documented above.
887
917
      if (c->Attr() == "gridtime") {
888
918
        std::string time;
889
919
        if (!SingleValue(c, time))
901
931
        return true;
902
932
      }
903
933
 
 
934
      // TODO \mapattr benchmarks -> ResourcesType::TotalWallTime
904
935
      if (c->Attr() == "benchmarks") {
905
936
        std::list<std::list<std::string> > bm;
906
937
        if (!SeqListValue(c, bm, 3))
923
954
        return false;
924
955
      }
925
956
 
 
957
      /// \mapattr memory -> IndividualPhysicalMemory
926
958
      if (c->Attr() == "memory") {
927
959
        std::string mem;
928
960
        if (!SingleValue(c, mem))
937
969
        return true;
938
970
      }
939
971
 
 
972
      /// \mapattr disk -> DiskSpace
940
973
      if (c->Attr() == "disk") {
941
974
        std::string disk;
942
975
        if (!SingleValue(c, disk))
950
983
        return true;
951
984
      }
952
985
 
 
986
      // TODO: Maybe add support for RTE options.
 
987
      /// \mapattr runtimeenvironment -> RunTimeEnvironment
953
988
      if (c->Attr() == "runtimeenvironment") {
954
989
        std::string runtime;
955
990
        if (!SingleValue(c, runtime))
964
999
        return true;
965
1000
       }
966
1001
 
 
1002
      /// \mapattr middleware -> CEType
967
1003
      // This attribute should be passed to the broker and should not be stored.
968
1004
      if (c->Attr() == "middleware") {
969
1005
        std::string cetype;
978
1014
        return true;
979
1015
      }
980
1016
 
 
1017
      /// \mapattr opsys -> OperatingSystem
981
1018
      if (c->Attr() == "opsys") {
982
1019
        std::string opsys;
983
1020
        if (!SingleValue(c, opsys))
991
1028
        return true;
992
1029
      }
993
1030
 
 
1031
      // Documented above.
994
1032
      if (c->Attr() == "join") {
995
1033
        if (dialect == "GRIDMANAGER") {
996
1034
          // Ignore the join attribute for GM (it is a client side attribute).
1013
1051
        return true;
1014
1052
      }
1015
1053
 
 
1054
      /// \mapattr gmlog -> LogDir
1016
1055
      if (c->Attr() == "gmlog") {
1017
1056
        bool r = SingleValue(c, j.Application.LogDir);
1018
1057
        for (std::list<JobDescription>::iterator it = j.GetAlternatives().begin();
1023
1062
        return r;
1024
1063
      }
1025
1064
 
 
1065
      /// \mapattr jobname -> JobName
1026
1066
      if (c->Attr() == "jobname") {
1027
1067
        bool r = SingleValue(c, j.Identification.JobName);
1028
1068
        for (std::list<JobDescription>::iterator it = j.GetAlternatives().begin();
1033
1073
        return r;
1034
1074
      }
1035
1075
 
 
1076
      // Documented above.
1036
1077
      if (c->Attr() == "ftpthreads") {
1037
1078
        std::string sthreads;
1038
1079
        if (!SingleValue(c, sthreads))
1049
1090
        return true;
1050
1091
      }
1051
1092
 
 
1093
      /// \mapattr acl -> AccessControl
1052
1094
      if (c->Attr() == "acl") {
1053
1095
        std::string acl;
1054
1096
        if (!SingleValue(c, acl))
1068
1110
        return true;
1069
1111
      }
1070
1112
 
 
1113
      // TODO Document non existent mapping.
1071
1114
      if (c->Attr() == "cluster") {
1072
1115
        logger.msg(ERROR, "The cluster XRSL attribute is currently unsupported.");
1073
1116
        return false;
1074
1117
      }
1075
1118
 
 
1119
      /// TODO: \mapattr notify -> ApplicationType::Notification
1076
1120
      if (c->Attr() == "notify") {
1077
1121
        std::list<std::string> l;
1078
1122
        if (!ListValue(c, l))
1111
1155
        return true;
1112
1156
      }
1113
1157
 
 
1158
      /// \mapattr replicacollection -> OtherAttributes
 
1159
      /// TODO \mapattr replicacollection -> OtherAttributes["nordugrid:xrsl;replicacollection"]
1114
1160
      // Is this attribute supported?
1115
1161
      if (c->Attr() == "replicacollection") {
1116
1162
        std::string collection;
1125
1171
        }
1126
1172
      }
1127
1173
 
 
1174
      /// \mapattr rerun -> Rerun
1128
1175
      if (c->Attr() == "rerun") {
1129
1176
        std::string rerun;
1130
1177
        if (!SingleValue(c, rerun))
1137
1184
        return true;
1138
1185
      }
1139
1186
 
 
1187
      /// \mapattr priority -> Priority
1140
1188
      if (c->Attr() == "priority") {
1141
1189
        std::string priority;
1142
1190
        if (!SingleValue(c, priority))
1153
1201
        return true;
1154
1202
      }
1155
1203
 
 
1204
      /// \mapattr architecture -> Platform
1156
1205
      if (c->Attr() == "architecture") {
1157
1206
        bool r = SingleValue(c, j.Resources.Platform);
1158
1207
        for (std::list<JobDescription>::iterator it = j.GetAlternatives().begin();
1162
1211
        return r;
1163
1212
      }
1164
1213
 
 
1214
      /// \mapattr nodeaccess -> NodeAccess
1165
1215
      if (c->Attr() == "nodeaccess") {
1166
1216
        std::list<std::string> l;
1167
1217
        if (!ListValue(c, l))
1181
1231
        return true;
1182
1232
      }
1183
1233
 
 
1234
      /// \mapattr dryrun -> DryRun
1184
1235
      if (c->Attr() == "dryrun") {
1185
1236
        std::string dryrun;
1186
1237
        if (!SingleValue(c, dryrun)) {
1202
1253
        return true;
1203
1254
      }
1204
1255
 
 
1256
      /// \mapattr environment -> Environment
1205
1257
      if (c->Attr() == "environment") {
1206
1258
        std::list<std::list<std::string> > ll;
1207
1259
        if (!SeqListValue(c, ll, 2))
1213
1265
        return true;
1214
1266
      }
1215
1267
 
 
1268
      /// \mapattr count -> NumberOfSlots
1216
1269
      if (c->Attr() == "count") {
1217
1270
        std::string count;
1218
1271
        if (!SingleValue(c, count) || !stringto(count, j.Resources.SlotRequirement.NumberOfSlots)) return false;
1223
1276
        return true;
1224
1277
      }
1225
1278
 
 
1279
      /// \mapattr countpernode -> SlotsPerHost
1226
1280
      if (c->Attr() == "countpernode") {
1227
1281
        std::string countpernode;
1228
1282
        if (!SingleValue(c, countpernode))
1237
1291
        return true;
1238
1292
      }
1239
1293
 
 
1294
      /// \mapattr exclusiveexecution -> ExclusiveExecution
1240
1295
      if (c->Attr() == "exclusiveexecution") {
1241
1296
        std::string ee;
1242
1297
        if (!SingleValue(c, ee)) return false;
1250
1305
        return true;
1251
1306
      }
1252
1307
 
 
1308
      /// TODO: \mapattr jobreport -> RemoteLogging
1253
1309
      if (c->Attr() == "jobreport") {
1254
1310
        std::string jobreport;
1255
1311
        if (!SingleValue(c, jobreport))
1266
1322
        return true;
1267
1323
      }
1268
1324
 
 
1325
      /// \mapattr credentialserver -> CredentialService
1269
1326
      if (c->Attr() == "credentialserver") {
1270
1327
        std::string credentialserver;
1271
1328
        if (!SingleValue(c, credentialserver))
1411
1468
 
1412
1469
    RSLBoolean r(RSLAnd);
1413
1470
 
 
1471
    /// \mapattr executable <- ExecutableType::Path
1414
1472
    if (!j.Application.Executable.Path.empty()) {
1415
1473
      RSLList *l = new RSLList;
1416
1474
      l->Add(new RSLLiteral(j.Application.Executable.Path));
1417
1475
      r.Add(new RSLCondition("executable", RSLEqual, l));
1418
1476
    }
1419
1477
 
 
1478
    /// \mapattr arguments <- ExecutableType::Argument
1420
1479
    if (!j.Application.Executable.Argument.empty()) {
1421
1480
      RSLList *l = new RSLList;
1422
1481
      for (std::list<std::string>::const_iterator it = j.Application.Executable.Argument.begin();
1425
1484
      r.Add(new RSLCondition("arguments", RSLEqual, l));
1426
1485
    }
1427
1486
 
 
1487
    /// \mapattr stdin <- Input
1428
1488
    if (!j.Application.Input.empty()) {
1429
1489
      RSLList *l = new RSLList;
1430
1490
      l->Add(new RSLLiteral(j.Application.Input));
1431
1491
      r.Add(new RSLCondition("stdin", RSLEqual, l));
1432
1492
    }
1433
1493
 
 
1494
    /// \mapattr stdout <- Output
1434
1495
    if (!j.Application.Output.empty()) {
1435
1496
      RSLList *l = new RSLList;
1436
1497
      l->Add(new RSLLiteral(j.Application.Output));
1437
1498
      r.Add(new RSLCondition("stdout", RSLEqual, l));
1438
1499
    }
1439
1500
 
 
1501
    /// \mapattr stderr <- Error
1440
1502
    if (!j.Application.Error.empty()) {
1441
1503
      RSLList *l = new RSLList;
1442
1504
      l->Add(new RSLLiteral(j.Application.Error));
1443
1505
      r.Add(new RSLCondition("stderr", RSLEqual, l));
1444
1506
    }
1445
1507
 
 
1508
    /// \mapattr cputime <- TotalCPUTime
1446
1509
    if (j.Resources.TotalCPUTime.range > -1) {
1447
1510
      RSLList *l = new RSLList;
1448
1511
      if(dialect == "GRIDMANAGER") {
1455
1518
      r.Add(new RSLCondition("cputime", RSLEqual, l));
1456
1519
    }
1457
1520
 
 
1521
    /// \mapattr walltime <- IndividualWallTime
1458
1522
    if (j.Resources.TotalWallTime.range > -1) {
1459
1523
      RSLList *l = new RSLList;
1460
1524
      if(dialect == "GRIDMANAGER") {
1467
1531
      r.Add(new RSLCondition("walltime", RSLEqual, l));
1468
1532
    }
1469
1533
 
 
1534
    /// \mapattr memory <- IndividualPhysicalMemory
1470
1535
    if (j.Resources.IndividualPhysicalMemory > -1) {
1471
1536
      RSLList *l = new RSLList;
1472
1537
      l->Add(new RSLLiteral(tostring(j.Resources.IndividualPhysicalMemory)));
1473
1538
      r.Add(new RSLCondition("memory", RSLEqual, l));
1474
1539
    }
1475
1540
 
 
1541
    /// \mapattr environment <- Environment
1476
1542
    if (!j.Application.Environment.empty()) {
1477
1543
      RSLList *l = new RSLList;
1478
1544
      for (std::list< std::pair<std::string, std::string> >::const_iterator it = j.Application.Environment.begin();
1485
1551
      r.Add(new RSLCondition("environment", RSLEqual, l));
1486
1552
    }
1487
1553
 
 
1554
    // TODO Document mapping.
1488
1555
    if(dialect == "GRIDMANAGER") {
1489
1556
      RSLList *l = NULL;
1490
1557
 
1496
1563
        RSLList *s = new RSLList;
1497
1564
        s->Add(new RSLLiteral(it->Name));
1498
1565
        if (it->Sources.empty() || (it->Sources.front().Protocol() == "file")) { // Local file
1499
 
          std::string fsizechecksum = ".";
1500
 
          if(it->FileSize != -1) fsizechecksum = tostring(it->FileSize)+fsizechecksum;
1501
 
          if (!it->Checksum.empty()) fsizechecksum = fsizechecksum+it->Checksum;
1502
 
          if(fsizechecksum == ".") fsizechecksum = "";
 
1566
          std::string fsizechecksum;
 
1567
          if(it->FileSize != -1) fsizechecksum = tostring(it->FileSize);
 
1568
          if (!it->Checksum.empty()) fsizechecksum = "." + fsizechecksum+it->Checksum;
1503
1569
          s->Add(new RSLLiteral(fsizechecksum));
1504
1570
        } else {
1505
1571
          s->Add(new RSLLiteral(it->Sources.front().fullstr()));
1511
1577
      l = NULL;
1512
1578
 
1513
1579
      // Executables
 
1580
      /// \mapattr executables <- InputFileType::IsExecutable
1514
1581
      for (std::list<InputFileType>::const_iterator it = j.DataStaging.InputFiles.begin();
1515
1582
           it != j.DataStaging.InputFiles.end(); it++) {
1516
1583
        if (it->IsExecutable) {
1546
1613
      if (l) r.Add(new RSLCondition("outputfiles", RSLEqual, l));
1547
1614
      l = NULL;
1548
1615
 
1549
 
    } else { // (dialect == "GRIDMANAGER")
 
1616
    } else { // dialect != "GRIDMANAGER"
1550
1617
 
1551
1618
      if (!j.DataStaging.InputFiles.empty() || !j.Application.Executable.Path.empty() || !j.Application.Input.empty()) {
1552
1619
        RSLList *l = NULL;
1557
1624
          if (it->Sources.empty()) {
1558
1625
            s->Add(new RSLLiteral(""));
1559
1626
          } else if (it->Sources.front().Protocol() == "file" && it->FileSize != -1) {
1560
 
            // This hides possibly unequal name and path of local file.
1561
 
            // TODO: rethink, maybe it is better to loose FileSize instead of original path
1562
 
            std::string fsizechecksum = tostring(it->FileSize);
1563
 
            if (!it->Checksum.empty()) {
1564
 
              fsizechecksum += "."+it->Checksum;
1565
 
            }
1566
 
            s->Add(new RSLLiteral(fsizechecksum));
 
1627
            s->Add(new RSLLiteral(it->Sources.front().Path()));
1567
1628
          }
1568
1629
          else {
1569
1630
            s->Add(new RSLLiteral(it->Sources.front().fullstr()));
1627
1688
      }
1628
1689
    } // (dialect == "GRIDMANAGER")
1629
1690
 
 
1691
    /// \mapattr queue <- QueueName
1630
1692
    if (!j.Resources.QueueName.empty()) {
1631
1693
      RSLList *l = new RSLList;
1632
1694
      l->Add(new RSLLiteral(j.Resources.QueueName));
1633
1695
      r.Add(new RSLCondition("queue", RSLEqual, l));
1634
1696
    }
1635
1697
 
 
1698
    /// \mapattr rerun <- Rerun
1636
1699
    if (j.Application.Rerun != -1) {
1637
1700
      RSLList *l = new RSLList;
1638
1701
      l->Add(new RSLLiteral(tostring(j.Application.Rerun)));
1639
1702
      r.Add(new RSLCondition("rerun", RSLEqual, l));
1640
1703
    }
1641
1704
 
 
1705
    /// \mapattr priority <- Priority
1642
1706
    if (j.Application.Priority != -1) {
1643
1707
      RSLList *l = new RSLList;
1644
1708
      l->Add(new RSLLiteral(tostring(j.Application.Priority)));
1645
1709
      r.Add(new RSLCondition("priority", RSLEqual, l));
1646
1710
    }
1647
1711
 
 
1712
    /// TODO: dialect/units
 
1713
    /// \mapattr lifetime <- SessionLifeTime 
1648
1714
    if (j.Resources.SessionLifeTime != -1) {
1649
1715
      RSLList *l = new RSLList;
1650
1716
      if(dialect == "GRIDMANAGER") {
1657
1723
      r.Add(new RSLCondition("lifetime", RSLEqual, l));
1658
1724
    }
1659
1725
 
 
1726
    /// \mapattr disk <- DiskSpace
1660
1727
    if (j.Resources.DiskSpaceRequirement.DiskSpace > -1) {
1661
1728
      RSLList *l = new RSLList;
1662
1729
      l->Add(new RSLLiteral(tostring(j.Resources.DiskSpaceRequirement.DiskSpace)));
1663
1730
      r.Add(new RSLCondition("disk", RSLEqual, l));
1664
1731
    }
1665
1732
 
 
1733
    /// \mapattr runtimeenvironment <- RunTimeEnvironment
1666
1734
    if (!j.Resources.RunTimeEnvironment.empty()) {
1667
1735
      std::list<Software>::const_iterator itSW = j.Resources.RunTimeEnvironment.getSoftwareList().begin();
1668
1736
      std::list<Software::ComparisonOperator>::const_iterator itCO = j.Resources.RunTimeEnvironment.getComparisonOperatorList().begin();
1673
1741
      }
1674
1742
    }
1675
1743
 
 
1744
    /// \mapattr middleware <- CEType
1676
1745
    if (!j.Resources.CEType.empty()) {
1677
1746
      std::list<Software>::const_iterator itSW = j.Resources.CEType.getSoftwareList().begin();
1678
1747
      std::list<Software::ComparisonOperator>::const_iterator itCO = j.Resources.CEType.getComparisonOperatorList().begin();
1683
1752
      }
1684
1753
    }
1685
1754
 
 
1755
    /// \mapattr opsys <- OperatingSystem
1686
1756
    if (!j.Resources.OperatingSystem.empty()) {
1687
1757
      std::list<Software>::const_iterator itSW = j.Resources.OperatingSystem.getSoftwareList().begin();
1688
1758
      std::list<Software::ComparisonOperator>::const_iterator itCO = j.Resources.OperatingSystem.getComparisonOperatorList().begin();
1693
1763
      }
1694
1764
    }
1695
1765
 
 
1766
    /// \mapattr architecture <- Platform
1696
1767
    if (!j.Resources.Platform.empty()) {
1697
1768
      RSLList *l = new RSLList;
1698
1769
      l->Add(new RSLLiteral(j.Resources.Platform));
1699
1770
      r.Add(new RSLCondition("architecture", RSLEqual, l));
1700
1771
    }
1701
1772
 
 
1773
    /// \mapattr count <- NumberOfSlots
1702
1774
    if (j.Resources.SlotRequirement.NumberOfSlots > -1) {
1703
1775
      RSLList *l = new RSLList;
1704
1776
      l->Add(new RSLLiteral(tostring(j.Resources.SlotRequirement.NumberOfSlots)));
1705
1777
      r.Add(new RSLCondition("count", RSLEqual, l));
1706
1778
    }
1707
1779
 
1708
 
 
 
1780
    /// \mapattr countpernode <- SlotsPerHost
1709
1781
    if (j.Resources.SlotRequirement.SlotsPerHost > -1) {
1710
1782
      if (j.Resources.SlotRequirement.NumberOfSlots <= -1) {
1711
1783
        logger.msg(ERROR, "Cannot output XRSL representation: The Resources.SlotRequirement.NumberOfSlots attribute must be specified when the Resources.SlotRequirement.SlotsPerHost attribute is specified.");
1716
1788
      r.Add(new RSLCondition("countpernode", RSLEqual, l));
1717
1789
    }
1718
1790
 
1719
 
 
 
1791
    /// \mapattr exclusiveexecution <- ExclusiveExecution
1720
1792
    if (j.Resources.SlotRequirement.ExclusiveExecution != SlotRequirementType::EE_DEFAULT) {
1721
1793
      RSLList *l = new RSLList;
1722
1794
      l->Add(new RSLLiteral(j.Resources.SlotRequirement.ExclusiveExecution == SlotRequirementType::EE_TRUE ? "yes" : "no"));
1723
1795
      r.Add(new RSLCondition("exclusiveexecution", RSLEqual, l));
1724
1796
    }
1725
1797
 
1726
 
 
1727
 
 
 
1798
    /// \mapattr starttime <- ProcessingStartTime
1728
1799
    if (j.Application.ProcessingStartTime != -1) {
1729
1800
      RSLList *l = new RSLList;
1730
1801
      l->Add(new RSLLiteral(j.Application.ProcessingStartTime.str(MDSTime)));
1731
1802
      r.Add(new RSLCondition("starttime", RSLEqual, l));
1732
1803
    }
1733
1804
 
 
1805
    /// \mapattr gmlog <- LogDir
1734
1806
    if (!j.Application.LogDir.empty()) {
1735
1807
      RSLList *l = new RSLList;
1736
1808
      l->Add(new RSLLiteral(j.Application.LogDir));
1737
1809
      r.Add(new RSLCondition("gmlog", RSLEqual, l));
1738
1810
    }
1739
1811
 
 
1812
    /// \mapattr jobname <- JobName
1740
1813
    if (!j.Identification.JobName.empty()) {
1741
1814
      RSLList *l = new RSLList;
1742
1815
      l->Add(new RSLLiteral(j.Identification.JobName));
1743
1816
      r.Add(new RSLCondition("jobname", RSLEqual, l));
1744
1817
    }
1745
1818
 
 
1819
    /// \mapattr acl <- AccessControl
1746
1820
    if (j.Application.AccessControl) {
1747
1821
      RSLList *l = new RSLList;
1748
1822
      std::string acl;
1751
1825
      r.Add(new RSLCondition("acl", RSLEqual, l));
1752
1826
    }
1753
1827
 
 
1828
    /// TODO \mapattr notify <- ApplicationType::Notification
1754
1829
    if (!j.Application.Notification.empty()) {
1755
1830
      RSLList *l = new RSLList;
1756
1831
      for (std::list<NotificationType>::const_iterator it = j.Application.Notification.begin();
1767
1842
      r.Add(new RSLCondition("notify", RSLEqual, l));
1768
1843
    }
1769
1844
 
 
1845
    /// TODO \mapattr jobreport <- RemoteLogging
1770
1846
    if (!j.Application.RemoteLogging.empty()) {
1771
1847
      // Pick first SGAS remote logging service.
1772
1848
      for (std::list<RemoteLoggingType>::const_iterator it = j.Application.RemoteLogging.begin();
1781
1857
      }
1782
1858
    }
1783
1859
 
 
1860
    /// \mapattr credentialserver <- CredentialService
1784
1861
    if (!j.Application.CredentialService.empty()) {
1785
1862
      RSLList *l = new RSLList;
1786
1863
      l->Add(new RSLLiteral(j.Application.CredentialService.front().fullstr()));
1787
1864
      r.Add(new RSLCondition("credentialserver", RSLEqual, l));
1788
1865
    }
1789
1866
 
 
1867
    /// \mapattr dryrun <- DryRun
1790
1868
    if (j.Application.DryRun) {
1791
1869
      RSLList *l = new RSLList;
1792
1870
      l->Add(new RSLLiteral("yes"));
1793
1871
      r.Add(new RSLCondition("dryrun", RSLEqual, l));
1794
1872
    }
1795
1873
 
 
1874
    /// TODO \mapnote 
1796
1875
    for (std::map<std::string, std::string>::const_iterator it = j.OtherAttributes.begin();
1797
1876
         it != j.OtherAttributes.end(); it++) {
1798
1877
      std::list<std::string> keys;