Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logic for Parallel option with num_machines=1 #4102

Merged
merged 1 commit into from
Nov 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def setupEnv() {
env.DOCKER_REGISTRY_DIR = params.DOCKER_REGISTRY_DIR ? params.DOCKER_REGISTRY_DIR : ""
env.DOCKER_REGISTRY_URL_CREDENTIAL_ID = params.DOCKER_REGISTRY_URL_CREDENTIAL_ID ? params.DOCKER_REGISTRY_URL_CREDENTIAL_ID : ""
ITERATIONS = params.ITERATIONS ? "${params.ITERATIONS}".toInteger() : 1
NUM_MACHINES = params.NUM_MACHINES ? params.NUM_MACHINES.toInteger() : 1

if (JOB_NAME.contains("Grinder")) {
def currentDate = new Date()
Expand Down Expand Up @@ -152,7 +153,7 @@ def setupParallelEnv() {
def UPSTREAM_TEST_JOB_NUMBER = ""

if (params.PARALLEL == "NodesByIterations") {
childJobNum = params.NUM_MACHINES ? params.NUM_MACHINES.toInteger() : 1
childJobNum = NUM_MACHINES
// limit childJobNum
if (childJobNum > 20) {
echo "Due to the limited machines, NUM_MACHINES can only be set up to 20. Current NUM_MACHINES is ${NUM_MACHINES}."
Expand Down Expand Up @@ -826,23 +827,13 @@ def testBuild() {
addGrinderLink()
// prepare environment and compile test projects
if( params.PARALLEL && params.PARALLEL != "None" ) {
setupParallelEnv()
} else {
try {
//ToDo: temporary workaround for jck test parallel runs
// until build.xml is added into each subfolder
if( env.BUILD_LIST.startsWith('jck/')) {
def temp = env.BUILD_LIST
env.BUILD_LIST = "jck"
buildTest()
env.BUILD_LIST = temp
} else {
buildTest()
}
runTest()
} finally {
post("${env.BUILD_LIST}")
if ((params.PARALLEL == "NodesByIterations" || params.PARALLEL == "Dynamic") && NUM_MACHINES == 1) {
testExecution()
} else {
setupParallelEnv()
}
} else {
testExecution()
}
} finally {
// Terminate any left over java processes
Expand All @@ -864,6 +855,24 @@ def testBuild() {
}
}

def testExecution() {
try {
//ToDo: temporary workaround for jck test parallel runs
// until build.xml is added into each subfolder
if( env.BUILD_LIST.startsWith('jck/')) {
def temp = env.BUILD_LIST
env.BUILD_LIST = "jck"
buildTest()
env.BUILD_LIST = temp
} else {
buildTest()
}
runTest()
} finally {
post("${env.BUILD_LIST}")
}
}

def terminateJavaProcesses() {
// Attempt up to 30 times or until no more Java processes spawn...
for(int i=0; i<30; i++) {
Expand Down Expand Up @@ -1100,7 +1109,7 @@ def addFailedTestsGrinderLink(paths=""){
}

def run_parallel_tests() {
if (params.PARALLEL && params.PARALLEL != "None") {
if (params.PARALLEL && params.PARALLEL != "None" && NUM_MACHINES > 1) {
stage ("Parallel Tests") {
def childJobs = parallel parallel_tests
node {
Expand Down