Commit 3fece336 authored by mchrusci's avatar mchrusci Committed by Robert Kimball

[ONNX CI] CI improvements (#1820)

* Added Jenkins Job No and URL

* Update prepare_environment.sh

- clone onnx models
- remove wheel build artifacts

* Link onnx models

* Update Jenkinsfile

- Only send email on fail,
- Change ONNX branch warning to info field
- Disable cloning after tox tests

* Update prepare_environment.sh

- Added comments
- link ONNX models directory

* Update cleanup
parent bf74de2f
......@@ -24,7 +24,7 @@ DOCKER_CONTAINER_NAME = "jenkins_${PROJECT_NAME}_ci"
NGRAPH_GIT_ADDRESS = "https://www.github.com/NervanaSystems/ngraph.git"
ONNX_GIT_ADDRESS = "https://www.github.com/NervanaSystems/ngraph-onnx.git"
JENKINS_GITHUB_CREDENTIAL_ID = "6887a177-8c4d-4fe9-9c3b-fcd71b22bfba"
WARNING = ""
ONNX_BRANCH = "$ghprbSourceBranch"
def CloneRepository(String jenkins_github_credential_id, String ngraph_git_address, String onnx_git_address) {
stage('Clone Repos') {
......@@ -36,9 +36,9 @@ def CloneRepository(String jenkins_github_credential_id, String ngraph_git_addre
url: "${onnx_git_address}"]]])
}
catch (Exception e) {
WARNING = "WARNING! Failed to clone ngraph-onnx branch $ghprbSourceBranch ! Falling back to master."
ONNX_BRANCH = "master"
sh """
echo ${WARNING}
echo "WARNING! Failed to clone ngraph-onnx branch $ghprbSourceBranch ! Falling back to master."
"""
checkout([$class: 'GitSCM',
branches: [[name: "master"]],
......@@ -100,10 +100,6 @@ def RunToxTests(configurationMaps) {
sh """
NGRAPH_WHL=\$(docker exec ${configMap["dockerContainerName"]} find /root/ngraph/python/dist/ -name 'ngraph*.whl')
docker exec -e TOX_INSTALL_NGRAPH_FROM=\${NGRAPH_WHL} ${configMap["dockerContainerName"]} tox -c /root/
mkdir -p ${HOME}/ONNX_CI/onnx_models/
if [ -e ${WORKDIR}/.onnx ]; then
docker cp ${configMap["dockerContainerName"]}:/root/.onnx/ ~/ONNX_CI/onnx_models/
fi
"""
}
UTILS.CreateStage("Run_tox_tests", runToxTestsMethod, configurationMaps)
......@@ -114,7 +110,6 @@ def Cleanup(configurationMaps) {
sh """
cd ${HOME}/ONNX_CI
./docker.sh chmod --container_name=${configMap["dockerContainerName"]} --directory="/logs" --options="-R 777" || true
docker exec ${configMap["dockerContainerName"]} rm -rf /root/* || true
./docker.sh stop --container_name=${configMap["dockerContainerName"]} || true
./docker.sh remove --container_name=${configMap["dockerContainerName"]} || true
./docker.sh clean_up || true
......@@ -132,21 +127,20 @@ def Notify() {
])
String notifyPeople = "$ghprbPullAuthorEmail, $ghprbActualCommitAuthorEmail"
Closure notifyMethod = { configMap ->
if(currentBuild.result != "FAILURE") {
currentBuild.result = "SUCCESS"
}
if(currentBuild.result == "FAILURE" || WARNING != "") {
if(currentBuild.result == "FAILURE") {
emailext (
subject: "NGraph-Onnx CI: NGraph PR $ghprbPullId $currentBuild.result!",
body: """
<table style="width:100%">
<tr><td>${WARNING}</td></tr>
<tr><td>Status:</td> <td>${currentBuild.result}</td></tr>
<tr><td>Repository</td> <td>$ghprbGhRepository</td></tr>
<tr><td>Branch:</td> <td>$ghprbSourceBranch</td></tr>
<tr><td>Jenkins Job No:</td> <td>$BUILD_NUMBER</td></tr>
<tr><td>Jenkins Job Link:</td> <td>$BUILD_URL</td></tr>
<tr><td>Pull Request:</td> <td>$ghprbPullId</td></tr>
<tr><td>Commit SHA:</td> <td>$ghprbActualCommit</td></tr>
<tr><td>Link:</td> <td>$ghprbPullLink</td></tr>
<tr><td>nGraph-ONNX Branch:</td> <td>${ONNX_BRANCH}</td></tr>
</table>
""",
to: "${notifyPeople}"
......
......@@ -22,6 +22,7 @@ set -e
NGRAPH_CACHE_DIR="/home"
function check_cached_ngraph() {
set -x
# if no ngraph in /home - clone
if [ ! -e "${NGRAPH_CACHE_DIR}/ngraph" ]; then
cd /home/
......@@ -30,6 +31,7 @@ function check_cached_ngraph() {
}
function build_ngraph() {
set -x
# directory containing ngraph repo
local ngraph_directory="$1"
local func_parameters="$2"
......@@ -73,16 +75,18 @@ function build_ngraph() {
export PYBIND_HEADERS_PATH="${ngraph_directory}/ngraph/python/pybind11"
export NGRAPH_CPP_BUILD_PATH="${ngraph_directory}/ngraph_dist"
python3 setup.py bdist_wheel
# Clean build artifacts
rm -rf "${ngraph_directory}/ngraph/python/_pyngraph.cpython* ${ngraph_directory}/ngraph/python/build"
rm -rf "${ngraph_directory}/ngraph_dist"
return 0
}
# Link Onnx models
mkdir -p /home/onnx_models/.onnx
ln -s /home/onnx_models/.onnx /root/.onnx
# Copy stored nGraph master and use it to build PR branch
if ! build_ngraph "/root" "USE_CACHED"; then
build_ngraph "${NGRAPH_CACHE_DIR}" "UPDATE REBUILD"
build_ngraph "/root" "REBUILD USE_CACHED"
fi
# Copy Onnx models
if [ -d /home/onnx_models/.onnx ]; then
rsync -avhz /home/onnx_models/.onnx /root/ngraph-onnx/
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment