marcoabreu commented on a change in pull request #10495: [MXNET-307] Add 
tutorials to the CI + Fix them
URL: https://github.com/apache/incubator-mxnet/pull/10495#discussion_r180929532
 
 

 ##########
 File path: tests/nightly/test_tutorial.py
 ##########
 @@ -25,87 +25,116 @@
 import os
 import warnings
 import imp
-
+import shutil
+import time
+import argparse
 import traceback
 import nbformat
 from nbconvert.preprocessors import ExecutePreprocessor
+import sys
 
 fail_dict = {}
+TIME_OUT = 1800
 
-def test_tutorial(file_path):
-    """Run tutorial python script and  save any error or warning.
-       If no error or warning occurs, run notebook.
-
-    Parameters
-    ----------
-    file_path : str
-        path of tutorial markdown file
-    """
-    with warnings.catch_warnings(record=True) as w:
-        tutorial_name = os.path.basename(file_path)
-        print file_path + '.py'
-        try:
-            imp.load_source('tutorial', file_path + '.py')
-            if len(w) > 0:
-                err_msg = "%s.py has %d warnings.\n" % (tutorial_name, len(w))
-                fail_dict[tutorial_name] = err_msg
-            else:
-                test_tutorial_nb(file_path)
-        except Exception:
-            err_msg = "%s.py has error:\n%s" % (tutorial_name, 
traceback.format_exc())
-            fail_dict[tutorial_name] = err_msg
-
-def test_tutorial_nb(file_path):
+def test_tutorial_nb(file_path, workingdir, kernel=None):
     """Run tutorial jupyter notebook to catch any execution error.
 
     Parameters
     ----------
     file_path : str
-        path of tutorial markdown file
+        path of tutorial .ipynb file
+    workingdir: str
+        path of the directory to run the tutorial in
+    kernel: str
+        Default None
+        name of the kernel to use, if none, will use first kernel 
+        in the list
     """
     tutorial_name = os.path.basename(file_path)
+    sys.stdout.write('Testing {}...'.format(file_path))
+    sys.stdout.flush()
+    tick = time.time()
     notebook = nbformat.read(file_path + '.ipynb', as_version=4)
-    eprocessor = ExecutePreprocessor(timeout=1800)
+    if kernel:
+        eprocessor = ExecutePreprocessor(timeout=TIME_OUT, kernel_name=kernel)
+    else:
+        eprocessor = ExecutePreprocessor(timeout=TIME_OUT)
+    success = True
     try:
-        eprocessor.preprocess(notebook, {'metadata': {}})
+        os.environ['MXNET_STORAGE_FALLBACK_LOG_VERBOSE'] = '0'
+        os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0'
 
 Review comment:
   My concern here is that users will be having autotune enabled by default. 
This means we're running our CI in a different configuration than what our 
users are going to use. 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to