Include runtime in execution query

This commit is contained in:
Omar Brikaa 2022-06-28 17:29:17 +02:00
parent 09eb9e4d90
commit 8969ac96fc
1 changed files with 8 additions and 2 deletions

View File

@ -51,6 +51,7 @@ function get_job(job_info, available_runtimes) {
let {
language,
version,
runtime,
args,
stdin,
files,
@ -80,15 +81,20 @@ function get_job(job_info, available_runtimes) {
}
}
const has_runtime =
job_info.has_own_property('runtime') && job_info.runtime !== null;
const rt = available_runtimes.find(
rt =>
[...rt.aliases, rt.language].includes(language) &&
(version === rt.version || version === '*')
(version === rt.version || version === '*') &&
(!has_runtime || runtime === rt.runtime)
);
if (rt === undefined) {
const runtime_str = has_runtime ? `${runtime}-` : '';
return reject({
message: `${language}-${version} runtime is unknown`,
message: `${runtime_str}${language}-${version} runtime is unknown`,
});
}