Commit d4bcff2
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 `RunOptAlias` 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 d4bcff2
2 files changed
+88
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
889 | 893 | | |
890 | 894 | | |
891 | 895 | | |
| |||
896 | 900 | | |
897 | 901 | | |
898 | 902 | | |
| 903 | + | |
899 | 904 | | |
900 | 905 | | |
901 | 906 | | |
| |||
987 | 992 | | |
988 | 993 | | |
989 | 994 | | |
| 995 | + | |
990 | 996 | | |
991 | 997 | | |
992 | 998 | | |
| |||
1016 | 1022 | | |
1017 | 1023 | | |
1018 | 1024 | | |
1019 | | - | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
1020 | 1030 | | |
1021 | 1031 | | |
1022 | 1032 | | |
| |||
1031 | 1041 | | |
1032 | 1042 | | |
1033 | 1043 | | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
1034 | 1062 | | |
1035 | 1063 | | |
1036 | 1064 | | |
| |||
1143 | 1171 | | |
1144 | 1172 | | |
1145 | 1173 | | |
| 1174 | + | |
| 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 | + | |
1146 | 1203 | | |
1147 | 1204 | | |
1148 | | - | |
| 1205 | + | |
1149 | 1206 | | |
1150 | 1207 | | |
1151 | 1208 | | |
| |||
1156 | 1213 | | |
1157 | 1214 | | |
1158 | 1215 | | |
| 1216 | + | |
1159 | 1217 | | |
1160 | 1218 | | |
1161 | 1219 | | |
| |||
1166 | 1224 | | |
1167 | 1225 | | |
1168 | 1226 | | |
1169 | | - | |
1170 | | - | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
1171 | 1231 | | |
1172 | 1232 | | |
1173 | 1233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
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 | + | |
581 | 605 | | |
582 | 606 | | |
583 | 607 | | |
| |||
0 commit comments