-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigurationClassErrors.py
1608 lines (1396 loc) · 95.6 KB
/
configurationClassErrors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/python
from __future__ import print_function
import inspect
from inspect import currentframe, getframeinfo, getouterframes
import os
import sys
class configurationClassErrors:
# Initialise.
def __init__(self):
self.hasError = False
self.errorType = 'ERROR'
self.text = []
# Store if in debugging mode.
self.isDebug = False
# Format the error message and write to screen.
def writeFormattedText(self):
firstLine = True
secondLine = False
maxLength = 93 - 5
print(file = sys.stderr)
for line in self.text:
textList = []
while len(line) > maxLength:
index = line.rfind(' ', 0, maxLength)
if index == -1:
index = line.find(' ', 0, len(line))
if index == -1:
textList.append(line)
line = ''
else:
textList.append(line[0:index])
line = line[index + 1:len(line)]
else:
textList.append(line[0:index])
line = line[index + 1:len(line)]
if line != '' and line != ' ': textList.append(line)
line = textList.pop(0)
while line.startswith(' '): line = line[1:]
if firstLine and self.errorType == 'ERROR':
print('ERROR: %-*s' % (1, line), file=sys.stderr)
elif firstLine and self.errorType == 'WARNING':
print('WARNING: %-*s' % (1, line), file=sys.stderr)
elif secondLine:
print('DETAILS: %-*s' % (1, line), file=sys.stderr)
secondLine = False
else:
print(' %-*s' % (1, line), file=sys.stderr)
for line in textList:
while line.startswith(' '): line = line[1:]
if secondLine: print('DETAILS: %-*s' % (1, line), file=sys.stderr)
else: print(' %-*s' % (1, line), file=sys.stderr)
if firstLine:
print(file=sys.stderr)
firstLine = False
secondLine = True
#############################################
# Errors with handling configuration files. #
#############################################
# If a configuration file cannot be found.
def missingFile(self, filename):
self.text.append('Missing configuration file.')
self.text.append('The file \'' + filename + '\' could not be located."')
self.writeFormattedText()
self.terminate()
# If there are errors with decoding the json file.
def jsonError(self, error, filename):
self.text.append('Malformed json file: ' + filename)
self.text.append(str(error) + '.')
self.writeFormattedText()
self.terminate()
#######################################################################
# Errors with configuration files (common to both tool and pipeline). #
#######################################################################
# A general entry in the configuration file is invalid.
def invalidGeneralAttributeInConfigurationFile(self, name, attribute, allowedAttributes, isPipeline):
runType = 'pipeline' if isPipeline else 'tool'
self.text.append('Invalid attribute in ' + runType + ' configuration file: ' + attribute)
text = 'The configuration file for ' + runType + ' \'' + name + '\' contains the general attribute \'' + attribute + '\'. This is an ' + \
'unrecognised attribute which is not permitted. The general attributes allowed in a ' + runType + ' configuration file are:'
self.text.append(text)
self.text.append('\t')
# Create a sorted list of the allowed attributes.
allowed = []
for attribute in allowedAttributes: allowed.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(allowed):
self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]) + ', required = ' + str(allowedAttributes[attribute][1]))
self.text.append('\t')
self.text.append('Please remove or correct the invalid attribute in the configuration file.')
self.writeFormattedText()
self.terminate()
# A general entry in the configuration file is missing.
def missingGeneralAttributeInConfigurationFile(self, name, attribute, allowedAttributes, isPipeline):
runType = 'pipeline' if isPipeline else 'tool'
self.text.append('Missing attribute in ' + runType + ' configuration file: ' + attribute)
text = 'The configuration file for ' + runType + ' \'' + name + '\' is missing the general attribute \'' + attribute + '\'. The following ' + \
'general attributes are required in a ' + runType + ' configuration file:'
self.text.append(text)
self.text.append('\t')
# Create a sorted list of the required attributes.
requiredAttributes = []
for attribute in allowedAttributes:
if allowedAttributes[attribute][1]: requiredAttributes.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(requiredAttributes): self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]))
self.text.append('\t')
self.text.append('Please add the missing attribute to the configuration file.')
self.writeFormattedText()
self.terminate()
# A task included in the 'originating edges' section is invalid.
def invalidTaskInOriginatingEdges(self, configNodeID, task):
self.text.append('Invalid task in originating edges section.')
self.text.append('The pipeline configuration file contains a node with ID \'' + configNodeID + '\' with a set of edges defined in the \'' + \
'originating edges\' section. The task \'' + task + '\' appears in this list, but this is not a valid task in the pipeline. Please correct ' + \
'the pipeline configuration file to fix this problem.')
self.writeFormattedText()
self.terminate()
# A task included in the 'additional nodes' section is invalid.
def invalidTaskInAdditionalNodes(self, configNodeID, task):
self.text.append('Invalid task in additional nodes section.')
self.text.append('The pipeline configuration file contains a node with ID \'' + configNodeID + '\' with a set of nodes defined in the \'' + \
'additional nodes\' section. The task \'' + task + '\' appears in this list, but this is not a valid task in the pipeline. Please correct ' + \
'the pipeline configuration file to fix this problem.')
self.writeFormattedText()
self.terminate()
# A task included in the 'additional nodes' section has tis invalid.
def repeatedArgumentInAdditionalNodes(self, configNodeID, task, argument):
self.text.append('Invalid task in additional nodes section.')
self.text.append('The pipeline configuration file contains a node with ID \'' + configNodeID + '\' with a set of nodes defined in the \'' + \
'additional nodes\' section. The task \'' + task + '\' appears in this list, but this is not a valid task in the pipeline. Please correct ' + \
'the pipeline configuration file to fix this problem.')
self.writeFormattedText()
self.terminate()
# A pipeline node has no connections.
def nodeHasNoConnections(self, configNodeID):
self.text.append('Pipeline node has no connections.')
self.text.append('The pipeline configuration file contains a node with ID \'' + configNodeID + '\'. This node does not contain any ' + \
'connections. All pipeline nodes must be connected to at least one graph node, defined using either the \'tasks\', \'greedy tasks\' or ' + \
'the \'originating edges\' fields. Please see the documentation on pipeline configuration files and repair the pipeline configuration file.')
self.writeFormattedText()
self.terminate()
# A task included in the 'originating edges' section is associated with an invalid argument.
def invalidArgumentInOriginatingEdges(self, task, tool, argument, configNodeID):
self.text.append('Invalid argument in originating edges section.')
self.text.append('The pipeline configuration file contains a node (ID: ' + configNodeID + ') with a set of edges defined in the \'' + \
'originating edges\' section. Contained in this list is the task \'' + task + '\' associated with the argument \'' + argument + '\', but ' + \
'this in an invalid arguent for the tool \'' + tool + '\' used by this task. Please check and fix the pipeline configutaion file.')
self.writeFormattedText()
self.terminate()
# If the category/help group is invalid.
def invalidCategory(self, runName, category, allowedCategories, isPipeline):
runType = 'pipeline' if isPipeline else 'tool'
self.text.append('Invalid category in ' + runType + ' configuration file.')
text = 'The configuration file for ' + runType + ' \'' + runName + '\' includes the category \'' + category + '\', but this is not ' + \
'a valid category for the ' + runType + '. The valid categories are:'
self.text.append(text)
self.text.append('\t')
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(allowedCategories): self.text.append(attribute)
self.text.append('\t')
self.text.append('Please replace the category with a valid value in the configuration file.')
self.writeFormattedText()
self.terminate()
##########################################
# Errors with a tool configuration file. #
##########################################
# Attribute has the wrong type.
def incorrectTypeInToolConfigurationFile(self, tool, group, attribute, argument, value, expectedType):
# Find the given type.
isType = self.findType(type(value))
needsType = self.findType(expectedType)
if isType == None: isType = 'Unknown'
if needsType == None: needsType = 'Unknown'
self.text.append('Invalid attribute value in tool configuration file.')
text = 'The attribute \'' + str(attribute) + '\' in the configuration file for \'' + str(tool) + '\''
text += ', argument \'' + argument + '\' in argument group \'' + str(group) + '\' ' if argument else ' '
if isType == 'list' or isType == 'dictionary': text += 'is given a value '
else: text += 'is given the value \'' + str(value) + '\'. This value is '
text += 'of an incorrect type (' + isType + '); the expected type is \'' + needsType + '\'. Please correct ' + \
'this value in the configuration file.'
self.text.append(text)
self.writeFormattedText()
self.terminate()
# The 'inputs' or 'outputs' argument groups are missing.
def missingRequiredArgumentGroup(self, tool, isInputs):
self.text.append('Missing argument group in tool configuration file.')
self.text.append('The arguments available for the tool \'' + tool + '\' are defined in the \'arguments\' section of the tool ' + \
'configuration file. Each argument definition is stored in one of the named argument groups. The groups \'inputs\' and ' + \
'\'outputs\' must be present, but one of them is missing. Please ensure that the configuration file conforms ' + \
'to all requirements.')
self.writeFormattedText()
self.terminate()
# A tool argument is not accompanied by a dictionary of attributes.
def toolArgumentHasNoDictionary(self, tool):
self.text.append('Invalid tool argument definition in configuration file.')
self.text.append('The tool configuration file has definitions for allowed arguments in a list. This must be a list of dictionaries, each ' + \
'dictionary containing a variety of required and optional attributes for the tool argument. The configuration file for tool \'' + tool + \
'\' contains a field in the \'arguments\' section that is not a dictionary. Please modify the configuration file to be compliant with ' + \
'the configuration standards. The documentation includes information on the format and all allowed attributes for each tool argument.')
self.writeFormattedText()
self.terminate()
# If a tool argument does not have a long form argument.
def noLongFormForToolArgument(self, tool, group):
self.text.append('Missing long form for tool argument in configuration file')
self.text.append('All arguments defined in a tool configuration file, must have a long and short form defined. The long form version is' + \
'used to identify the argument in all of the relevant data structures as well as for identifying problematic arguments in error messages. ' + \
'The \'long form argument\' field is missing for one of the arguments in the \'' + group + '\' argument group. Please check the ' + \
'configuration file for tool \'' + tool + '\' and ensure that the \'long form argument\' attribute is present for all arguments.')
self.writeFormattedText()
self.terminate()
# An argument attribute in the configuration file is invalid.
def invalidArgumentAttributeInToolConfigurationFile(self, tool, group, argument, attribute, allowedAttributes):
self.text.append('Invalid argument attribute in tool configuration file: ' + attribute)
self.text.append('The configuration file for tool \'' + tool + '\' contains the argument \'' + argument + '\' in argument group \'' + group + \
'\'. This argument contains the attribute \'' + attribute + '\', which is not recognised. The argument attributes allowed in a tool ' + \
'configuration file are:')
self.text.append('\t')
# Create a sorted list of the allowed attributes.
allowed = []
for attribute in allowedAttributes: allowed.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(allowed):
self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]) + ', required = ' + str(allowedAttributes[attribute][1]))
self.text.append('\t')
self.text.append('Please remove or correct the invalid attribute in the configuration file.')
self.writeFormattedText()
self.terminate()
# An argument attribute in the configuration file is missing.
def missingArgumentAttributeInToolConfigurationFile(self, tool, group, argument, attribute, allowedAttributes):
self.text.append('Missing attribute in tool configuration file for argument: ' + argument)
self.text.append('The configuration file for tool \'' + tool + '\', argument \'' + argument + '\' in argument group \'' + group + \
'\' is missing the attribute \'' + attribute + '\'. The following attributes are required for each argument in a tool configuration file:')
self.text.append('\t')
# Create a sorted list of the required attributes.
requiredAttributes = []
for attribute in allowedAttributes:
if allowedAttributes[attribute][1]: requiredAttributes.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(requiredAttributes): self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]))
self.text.append('\t')
self.text.append('Please add the missing attribute to the tool configuration file.')
self.writeFormattedText()
self.terminate()
# A tool argument is repeated.
def repeatedToolArgumentInToolConfigurationFile(self, tool, argument, isLongForm):
self.text.append('Repeated argument in tool configuration file.')
text = 'long' if isLongForm else 'short'
self.text.append('Each argument supplied in the tool configuration file must be unique. An argument for tool \'' + tool + \
'\' has the ' + text + ' form argument \'' + argument + '\', but this has already been ' + \
'defined for this tool. Please ensure that each argument defined in the configuration file has a unique long and short form argument.')
self.writeFormattedText()
self.terminate()
# An argument is missing from the argument order.
def missingArgumentInArgumentOrder(self, tool, argument):
self.text.append('Missing argument in argument order: ' + argument)
self.text.append('The argument order list in the tool configuration file must contain all of the arguments available to the tool. ' + \
'The argument \'' + argument + '\' for tool \'' + tool + '\' is not present in the argument order. Please ensure ' + \
'that the argument order contains all of the arguments for the tool.')
self.writeFormattedText()
self.terminate()
# An invalid argument appears in the argument order.
def invalidArgumentInArgumentOrder(self, tool, argument):
self.text.append('Invalid argument in argument order: ' + argument)
self.text.append('The argument order list must contain only arguments that are available to the tool. The configuration file for tool \'' + \
tool + '\' contains the argument \'' + argument + '\' which does not correspond to any argument for the tool. Please check and repair ' + \
'the tool configuration file.')
self.writeFormattedText()
self.terminate()
# An argument is repeated in the argument order.
def repeatedArgumentInArgumentOrder(self, tool, argument):
self.text.append('Repeated argument in argument order: ' + argument)
self.text.append('The argument order list must contain only arguments that are available to the tool and each argument only once. ' + \
'The configuration file for tool \'' + tool + '\' contains the repeated argument \'' + argument + '\'. Please ensure that each ' + \
'argument appears only once in the list.')
self.writeFormattedText()
self.terminate()
# An argument is listed as a filename stub, but has no supplied extensions.
def filenameStubWithNoExtensions(self, tool, argument):
self.text.append('Argument defined as filename stub with no filename extensions provided.')
self.text.append('The tool \'' + tool + '\' has an argument \'' + argument + '\' defined as a filename stub. All ' + \
'filename stub arguments must also provide a list of extensions that are associated with this stub, but this argument does not. ' + \
'Please check and fix the argument in the configuration file.')
self.writeFormattedText()
self.terminate()
# The 'modify text' list in the 'construct filename' contains a field that has more than one instruction.
def multipleInstructionsInModifyTextDictionary(self, tool, argument):
self.text.append('Multiple instructions in construct filename.')
self.text.append('The tool \'' + tool + '\' has an argument \'' + argument + '\' that has instructions on how to construct the filename. ' + \
'As part of the instructions, the field \'modify text\' is included. All fields in this list must be dictionaries containing a single ' + \
'instruction. The filename construction proceeds in the order that the dictionaries appear in the \'modify text\' list and to preserve ' + \
'the order, each included dictionary can only contain one instruction.')
self.writeFormattedText()
self.terminate()
# The 'modify text' list in the 'construct filename' contains a field that is not a dictionary.
def notDictionaryInModifyText(self, tool, argument):
self.text.append('Invalid field in construct filename.')
self.text.append('The tool \'' + tool + '\' has an argument \'' + argument + '\' that has instructions on how to construct the filename. ' + \
'As part of the instructions, the field \'modify text\' is included. All fields in this list must be dictionaries, but there is at least ' + \
'one none dictionary field. Please modify the configuration file to conform to the requirements outlined in the documentation.')
self.writeFormattedText()
self.terminate()
# If the argument is to be modified using instructions from the 'modify argument values' field,
# the command field must be present.
def noCommandInModifyValues(self, tool, argument):
self.text.append('Missing field in \'modify argument values\'.')
self.text.append('The tool \'' + tool + '\' has an argument \'' + argument + '\' that has instructions on how to modify the argument ' + \
'values on the command line. As part of these instructions, the field \'command\' is required, but is missing. This field indicates ' + \
'how the value should be written to the command line. Please modify the configuration file to conform to the requirements outlined in ' + \
'the documentation.')
self.writeFormattedText()
self.terminate()
# If the argument is to be modified using instructions from the 'modify argument values' field
# and the modification is only to occur for specific extensions, terminate if any of the supplied
# extensions are not valid for this tool argument.
def invalidExtensionInModifyValues(self, tool, argument, extension, allowedExtensions):
self.text.append('Invalid extension in \'modify argument values\'.')
self.text.append('The tool \'' + tool + '\' has an argument \'' + argument + '\' that has instructions on how to modify the argument ' + \
'values on the command line. These instructions are only executed for files with specified extensions. The extension \'' + extension + \
'\' is included in the list of extensions to trigger this clause, but this extensions is not a valid extension for the tool argument. ' + \
'The following extensions are allowed:')
self.text.append('\t')
for allowedExtension in allowedExtensions: self.text.append('\t' + allowedExtension)
self.text.append('\t')
self.text.append('Please modify the configuration file to conform to the requirements outlined in the documentation.')
self.writeFormattedText()
self.terminate()
# If a files path is defined by another argument and that argument is invalid.
def invalidArgumentInPathArgument(self, tool, longFormArgument, pathArgument):
self.text.append('Error with configuration file.')
self.text.append('The tool \'' + tool + '\' has an argument \'' + longFormArgument + '\' which includes the field \'include path from ' + \
'argument\'. This field defines another argument for this tool that will be used for the path of the file/directory. The provided ' + \
'argument \'' + pathArgument + '\' is not a valid argument for this tool. Please update the configuration file to include a valid ' + \
'argument.')
self.writeFormattedText()
self.terminate()
# If an attribute in the 'argument list' field is not recognised.
def invalidAttributeInList(self, tool, longFormArgument, attribute, allowedAttributes):
self.text.append('Invalid attribute in argument list.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'argument list\' field, which is a dictionary containing instructions on how to use the values included in the list. ' + \
'Within this dictionary is the attribute \'' + attribute + '\' which is not recognised. The allowed attributes are:')
self.text.append('\t')
# Create a sorted list of the allowed attributes.
allowed = []
for attribute in allowedAttributes: allowed.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(allowed):
self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]) + ', required = ' + str(allowedAttributes[attribute][1]))
self.text.append('\t')
self.text.append('Please remove or correct the invalid attribute in the configuration file.')
self.writeFormattedText()
self.terminate()
# If an attribute in the 'argument list' field is not recognised.
def invalidArgumentInList(self, tool, longFormArgument, argument):
self.text.append('Invalid argument in argument list.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'argument list\' field, which is a dictionary containing instructions on how to use the values included in the list. ' + \
'Within this dictionary is the attribute \'use argument\' which defines the tool argument to use for the values supplied in the list. ' + \
'The supplied argument \'' + argument + '\' is not a valid argument for this tool. Please correct the invalid argument in the configuration file.')
self.writeFormattedText()
self.terminate()
# If the 'argument list' mode is invalid.
def invalidModeInList(self, tool, longFormArgument, mode, allowedModes):
self.text.append('Invalid mode in argument list.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'argument list\' field, which is a dictionary containing instructions on how to use the values included in the list. ' + \
'Within this dictionary is the attribute \'mode\' which describes how the makefiles should be constructed using the values in the supplied ' + \
'list. The supplied mode \'' + mode + '\' is not recognised. The allowed modes are:')
self.text.append('\t')
# Create a sorted list of the allowed attributes.
allowed = []
for mode in allowedModes: allowed.append(mode)
# Add the attributes to the text to be written along with the expected type.
for mode in sorted(allowed): self.text.append(mode)
self.text.append('\t')
self.text.append('Please remove or correct the invalid attribute in the configuration file.')
self.writeFormattedText()
self.terminate()
# If the instructions for replacing an argument in the event of a stream are invalid.
def invalidValueArgumentStream(self, tool, longFormArgument, value, allowedValues, isInput):
field = 'if input is stream' if isInput else 'if output to stream'
io = 'input' if isInput else 'output'
self.text.append('Invalid instructions for stream.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'' + field + '\' field, which describes how to modify the argument in the event that the ' + io + ' is a ' + \
'stream. The value accompanying this field \'' + value + '\' is not recognised. The allowed values for this field to take are:')
self.text.append('\t')
# Create a sorted list of the allowed attributes.
allowed = []
for value in allowedValues: allowed.append(value)
# Add the attributes to the text to be written along with the expected type.
for value in sorted(allowed): self.text.append(value)
self.text.append('\t')
self.text.append('Please remove or correct the invalid attribute in the configuration file.')
self.writeFormattedText()
self.terminate()
# If the input/output argument has instructions on how to proceed with a stream and the value 'replace' is
# given to the 'if input is stream' or the 'if output to stream', instructions on what to replace the
# argument/value with are required. If these are missins, terminate.
def noReplace(self, tool, longFormArgument, isInput):
field = 'if input is stream' if isInput else 'if output to stream'
io = 'input' if isInput else 'output'
self.text.append('Invalid instructions for stream.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'' + field + '\' field, which describes how to modify the argument in the event that the ' + io + ' is a ' + \
'stream. The value accompanying this field is \'replace\', which means that instructions on what to replace the argument/value with are ' + \
'required. These instructions are missing in the configuration file. Please ensure that the \'replace argument with\' dictionary is included ' + \
'with the argument. This dictionary needs to contain the \'argument\' and \'value\' fields.')
self.writeFormattedText()
self.terminate()
# If the 'replace argument with' dictionary is missing either the 'argument' or 'value' fields.
def missingAttributeInReplace(self, tool, longFormArgument, attribute, isInput):
field = 'if input is stream' if isInput else 'if output to stream'
io = 'input' if isInput else 'output'
self.text.append('Invalid instructions for stream.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'' + field + '\' field, which describes how to modify the argument in the event that the ' + io + ' is a ' + \
'stream. The value accompanying this field is \'replace\', which means that instructions on what to replace the argument/value with are ' + \
'required. The \'replace argument with\' dictionary provides these instructions, but the contained \'' + attribute + '\' attribute is ' + \
'missing. Please repair the configuration file.')
self.writeFormattedText()
self.terminate()
# Given a value, return a string representation of the data type.
def findType(self, providedType):
if providedType == str: return 'string'
elif providedType == int: return 'integer'
elif providedType == float: return 'float'
elif providedType == bool: return 'Boolean'
elif providedType == dict: return 'dictionary'
elif providedType == list: return 'list'
else: return None
##################################
# Errors with evaluate commands. #
##################################
# The evaluate commands field contains an invalid attribute.
def invalidAttributeInEvaluate(self, tool, longFormArgument, attribute, allowedAttributes):
self.text.append('Invalid attribute in \'evaluate command\'.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'evaluate command\' field, which contains information on a command that is to be used instead of a value. The ' + \
'invalid attribute \'' + attribute + '\' appears in this section. Please ensure that this section only contains the attributes listed below:')
self.text.append('\t')
for allowedAttribute in allowedAttributes: self.text.append('\t' + allowedAttribute)
self.writeFormattedText()
self.terminate()
# If the attribute type is invalid.
def invalidTypeEvaluate(self, tool, longFormArgument, attribute, expectedType):
stringType = self.findType(expectedType)
self.text.append('Invalid attribute type in \'evaluate command\'.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'evaluate command\' field, which contains information on a command that is to be used instead of a value. The ' + \
'attribute \'' + attribute + '\' is of the wrong type (the expected type is \'' + stringType + '\'). Please ensure that all attributes ' + \
'are valid.')
self.writeFormattedText()
self.terminate()
# If an attribute is missing.
def missingAttributeInEvaluate(self, tool, longFormArgument, attribute):
self.text.append('Missing attribute in \'evaluate command\'.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'evaluate command\' field, which contains information on a command that is to be used instead of a value. The ' + \
'required attribute \'' + attribute + '\' is missing. Please ensure that all required attributes are present.')
self.writeFormattedText()
self.terminate()
# If a required attribute in the 'add values' section is missing.
def errorInEvaluateValues(self, tool, longFormArgument, attribute):
self.text.append('Missing attribute in \'evaluate command\', \'add values\' section.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'evaluate command\' field, which contains information on a command that is to be used instead of a value. The ' + \
'\'add values\' list is present, which includes both the \'ID\' and \'argument\' attributes. The \'ID\' is a string present in the ' + \
'command, and the \'argument\' is the argument whose value should be used in place of this ID. The \'' + attribute + '\' attribute is ' + \
'missing in at least one of the dictionaries in the \'add values\' section.')
self.writeFormattedText()
self.terminate()
# One of the IDs in the 'add values' section is not present in the command.
def invalidIDInEvaluate(self, tool, longFormArgument, ID):
self.text.append('Invalid ID in the \'evaluate command\', \'add values\' section.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'evaluate command\' field, which contains information on a command that is to be used instead of a value. The ' + \
'\'add values\' list is present, which includes both the \'ID\' and \'argument\' attributes. The \'ID\' is a string present in the ' + \
'command, and the \'argument\' is the argument whose value should be used in place of this ID. The ID \'' + ID + '\' is not present in the ' + \
'command.')
self.writeFormattedText()
self.terminate()
# An ID in the command has multiple appearances in the 'add values' section.
def IDDefinedMultipleTimesInEvaluate(self, tool, longFormArgument, ID):
self.text.append('ID defined multiple times in the \'evaluate command\', \'add values\' section.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'evaluate command\' field, which contains information on a command that is to be used instead of a value. The ' + \
'\'add values\' list is present, which includes both the \'ID\' and \'argument\' attributes. The \'ID\' is a string present in the ' + \
'command, and the \'argument\' is the argument whose value should be used in place of this ID. Each ID in the command should appear once ' + \
'and only once in the \'add values\' section, but the ID \'' + ID + '\' is define multiple times.')
self.writeFormattedText()
self.terminate()
# Invalid argument in the 'add values' section.
def invalidArgumentInEvaluate(self, tool, longFormArgument, ID, argument):
self.text.append('Invalid argument in the \'evaluate command\', \'add values\' section.')
self.text.append('The configuration file for tool \'' + tool + '\' contains information for the argument \'' + longFormArgument + '\'. This ' + \
'argument contains the \'evaluate command\' field, which contains information on a command that is to be used instead of a value. The ' + \
'\'add values\' list is present, which includes both the \'ID\' and \'argument\' attributes. The \'ID\' is a string present in the ' + \
'command, and the \'argument\' is the argument whose value should be used in place of this ID. The argument must be a valid argument for ' + \
'this tool, or take the value \'tool\' which will replace the ID with the name of the tool. The argument \'' + argument + '\' given for the ' + \
'ID \'' + ID + '\' is not a valid argument.')
self.writeFormattedText()
self.terminate()
###################################################
# Errors with filename construction instructions. #
###################################################
# If no construction method is supplied.
def noConstructionMethod(self, tool, argument, allowedMethods):
self.text.append('Error with filename construction instructions.')
self.text.append('Argument \'' + argument + '\' associated with tool \'' + tool + '\' has instructions on how the filename should be ' + \
'constructed, however, the construction method is not defined. The field \'method\' must be present with one of the following values:')
self.text.append('\t')
for method in allowedMethods: self.text.append(method)
self.text.append('\t')
self.text.append('Please amend the \'' + tool + '\' configuration file to be consistent with this requirement.')
self.writeFormattedText()
self.terminate()
# If the construction method is unknown.
def unknownConstructionMethod(self, tool, argument, method, allowedMethods):
self.text.append('Error with filename construction instructions.')
self.text.append('Argument \'' + argument + '\' associated with tool \'' + tool + '\' has instructions on how the filename should be ' + \
'constructed, however, the provided construction method \'' + method + '\' is not recognised. The field \'method\' must be present with ' + \
'one of the following values:')
self.text.append('\t')
for method in allowedMethods: self.text.append(method)
self.text.append('\t')
self.text.append('Please amend the \'' + tool + '\' configuration file to be consistent with this requirement.')
self.writeFormattedText()
self.terminate()
# If an unknown attribute appears in the construction instructions.
def invalidAttributeInConstruction(self, tool, argument, attribute, method, allowedAttributes):
self.text.append('Error with filename construction instructions.')
self.text.append('Argument \'' + argument + '\' associated with tool \'' + tool + '\' uses the method \'' + method + '\' to generate the ' + \
'filename. The attribute \'' + attribute + '\' is included in the instructions, but this is not a valid attribute for this method of ' + \
'filename construction. The allowed attributes for this method are:')
self.text.append('\t')
for allowedAttribute in allowedAttributes:
dataType = allowedAttributes[allowedAttribute][0]
isRequired = allowedAttributes[allowedAttribute][1]
if isRequired: self.text.append(allowedAttribute + ' (' + str(dataType) + '): required.')
else: self.text.append(allowedAttribute + ' (' + str(dataType) + '): optional.')
self.text.append('\t')
self.text.append('Please amend the \'' + tool + '\' configuration file to be consistent with the requirements.')
self.writeFormattedText()
self.terminate()
# The construction instructions included in the modify text field, must be dictionaries, each of which contains
# a list as the value.
def nonListInConstruction(self, tool, argument, field):
self.text.append('Error with filename construction instructions.')
self.text.append('Argument \'' + argument + '\' associated with tool \'' + tool + '\' has instructions on how the filename should be ' + \
'constructed. As part of the construction, there are instructions on how to modify the text. This a list of dictionaries, where each ' + \
'dictionary contains an instruction as the key and a list of strings as the value. The field \'' + field + '\', however does not have ' + \
'a list as the value. Please check the construction instructions.')
self.writeFormattedText()
self.terminate()
# The construction instructions included in the modify text field, must be dictionaries, each of which contains
# a list as the value. Ths list needs to be strings, no dicts or lists.
def invalidStringInConstruction(self, tool, argument, field):
self.text.append('Error with filename construction instructions.')
self.text.append('Argument \'' + argument + '\' associated with tool \'' + tool + '\' has instructions on how the filename should be ' + \
'constructed. As part of the construction, there are instructions on how to modify the text. This a list of dictionaries, where each ' + \
'dictionary contains an instruction as the key and a list of strings as the value. The field \'' + field + '\', however contains a value ' + \
'that is either a dictionary or a list. Please check the construction instructions.')
self.writeFormattedText()
self.terminate()
# The type is incorrect.
def incorrectTypeInConstruction(self, tool, argument, attribute, method, value, expectedType):
# Find the given type.
isType = self.findType(type(value))
needsType = self.findType(expectedType)
if isType == None: isType = 'Unknown'
if needsType == None: needsType = 'Unknown'
self.text.append('Invalid attribute value in filename construction instructions.')
text = 'Argument \'' + argument + '\' associated with tool \'' + tool + '\' uses the method \'' + method + '\' to generate the ' + \
'filename. The attribute \'' + attribute + '\' '
if isType == 'list' or isType == 'dictionary': text += 'is given a value '
else: text += 'is given the value \'' + str(value) + '\'. This value is '
text += 'of an incorrect type (' + isType + '); the expected type is \'' + needsType + '\'. Please correct ' + \
'this value in the configuration file.'
self.text.append(text)
self.writeFormattedText()
self.terminate()
# A required values is missing.
def missingAttributeInConstruction(self, tool, argument, attribute, method, allowedAttributes):
self.text.append('Missing attribute in construction instructions.')
self.text.append('Argument \'' + argument + '\' associated with tool \'' + tool + '\' uses the method \'' + method + '\' to generate the ' + \
'filename. The attribute \'' + attribute + '\' is required in the \'construct filename\' section of the configuration file for this ' + \
'argument, but it is missing. The following attributes are required in the \'construct filename\' section, if the \'' + method + \
'\' method is being used:')
self.text.append('\t')
# Create a sorted list of the required attributes.
requiredAttributes = []
for attribute in allowedAttributes:
if allowedAttributes[attribute][1]: requiredAttributes.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(requiredAttributes): self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]))
self.text.append('\t')
self.text.append('Please add the missing attribute to the configuration file.')
self.writeFormattedText()
self.terminate()
# An argument used in the 'add additional values' section is invalid.
def invalidArgumentInConstruction(self, tool, argument, addArgument, allowedArguments, section):
self.text.append('Invalid argument in construction instructions.')
self.text.append('Argument \'' + argument + '\' associated with tool \'' + tool + '\' has instructions on how to construct the filename in ' + \
'the absence of a defined value. As part of this construction, the value from another tool argument (' + addArgument + ') is used as ' + \
'instructed in the \'' + section + '\' section. This argument is not a valid argument for this tool. Arguments appearing in this section ' + \
'must be one of the following:')
self.text.append('\t')
for allowedArgument in allowedArguments: self.text.append(allowedArgument)
self.text.append('\t')
self.text.append('Please correct the configuration file.')
self.writeFormattedText()
self.terminate()
##########################################################
# Errors associated with trying to get tool information. #
##########################################################
# Attempt to get information on a general tool attribute when the requested tool does not exist.
def invalidToolInGeneralToolAttributes(self, tool, attribute):
self.text.append('Attempt to get attributes for a non-existent tool: ' + tool)
self.text.append('The configurationClass method \'getGeneralAttribute\' was called to get the attribute \'' + attribute + \
'\' for tool \'' + tool + '\', however, the requested tool does not exist.')
self.writeFormattedText()
self.terminate()
# Attempt to get information on a tool argument when the requested tool does not exist.
def invalidToolInToolArgumentAttributes(self, tool, argument, attribute, problemID):
self.text.append('Attempt to get argument attributes for a non-existent tool: ' + tool)
self.text.append('The configurationClass method \'getArgumentAttribute\' was called to get the attribute \'' + attribute + \
'\' for argument \'' + argument + '\' for tool \'' + tool + '\'.')
self.text.append('\t')
if problemID == 'tool': self.text.append('The requested tool does not exist.')
elif problemID == 'argument': self.text.append('The requested argument does not exist.')
else: self.text.append('An unknown problem with this request has occurred.')
self.writeFormattedText()
self.terminate()
# Attempt to get a specific argument for an invalid tool.
def invalidToolInGetArguments(self, tool):
self.text.append('Attempt to get all arguments for a non-existent tool: ' + tool)
self.text.append('The configurationClass method \'getArguments\' was called to get the all of the arguments for the tool \'' + tool + \
'\'. The requested tool does not exist.')
self.writeFormattedText()
self.terminate()
# Requested tool is not present in the dictionaries of long and short form arguments.
def missingToolInGetLongFormArgument(self, tool):
self.text.append('Unknown tool: ' + tool)
self.text.append('The configurationClass method \'getLongFormArgument\' was called to find the long form of an argument for the ' + \
'tool \'' + tool + '\'. This is an unknown tool and so the argument cannot be processed.')
self.writeFormattedText()
self.terminate()
# An unknown command line argument was requested,
def unknownToolArgument(self, tool, argument):
self.text.append('Unknown argument: ' + str(argument))
text = 'The argument \'' + str(argument) + '\' was included on the command line, but is not a valid argument for the current tool (' + \
tool + ').'
self.text.append(text)
self.writeFormattedText()
self.terminate()
##############################################
# Errors with a pipeline configuration file. #
##############################################
# Attribute has the wrong type.
def incorrectTypeInPipelineConfigurationFile(self, pipeline, attribute, value, expectedType, section):
# Find the given type.
isType = self.findType(type(value))
needsType = self.findType(expectedType)
if isType == None: isType = 'Unknown'
if needsType == None: needsType = 'Unknown'
self.text.append('Invalid attribute value in pipeline configuration file.')
text = 'The attribute \'' + str(attribute) + '\' in the \'' + section + '\' section of the configuration file for pipeline \'' + \
str(pipeline) + '\' '
if isType == 'list' or isType == 'dictionary': text += 'is given a value '
else: text += 'is given the value \'' + str(value) + '\'. This value is '
text += 'of an incorrect type (' + isType + '); the expected type is \'' + needsType + '\'. Please correct ' + \
'this value in the configuration file.'
self.text.append(text)
self.writeFormattedText()
self.terminate()
# A task in the tasks section is not accompanied by a dictionary.
def taskIsNotDictionary(self, pipeline, task):
self.text.append('Task not supplied with dictionary in \'tasks\' section of pipeline configuration file.')
self.text.append('The pipeline configuration file contains a section \'tasks\' which assigns certain parameters to each task in the ' + \
'pipeline. Each listed task must be accompanied by a dictionary with key, value pairs describing these parameters. The configuration ' + \
'file for pipeline \'' + pipeline + '\' contains the task \'' + task + '\' which is not accompanied by a dictionary. Please check and ' + \
'correct the configuration file.')
self.writeFormattedText()
self.terminate()
# An general entry in the configuration file is invalid.
def invalidAttributeInTasks(self, pipeline, task, attribute, allowedAttributes):
self.text.append('Invalid attribute in tasks section of a pipeline configuration file: ' + attribute)
self.text.append('In the tasks section of the configuration file for pipeline \'' + pipeline + '\', there is a problem with the contained ' + \
'information for task \'' + task + '\'. The configuration file contains the attribute \'' + attribute + '\', which is an unrecognised ' + \
'attribute which is not permitted. The attributes allowed for each task in the tasks section of the pipeline configuration file are:')
self.text.append('\t')
# Create a sorted list of the allowed attributes.
allowed = []
for attribute in allowedAttributes: allowed.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(allowed):
self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]) + ', required = ' + str(allowedAttributes[attribute][1]))
self.text.append('\t')
self.text.append('Please remove or correct the invalid attribute in the configuration file.')
self.writeFormattedText()
self.terminate()
# A pipeline attribute is missing.
def missingAttributeInPipelineConfigurationFile(self, pipeline, attribute, allowedAttributes, section, ID):
self.text.append('Missing attribute in ' + section + ' section of configuration file: ' + pipeline)
text = 'The pipeline configuration file for \'' + pipeline + '\' is missing the \'' + section + '\' attribute \'' + attribute + '\''
if ID: text += ' from node ID \'' + ID + '\'. '
else: text += '. '
text += 'The following attributes are required in the \'' + section + '\' section of the pipeline configuration file:'
self.text.append(text)
self.text.append('\t')
# Create a sorted list of the required attributes.
requiredAttributes = []
for attribute in allowedAttributes:
if allowedAttributes[attribute][1]: requiredAttributes.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(requiredAttributes): self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]))
self.text.append('\t')
self.text.append('Please add the missing attribute to the configuration file.')
self.writeFormattedText()
self.terminate()
# If the tool supplied for a task is invalid.
def invalidToolInPipelineConfigurationFile(self, pipeline, task, tool):
self.text.append('Invalid tool defined for task: ' + task)
self.text.append('In the \'tasks\' section of the configuration file for pipeline \'' + pipeline + '\', the task \'' + task + \
'\' is defined as using the tool \'' + tool + '\'. This tool does not have a defined configuration file of its own and so cannot ' + \
'be used. Please check the configuration file and supply a valid tool.')
self.writeFormattedText()
self.terminate()
# If the pipeline node does not have the 'ID' attributes.
def noIDInPipelineNode(self, pipeline):
self.text.append('No ID for a pipeline node.')
self.text.append('Each node in the \'nodes\' section of the pipeline configuration file contains information about pipeline ' + \
'arguments, which tasks connect to the same nodes etc. Each of these nodes must contain the \'ID\' attribute, so that the node can ' + \
'be identified. A node in the configuration file for \'' + pipeline + '\' does not have this attribute. Please check the configuration ' + \
'file and ensure that each node has a unique \'ID\' attribute.')
self.writeFormattedText()
self.terminate()
# If the attribute is not recognised.
def invalidAttributeInNodes(self, pipeline, ID, attribute, allowedAttributes):
self.text.append('Invalid attribute in nodes section of the configuration file for pipeline: ' + pipeline)
text = 'The \'nodes\' section of the configuration file for pipeline \'' + pipeline + '\' contains the node identified with the ID \'' + \
ID + '\'. This node contains the attribute \'' + attribute + '\'. This is an unrecognised attribute which is not permitted. The ' + \
'attributes allowed in the nodes section of the pipeline configuration file are:'
self.text.append(text)
self.text.append('\t')
# Create a sorted list of the allowed attributes.
allowed = []
for attribute in allowedAttributes: allowed.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(allowed):
self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]) + ', required = ' + str(allowedAttributes[attribute][1]))
self.text.append('\t')
self.text.append('Please remove or correct the invalid attribute in the configuration file.')
self.writeFormattedText()
self.terminate()
# A node in the nodes section is not a dictionary.
def nodeIsNotADictionary(self, pipeline):
self.text.append('Node in \'nodes\' section of the pipeline configuration file is not a dictionary.')
self.text.append('The pipeline configuration file contains a section \'nodes\' which defines a node associated with, for example, ' + \
'pipeline arguments, or describes which arguments of different tasks point to the same files. The configuration file for pipeline \'' +
pipeline + '\' contains a node which is not a dictionary. Please check and correct the configuration file.')
self.writeFormattedText()
self.terminate()
# A task in a pipeline node definition is invalid.
def invalidTaskInNode(self, pipeline, nodeID, task, isGreedy):
self.text.append('Invalid task in pipeline configuration file node: ' + nodeID)
text = 'The \'nodes\' section of the pipeline configuration file for pipeline \'' + pipeline + '\' contains a node in the \'nodes\' ' + \
'section with the ID \'' + nodeID + '\'. The contained \''
if isGreedy: text += 'greedy '
text += 'tasks\' section contains the task \'' + task + '\' which is not a task available in the pipeline. Please check the configuration ' + \
'file and ensure that all tasks are valid.'
self.text.append(text)
self.writeFormattedText()
self.terminate()
# If a task argument appears in multiple nodes in the pipeline configuration file.
def repeatedArgumentInNode(self, task, argument, nodeIDs):
self.text.append('Task argument in multiple configuration file nodes.')
self.text.append('To avoid problems with merging pipeline graph nodes, a task argument is only permitted in a single node in the pipeline ' + \
'configuration file. The argument \'' + argument + '\' for task \'' + task + '\' appears in the following configuration file nodes:')
self.text.append('\t')
for nodeID in nodeIDs: self.text.append(nodeID)
self.text.append('\t')
self.text.append('These configuration file nodes should be compressed into a single node. If the argument is for an argument stub, ensure ' + \
'that the extensions are specified for linked arguments. Alternatively, task arguments can be defined in other configuration nodes as edges. ' + \
'Please see the documentation for further information on this subject.')
self.writeFormattedText()
self.terminate()
# If the attribute is not recognised in evaluate command block.
def invalidAttributeInEvaluateCommand(self, pipeline, ID, attribute, allowedAttributes):
self.text.append('Invalid attribute in nodes section of the configuration file for pipeline: ' + pipeline)
self.text.append('The \'nodes\' section of the configuration file for pipeline \'' + pipeline + '\' contains the node identified with the ID ' + \
'\'' + ID + '\'. This node contains the \'evaluate command\' dictionary containing the attribute \'' + attribute + '\'. This is an ' + \
'unrecognised attribute which is not permitted. The attributes allowed in the evaluate command dictionary are:')
self.text.append('\t')
# Create a sorted list of the allowed attributes.
allowed = []
for attribute in allowedAttributes: allowed.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(allowed):
self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]) + ', required = ' + str(allowedAttributes[attribute][1]))
self.text.append('\t')
self.text.append('Please remove or correct the invalid attribute in the configuration file.')
self.writeFormattedText()
self.terminate()
# A pipeline attribute is missing.
def missingAttributeInEvaluateCommand(self, pipeline, ID, attribute, allowedAttributes):
self.text.append('Missing attribute in nodes section of configuration file: ' + pipeline)
self.text.append('The \'nodes\' section of the configuration file for pipeline \'' + pipeline + '\' contains the node identified with the ' + \
'ID \'' + ID + '\'. This node contains the \'evaluate command\' dictionary, but is missing the attribute \'' + attribute + '\'. The ' + \
'following attributes are required in the \'evaluate commands\' section of the pipeline configuration file:')
self.text.append('\t')
# Create a sorted list of the required attributes.
requiredAttributes = []
for attribute in allowedAttributes:
if allowedAttributes[attribute][1]: requiredAttributes.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(requiredAttributes): self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]))
self.text.append('\t')
self.text.append('Please add the missing attribute to the configuration file.')
self.writeFormattedText()
self.terminate()
# If the attribute is not recognised in evaluate command values block.
def invalidAttributeInEvaluateCommandValues(self, pipeline, ID, attribute, allowedAttributes):
self.text.append('Invalid attribute in nodes section of the configuration file for pipeline: ' + pipeline)
self.text.append('The \'nodes\' section of the configuration file for pipeline \'' + pipeline + '\' contains the node identified with the ID ' + \
'\'' + ID + '\'. This node contains the \'evaluate command\' dictionary containing the \'add values\' field. Within this dictionary, the ' + \
'attribute \'' + attribute + '\' is defined, but this is an unrecognised attribute. The attributes allowed in the evaluate command, ' + \
' \'add values\' dictionary are:')
self.text.append('\t')
# Create a sorted list of the allowed attributes.
allowed = []
for attribute in allowedAttributes: allowed.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(allowed):
self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]) + ', required = ' + str(allowedAttributes[attribute][1]))
self.text.append('\t')
self.text.append('Please remove or correct the invalid attribute in the configuration file.')
self.writeFormattedText()
self.terminate()
# An attribute is missing in the evaluate commands, add values dictionary.
def missingAttributeInEvaluateCommandValues(self, pipeline, ID, attribute, allowedAttributes):
self.text.append('Missing attribute in nodes section of configuration file: ' + pipeline)
self.text.append('The \'nodes\' section of the configuration file for pipeline \'' + pipeline + '\' contains the node identified with the ' + \
'ID \'' + ID + '\'. This node contains the \'evaluate command\' dictionary, which in turn contains the \'add values\' dictionary. The ' + \
'attribute \'' + attribute + '\' is required in this dictionary, but is missing. The following attributes are required in the \'add values\'' + \
' dictionary within the \'evaluate commands\' section of the pipeline configuration file:')
self.text.append('\t')
# Create a sorted list of the required attributes.
requiredAttributes = []
for attribute in allowedAttributes:
if allowedAttributes[attribute][1]: requiredAttributes.append(attribute)
# Add the attributes to the text to be written along with the expected type.
for attribute in sorted(requiredAttributes): self.text.append(attribute + ':\t' + str(allowedAttributes[attribute][0]))
self.text.append('\t')
self.text.append('Please add the missing attribute to the configuration file.')
self.writeFormattedText()
self.terminate()
# If a task in the evaluate command, add values section is invalid.
def unknownTaskInEvaluateCommandValues(self, pipeline, ID, task):
self.text.append('Unknown task in evaluate command section in the configuration file: ' + pipeline)