Skip to content

Commit

Permalink
Rename taskPath to task.path
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 12, 2021
1 parent 5421d4b commit e712a56
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/combination/list/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const getCombinationsProduct = function ({ tasks, inputs, systemId }) {
throw new UserError(`Please specify some "tasks".`)
}

return tasks.map(({ id, taskPath, runner }) => ({
dimensions: { task: { id, taskPath }, runner, system: { id: systemId } },
return tasks.map(({ id, path, runner }) => ({
dimensions: { task: { id, path }, runner, system: { id: systemId } },
inputs,
stats: {},
}))
Expand Down
21 changes: 8 additions & 13 deletions src/combination/tasks/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,25 @@ import { measureCombinations } from '../../run/measure/main.js'
// to several tasks competing for optimization in the same process
// So we spawn a single process for all of them, to retrieve the task and step
// identifiers.
export const findTasks = async function (taskPath, cwd, runner) {
await validateTask(taskPath)
export const findTasks = async function (path, cwd, runner) {
await validateTask(path)

try {
const [{ taskIds: ids }] = await measureCombinations(
[
{
dimensions: { task: { taskPath }, runner },
inputs: [],
},
],
[{ dimensions: { task: { path }, runner }, inputs: [] }],
{ precisionTarget: 0, cwd, previewState: { quiet: true }, stage: 'init' },
)
validateDuplicateTaskIds(ids)
return ids.map((id) => ({ id, taskPath, runner }))
return ids.map((id) => ({ id, path, runner }))
} catch (error) {
error.message = `In tasks file "${taskPath}" (runner "${runner.id}")\n${error.message}`
error.message = `In tasks file "${path}" (runner "${runner.id}")\n${error.message}`
throw error
}
}

const validateTask = async function (taskPath) {
if (!(await isFile(taskPath))) {
throw new UserError(`Tasks file does not exist: ${taskPath}`)
const validateTask = async function (path) {
if (!(await isFile(path))) {
throw new UserError(`Tasks file does not exist: ${path}`)
}
}

Expand Down
12 changes: 9 additions & 3 deletions src/run/measure/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@ export const runEvents = async function ({ combination, ...args }) {
const startCombination = async function (
{
dimensions: {
task: { id, taskPath },
task: { id, path },
runner: { runnerConfig },
},
inputs,
},
server,
) {
const inputsA = toInputsObj(inputs)
const inputsObj = toInputsObj(inputs)
const { tasks: taskIds } = await sendAndReceive(
{ event: 'start', runnerConfig, taskId: id, taskPath, inputs: inputsA },
{
event: 'start',
runnerConfig,
taskId: id,
taskPath: path,
inputs: inputsObj,
},
server,
)
return taskIds
Expand Down

0 comments on commit e712a56

Please sign in to comment.