You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/01/08 20:13:52 UTC

[GitHub] kalyc closed pull request #13270: Add Jenkins setup for running nightly tests on examples

kalyc closed pull request #13270: Add Jenkins setup for running nightly tests on examples
URL: https://github.com/apache/incubator-mxnet/pull/13270
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh
index ad9bbe50f98..20628a3115d 100755
--- a/ci/docker/runtime_functions.sh
+++ b/ci/docker/runtime_functions.sh
@@ -1211,6 +1211,19 @@ nightly_tutorial_test_ubuntu_python2_gpu() {
     nosetests-3.4 $NOSE_TIMER_ARGUMENTS --with-xunit --xunit-file nosetests_tutorials.xml test_tutorials.py --nologcapture
 }
 
+nightly_example_test_ubuntu_python3_gpu() {
+    set -ex
+    export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
+    cd /work/mxnet/tests/examples
+    nosetests-3.4 --with-xunit --xunit-file nosetests_examples.xml test_examples.py --nologcapture
+}
+
+nightly_example_test_ubuntu_python2_gpu() {
+    set -ex
+    export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
+    cd /work/mxnet/tests/examples
+    nosetests-2.7 --with-xunit --xunit-file nosetests_examples.xml test_examples.py --nologcapture
+}
 
 # Deploy
 
diff --git a/tests/examples/test_examples.py b/tests/examples/test_examples.py
new file mode 100644
index 00000000000..a09cade45fa
--- /dev/null
+++ b/tests/examples/test_examples.py
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# pylint: disable=no-member, too-many-locals, too-many-branches, no-self-use, broad-except, lost-exception, too-many-nested-blocks, too-few-public-methods, invalid-name
+
+"""
+    This file tests and ensures that the examples run out of the box.
+
+"""
+import logging
+import os
+import shutil
+import subprocess
+
+
+def _run_command(test_name, command):
+    """Runs the script using command
+
+    Parameters
+    ----------
+    command : list of str
+        the command that needs to be run in form of list
+        Example : ['ls', '-l']
+
+    Returns
+    -------
+    True if there are no warnings or errors.
+    """
+    errors = []
+    logging.info("Running test for {}".format(test_name))
+    try:
+        subprocess.check_call(command)
+    except Exception as err:
+        errors.append(str(err))
+        if errors:
+            logging.error('\n'.join(errors))
+            return False
+    return True
+
+
+def test_cifar_default():
+    example_dir = os.path.join(os.getcwd(), '..', '..', '..', '..', 'example', 'image-classification')
+    temp_dir = 'tmpdir'
+    example_name = 'test_cifar10'
+    working_dir = os.path.join(*([temp_dir] + [example_name]))
+    logging.info("Cleaning and setting up temp directory '{}'".format(working_dir))
+    shutil.rmtree(temp_dir, ignore_errors=True)
+    if not os.path.isdir(working_dir):
+        os.makedirs(working_dir)
+    os.chdir(working_dir)
+    assert _run_command(example_name, ['python', os.path.join(example_dir, 'train_cifar10.py'), '--num-epochs', '1'])
diff --git a/tests/nightly/JenkinsfileForBinaries b/tests/nightly/JenkinsfileForBinaries
index eb003097f61..f086123b8ed 100755
--- a/tests/nightly/JenkinsfileForBinaries
+++ b/tests/nightly/JenkinsfileForBinaries
@@ -106,6 +106,22 @@ core_logic: {
           utils.docker_run('ubuntu_nightly_gpu', 'nightly_tutorial_test_ubuntu_python3_gpu', true)
         }
       }
+    },
+    'Examples: Python2': {
+      node(NODE_LINUX_GPU) {
+        ws('workspace/examples-test-python2') {
+          utils.unpack_and_init('gpu', mx_lib)
+          utils.docker_run('ubuntu_nightly_gpu', 'nightly_example_test_ubuntu_python2_gpu', true)
+        }
+      }
+    },
+    'Examples: Python3': {
+      node(NODE_LINUX_GPU) {
+        ws('workspace/example-test-python3') {
+          utils.unpack_and_init('gpu', mx_lib)
+          utils.docker_run('ubuntu_nightly_gpu', 'nightly_example_test_ubuntu_python3_gpu', true)
+        }
+      }
     }
   }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services