Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 12, 2021
1 parent 60ee35b commit 671e9f2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/combination/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
// Values can be any JSON type. When using objects, variations must be used
// to avoid ambiguity.
// This can be converted from/to an object and an array shape.
export const toInputsArr = function (inputs) {
export const toInputsList = function (inputs) {
return Object.entries(inputs).map(getInput)
}

const getInput = function ([inputId, inputValue]) {
return { inputId, inputValue }
}

export const toInputsObj = function (inputsList) {
export const toInputsObject = function (inputsList) {
return Object.assign({}, ...inputsList.map(getInputPair))
}

Expand Down
12 changes: 6 additions & 6 deletions src/combination/list/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UserError } from '../../error/main.js'
import { selectCombinations } from '../../select/main.js'
import { toInputsArr } from '../inputs.js'
import { toInputsList } from '../inputs.js'
import { listTasks } from '../tasks/main.js'

import { validateCombinationsIds } from './validate_ids.js'
Expand All @@ -14,14 +14,14 @@ export const listCombinations = async function ({
cwd,
}) {
const tasks = await listTasks(runners, cwd)
const inputsA = toInputsArr(inputs)
const inputsList = toInputsList(inputs)

const combinations = getCombinationsProduct({
tasks,
inputs: inputsA,
inputsList,
systemId,
})
validateCombinationsIds(combinations, inputsA)
validateCombinationsIds(combinations, inputsList)

const combinationsA = selectCombinations(combinations, select)
return combinationsA
Expand All @@ -30,15 +30,15 @@ export const listCombinations = async function ({
// Get cartesian product of all combinations
// `taskPath` is not set in `dimensions.task.path` because it used by the `init`
// stage before task dimension ids are known.
const getCombinationsProduct = function ({ tasks, inputs, systemId }) {
const getCombinationsProduct = function ({ tasks, inputsList, systemId }) {
if (tasks.length === 0) {
throw new UserError(`Please specify some "tasks".`)
}

return tasks.map(({ id, taskPath, runner }) => ({
dimensions: { task: { id }, runner, system: { id: systemId } },
taskPath,
inputs,
inputsList,
stats: {},
}))
}
4 changes: 2 additions & 2 deletions src/combination/list/validate_ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { getCombinationsIds } from '../ids.js'
import { getUserIds } from './user_ids.js'

// Validate combination identifiers.
export const validateCombinationsIds = function (combinations, inputs) {
const userIds = getUserIds(combinations, inputs)
export const validateCombinationsIds = function (combinations, inputsList) {
const userIds = getUserIds(combinations, inputsList)
userIds.forEach(validateUserIds)

const combinationsIds = getCombinationsIds(combinations)
Expand Down
2 changes: 1 addition & 1 deletion src/combination/tasks/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const findTasks = async function (taskPath, cwd, runner) {

try {
const [{ taskIds: ids }] = await measureCombinations(
[{ dimensions: { runner }, taskPath, inputs: [] }],
[{ dimensions: { runner }, taskPath, inputsList: [] }],
{ precisionTarget: 0, cwd, previewState: { quiet: true }, stage: 'init' },
)
validateDuplicateTaskIds(ids)
Expand Down
6 changes: 3 additions & 3 deletions src/run/measure/events.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toInputsObj } from '../../combination/inputs.js'
import { toInputsObject } from '../../combination/inputs.js'
import { updateDescription, END_DESCRIPTION } from '../preview/description.js'
import { sendAndReceive } from '../process/ipc.js'

Expand Down Expand Up @@ -28,11 +28,11 @@ const startCombination = async function (
runner: { config },
},
taskPath,
inputs: inputsList,
inputsList,
},
server,
) {
const inputs = toInputsObj(inputsList)
const inputs = toInputsObject(inputsList)
const { tasks: taskIds } = await sendAndReceive(
{
event: 'start',
Expand Down

0 comments on commit 671e9f2

Please sign in to comment.