Skip to content

Commit

Permalink
art: Format - ran format-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aybruhm committed Dec 6, 2023
1 parent 9d9c981 commit b678f8f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,14 @@ const ABTestingEvaluationTable: React.FC<EvaluationTableProps> = ({
count: number = 1,
showNotification: boolean = true,
maxRetryCount: number,
retryDelay: number
retryDelay: number,
) => {
let retryCount = 0
while (retryCount <= maxRetryCount) {
try {
await runEvaluation(id, count, showNotification)
// If the evaluation is successful, break out of the retry loop
break;
break
} catch (error) {
console.error(`Error in evaluation for ID ${id}, retrying...`)
retryCount++
Expand All @@ -238,22 +238,28 @@ const ABTestingEvaluationTable: React.FC<EvaluationTableProps> = ({
}
}

const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms))
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))

const runAllEvaluations = async () => {
const batchSize = 10 // Number of evaluations to make in each batch
const maxRetryCount = 3 // Maximum number of times to retry a failed evaluation
const retryDelay = 3000 // Delay before retrying a failed evaluation (in milliseconds)
const delayBetweenBatches = 5000 // Delay between batches (in milliseconds)

setEvaluationStatus(EvaluationFlow.EVALUATION_STARTED)
const runBatch = async (startIdx) => {
const endIdx = Math.min(startIdx + batchSize, rows.length)
const batchPromises = []

for (let index = startIdx; index < endIdx; index++) {
batchPromises.push(
runEvaluationWithRetry(rows[index].id!, rows.length - 1, false, maxRetryCount, retryDelay)
runEvaluationWithRetry(
rows[index].id!,
rows.length - 1,
false,
maxRetryCount,
retryDelay,
),
)
}

Expand All @@ -263,7 +269,7 @@ const ABTestingEvaluationTable: React.FC<EvaluationTableProps> = ({
console.error("Error in batch:", err)
// Handle the failure of the entire batch (if needed)
}

// Schedule the next batch with a delay
const nextBatchStartIdx = endIdx
if (nextBatchStartIdx < rows.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ const SingleModelEvaluationTable: React.FC<EvaluationTableProps> = ({
count: number = 1,
showNotification: boolean = true,
maxRetryCount: number,
retryDelay: number
retryDelay: number,
) => {
let retryCount = 0
while (retryCount <= maxRetryCount) {
try {
await runEvaluation(id, count, showNotification)
// If the evaluation is successful, break out of the retry loop
break;
break
} catch (error) {
console.error(`Error in evaluation for ID ${id}, retrying...`)
retryCount++
Expand All @@ -240,22 +240,28 @@ const SingleModelEvaluationTable: React.FC<EvaluationTableProps> = ({
}
}

const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms))
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))

const runAllEvaluations = async () => {
const batchSize = 10 // Number of evaluations to make in each batch
const maxRetryCount = 3 // Maximum number of times to retry a failed evaluation
const retryDelay = 3000 // Delay before retrying a failed evaluation (in milliseconds)
const delayBetweenBatches = 5000 // Delay between batches (in milliseconds)

setEvaluationStatus(EvaluationFlow.EVALUATION_STARTED)
const runBatch = async (startIdx) => {
const endIdx = Math.min(startIdx + batchSize, rows.length)
const batchPromises = []

for (let index = startIdx; index < endIdx; index++) {
batchPromises.push(
runEvaluationWithRetry(rows[index].id!, rows.length - 1, false, maxRetryCount, retryDelay)
runEvaluationWithRetry(
rows[index].id!,
rows.length - 1,
false,
maxRetryCount,
retryDelay,
),
)
}

Expand All @@ -265,7 +271,7 @@ const SingleModelEvaluationTable: React.FC<EvaluationTableProps> = ({
console.error("Error in batch:", err)
// Handle the failure of the entire batch (if needed)
}

// Schedule the next batch with a delay
const nextBatchStartIdx = endIdx
if (nextBatchStartIdx < rows.length) {
Expand All @@ -281,8 +287,6 @@ const SingleModelEvaluationTable: React.FC<EvaluationTableProps> = ({
runBatch(0)
}



const runEvaluation = async (
id: string,
count: number = 1,
Expand Down
10 changes: 5 additions & 5 deletions agenta-web/src/components/Playground/Views/TestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,17 @@ const App: React.FC<TestViewProps> = ({inputParams, optParams, variant, isChatVa
} else {
console.error(`Max retry count reached for request ${index + 1}.`)
setResultForIndex(
`Error in request ${index + 1} after ${maxRetryCount} retries: ${getErrorMessage(error)}`,
index
`Error in request ${
index + 1
} after ${maxRetryCount} retries: ${getErrorMessage(error)}`,
index,
)
}
}
}
}

const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))


const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))

const handleAddRow = () => {
setTestList([...testList, {_id: randString(6)}])
Expand Down

0 comments on commit b678f8f

Please sign in to comment.