Skip to content

Commit

Permalink
Merge pull request #54 from ydb-platform/php-version
Browse files Browse the repository at this point in the history
Php version
  • Loading branch information
asmyasnikov authored May 17, 2024
2 parents f8e9068 + 86fbb2c commit 78fec2f
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 34 deletions.
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ inputs:
grafana_dashboard:
description: 'Grafana service dashboard'
required: true
grafana_dashboard_width:
description: 'Grafana service screenshot dashboard width'
required: false
grafana_dashboard_height:
description: 'Grafana service screenshot dashboard height'
required: false
ydb_version:
description: 'YDB version to run SLO over: use docker tag or `newest`'
required: true
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/errorScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function createError(
// run command
callKubernetesAsync(kubeCommand),
// annotate
annotate(name),
annotate(name, core.getInput('grafana_dashboard') || '7CzMl5t4k'),
// wait till next
new Promise(resolve => {
setTimeout(resolve, timeBetweenS * 1000)
Expand Down
12 changes: 6 additions & 6 deletions src/grafanaScreenshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,25 @@ export async function grafanaScreenshot(
)
core.debug('Write picture to FS')

const pictureName = `${workloadId}-${new Date().valueOf()}.png`
const fileName = `${workloadId}-${new Date().valueOf()}.png`

// write image to fs
await writeFile(`${pictureName}.png`, Buffer.from(imageb64, 'base64'))
await writeFile(fileName, Buffer.from(imageb64, 'base64'))

// upload
await callAsync(
`aws s3 --endpoint-url=${s3Endpoint} cp ./${pictureName}.png "s3://${path.join(
`aws s3 --endpoint-url=${s3Endpoint} cp ./${fileName} "s3://${path.join(
s3Folder,
pictureName
fileName
)}"`
)

// delete
await callAsync(`rm ${pictureName}.png`)
await callAsync(`rm ${fileName}`)

// return name
const fullPictureUri =
'https://' + path.join(s3Endpoint.split('//')[1], s3Folder, pictureName)
'https://' + path.join(s3Endpoint.split('//')[1], s3Folder, fileName)
core.debug('fullPictureUri: ' + fullPictureUri)
return `${fullPictureUri}`
}
Expand Down
8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ async function main(): Promise<void> {
timeBetweenPhases,
shutdownTime,
grafanaDomain,
grafanaDashboard
grafanaDashboard,
grafanaDashboardWidth,
grafanaDashboardHeight
} = parseArguments()

core.debug(`Setting up OctoKit`)
Expand Down Expand Up @@ -217,7 +219,9 @@ async function main(): Promise<void> {
workloads[i].id,
timings.startTime,
timings.endTime,
grafanaDashboard
grafanaDashboard,
grafanaDashboardWidth,
grafanaDashboardHeight
)
const comment = `
:volcano: Here are results of SLO test for **${
Expand Down
10 changes: 9 additions & 1 deletion src/parseArguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export function parseArguments() {
const s3Folder = core.getInput('s3_images_folder')
const grafanaDomain = core.getInput('grafana_domain')
const grafanaDashboard = core.getInput('grafana_dashboard') || '7CzMl5t4k'
const grafanaDashboardWidth = Number(
core.getInput('grafana_dashboard_width') || '1500'
)
const grafanaDashboardHeight = Number(
core.getInput('grafana_dashboard_height') || '1700'
)

let ydbVersion = core.getInput('ydb_version')

Expand Down Expand Up @@ -79,7 +85,9 @@ export function parseArguments() {
timeBetweenPhases,
shutdownTime,
grafanaDomain,
grafanaDashboard
grafanaDashboard,
grafanaDashboardWidth,
grafanaDashboardHeight
}
})
}
Expand Down
49 changes: 26 additions & 23 deletions src/workload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,34 @@ export function runWorkload(
kubectl => `${kubectl} apply -f - <<EOF\n${workloadManifest}\nEOF`
))
)

await withTimeout(
options.timeoutMins,
15,
`Workload ${options.id} ${command}`,
async () => {
const status = JSON.parse(
await callKubernetesAsync(
`get job/${options.id}-wl-${command} -o=jsonpath={.status}`

try {
await withTimeout(
options.timeoutMins,
15,
`Workload ${options.id} ${command}`,
async () => {
const status = JSON.parse(
await callKubernetesAsync(
`get job/${options.id}-wl-${command} -o=jsonpath={.status}`
)
)
)
core.debug('Workload status check: ' + JSON.stringify(status))
if (status.failed) {
const msg = `Workload ${options.id} ${command} failed`
core.info(msg)
await saveLogs(options.id, command)
throw new Error(msg)
core.debug('Workload status check: ' + JSON.stringify(status))
if (status.failed) {
const msg = `Workload ${options.id} ${command} failed`
core.info(msg)
await saveLogs(options.id, command)
throw new Error(msg)
}
return (status.complete || status.succeeded);
}
return status.complete || status.succeeded
}
)
const endTime = new Date()
// print logs
await saveLogs(options.id, command)
return {startTime, endTime}
)
} finally {
const endTime = new Date()
// print logs
await saveLogs(options.id, command)
return {startTime, endTime}
}
})
}

Expand Down

0 comments on commit 78fec2f

Please sign in to comment.