@@ -142,65 +142,43 @@ def build_task_config(
142142 arch : str = None ,
143143 mode : SubmissionMode = None ,
144144) -> dict :
145- if task is None :
146- assert mode == SubmissionMode .SCRIPT
147- # TODO detect language
148- lang = "py"
149-
150- config = {
151- "lang" : lang ,
152- "arch" : arch ,
153- }
154-
155- eval_name = {"py" : "eval.py" , "cu" : "eval.cu" }[lang ]
156-
157- if lang == "py" :
158- config ["main" ] = "eval.py"
159-
145+ all_files = {}
146+ for n , c in task .files .items ():
147+ if c == "@SUBMISSION@" :
148+ all_files [n ] = submission_content
149+ else :
150+ all_files [n ] = c
151+
152+ common = {
153+ "lang" : task .lang .value ,
154+ "arch" : arch ,
155+ "benchmarks" : task .benchmarks ,
156+ "tests" : task .tests ,
157+ "mode" : mode .value ,
158+ "test_timeout" : task .test_timeout ,
159+ "benchmark_timeout" : task .benchmark_timeout ,
160+ "ranked_timeout" : task .ranked_timeout ,
161+ "ranking_by" : task .ranking_by .value ,
162+ "seed" : task .seed ,
163+ }
164+
165+ if task .lang == Language .Python :
160166 return {
161- ** config ,
162- "sources" : {
163- eval_name : submission_content ,
164- },
167+ "main" : task .config .main ,
168+ "sources" : all_files ,
169+ ** common ,
165170 }
166171 else :
167- all_files = {}
168- for n , c in task .files .items ():
169- if c == "@SUBMISSION@" :
170- all_files [n ] = submission_content
172+ sources = {}
173+ headers = {}
174+ for f in all_files :
175+ if f in task .config .sources :
176+ sources [f ] = all_files [f ]
171177 else :
172- all_files [n ] = c
173-
174- common = {
175- "lang" : task .lang .value ,
176- "arch" : arch ,
177- "benchmarks" : task .benchmarks ,
178- "tests" : task .tests ,
179- "mode" : mode .value ,
180- "test_timeout" : task .test_timeout ,
181- "benchmark_timeout" : task .benchmark_timeout ,
182- "ranked_timeout" : task .ranked_timeout ,
183- "ranking_by" : task .ranking_by .value ,
184- "seed" : task .seed ,
185- }
178+ headers [f ] = all_files [f ]
186179
187- if task .lang == Language .Python :
188- return {
189- "main" : task .config .main ,
190- "sources" : all_files ,
191- ** common ,
192- }
193- else :
194- sources = {}
195- headers = {}
196- for f in all_files :
197- if f in task .config .sources :
198- sources [f ] = all_files [f ]
199- else :
200- headers [f ] = all_files [f ]
201-
202- return {
203- "sources" : sources ,
204- "headers" : headers ,
205- "include_dirs" : task .config .include_dirs ,
206- }
180+ return {
181+ "sources" : sources ,
182+ "headers" : headers ,
183+ "include_dirs" : task .config .include_dirs ,
184+ }
0 commit comments