Commit 2d002ec
Allow aliases for run_opt (meta-pytorch#1141)
Summary:
Lets allow aliases for a runopt. This will give downstream users to have multiple ways of accessing the same runopt.
* Introduce new class for `runopt.alias` which is used to expand on adding aliases to a runopt.
* Add a new dict to maintain alias to key values that can be used by `opt.get(name)`
* Modify add() to accept list as well, build out the aliases list and modify the previously created dict to fill in alias to primary_key values.
* Modify resolve() to check if a different alias is already used in cfg i.e if the "jobPriority" and "job_priority" are aliases for the same one, we don't allow for both to be present in the cfg.
* Modify get to look at the alias to primary_key dict as well.
Differential Revision: D841578701 parent b376e8c commit 2d002ec
2 files changed
+111
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
895 | 898 | | |
896 | 899 | | |
897 | 900 | | |
898 | 901 | | |
| 902 | + | |
899 | 903 | | |
900 | 904 | | |
901 | 905 | | |
| |||
987 | 991 | | |
988 | 992 | | |
989 | 993 | | |
| 994 | + | |
990 | 995 | | |
991 | 996 | | |
992 | 997 | | |
| |||
1014 | 1019 | | |
1015 | 1020 | | |
1016 | 1021 | | |
1017 | | - | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
1018 | 1026 | | |
1019 | | - | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
1020 | 1032 | | |
1021 | 1033 | | |
1022 | 1034 | | |
| |||
1031 | 1043 | | |
1032 | 1044 | | |
1033 | 1045 | | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1034 | 1064 | | |
1035 | 1065 | | |
1036 | 1066 | | |
| |||
1050 | 1080 | | |
1051 | 1081 | | |
1052 | 1082 | | |
1053 | | - | |
| 1083 | + | |
1054 | 1084 | | |
1055 | 1085 | | |
1056 | 1086 | | |
| |||
1143 | 1173 | | |
1144 | 1174 | | |
1145 | 1175 | | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
1146 | 1205 | | |
1147 | 1206 | | |
1148 | | - | |
| 1207 | + | |
1149 | 1208 | | |
1150 | 1209 | | |
1151 | 1210 | | |
| |||
1156 | 1215 | | |
1157 | 1216 | | |
1158 | 1217 | | |
| 1218 | + | |
1159 | 1219 | | |
1160 | 1220 | | |
1161 | 1221 | | |
| |||
1166 | 1226 | | |
1167 | 1227 | | |
1168 | 1228 | | |
1169 | | - | |
1170 | | - | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1171 | 1233 | | |
1172 | 1234 | | |
1173 | 1235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
578 | 578 | | |
579 | 579 | | |
580 | 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 | + | |
581 | 624 | | |
582 | 625 | | |
583 | 626 | | |
| |||
0 commit comments