You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marvin.apache.org by we...@apache.org on 2020/08/22 03:17:10 UTC

[incubator-marvin] 01/06: Solve integration errors

This is an automated email from the ASF dual-hosted git repository.

weichen pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-marvin.git

commit df44f71d4d79ec0ee43b4f8ea94fe70a9c9aff79
Author: cardosolucas <ca...@gmail.com>
AuthorDate: Thu Aug 6 15:42:52 2020 -0300

    Solve integration errors
---
 python-daemon/.gitignore                           | 19 --------
 python-daemon/Makefile                             | 53 ++++++++++++++++++++++
 .../marvin_python_daemon/common/config.py          |  2 +-
 python-daemon/marvin_python_daemon/common/utils.py |  4 +-
 .../notebook_extensions/jupyter_notebook_config.py |  2 +-
 .../marvin_python_daemon/management/notebook.py    |  3 +-
 .../marvin_python_daemon/management/test.py        |  2 +-
 7 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/python-daemon/.gitignore b/python-daemon/.gitignore
deleted file mode 100644
index f8e099a..0000000
--- a/python-daemon/.gitignore
+++ /dev/null
@@ -1,19 +0,0 @@
-.cache
-.eggs
-.tox
-.testmondata
-.coverage
-.coverage.*
-coverage.xml
-coverage_report
-*.egg
-*.egg-info
-*.pyc
-tests/__pycache__
-.DS_Store
-build
-.idea
-python-daemon
-.profiling
-dist
-.dev
\ No newline at end of file
diff --git a/python-daemon/Makefile b/python-daemon/Makefile
new file mode 100644
index 0000000..4f52365
--- /dev/null
+++ b/python-daemon/Makefile
@@ -0,0 +1,53 @@
+# 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.
+
+.PHONY: help install test clean clean-build
+
+help:
+	@echo "    install"
+	@echo "        Install the python-daemon on system."
+	@echo "    test"
+	@echo "        Run unit tests."
+	@echo "    clean"
+	@echo "        Clean former builds"
+
+install:
+	pip install .
+
+test:
+	tox
+
+clean-pyc:
+	find . -name '*.pyc' -exec rm -f {} +
+	find . -name '*.pyo' -exec rm -f {} +
+	find . -name '*~' -exec rm -f  {} +
+	find . -name '__pycache__' -exec rm -rf {} +
+
+clean-build:
+	rm -f .prod
+	rm -rf *.egg-info
+	rm -rf .cache
+	rm -rf .eggs
+	rm -rf dist
+
+clean-reports:
+	rm -rf coverage_report/
+	rm -rf html-cov/
+	rm -f coverage.xml
+	rm -f .coverage
+	rm -rf .tox
+	rm -rf .pytest_cache
+
+clean: clean-pyc clean-build clean-reports
diff --git a/python-daemon/marvin_python_daemon/common/config.py b/python-daemon/marvin_python_daemon/common/config.py
index e2b5db3..c439f85 100644
--- a/python-daemon/marvin_python_daemon/common/config.py
+++ b/python-daemon/marvin_python_daemon/common/config.py
@@ -44,7 +44,7 @@ def load_conf_from_file(path=None, section='marvin'):
             'MARVIN_CONFIG_FILE') or os.getenv('CONFIG_FILE')
     if not config_path:  # use default file
         config_path = os.getenv("DEFAULT_CONFIG_PATH")
-    logger.info(
+    logger.debug(
         'Loading configuration values from "{path}"...'.format(path=config_path))
     config_parser = ConfigObj(config_path)
     try:
diff --git a/python-daemon/marvin_python_daemon/common/utils.py b/python-daemon/marvin_python_daemon/common/utils.py
index 49aa3b3..d7ef996 100644
--- a/python-daemon/marvin_python_daemon/common/utils.py
+++ b/python-daemon/marvin_python_daemon/common/utils.py
@@ -323,7 +323,7 @@ def parse_ini(inipath, defaults=None):
     if defaults is None:
         defaults = {}
 
-    logger.info(
+    logger.debug(
         "Parsing marvinini '{}' with defaults '{}'".format(inipath, defaults))
 
     config_raw = configparser.ConfigParser()
@@ -346,6 +346,6 @@ def parse_ini(inipath, defaults=None):
             processed_value = processed_value.split(',')
         config[key] = processed_value
 
-    logger.info('marvinini loaded: {}'.format(config))
+    logger.debug('marvinini loaded: {}'.format(config))
 
     return config
diff --git a/python-daemon/marvin_python_daemon/extras/notebook_extensions/jupyter_notebook_config.py b/python-daemon/marvin_python_daemon/extras/notebook_extensions/jupyter_notebook_config.py
index ee97aba..eb9429e 100644
--- a/python-daemon/marvin_python_daemon/extras/notebook_extensions/jupyter_notebook_config.py
+++ b/python-daemon/marvin_python_daemon/extras/notebook_extensions/jupyter_notebook_config.py
@@ -21,7 +21,7 @@ def marvin_code_export(model, **kwargs):
     import autopep8
     import inspect
     import re
-    from ..common.config import Config
+    from marvin_python_daemon.common.config import Config
 
     print("Executing the marvin export hook script...")
 
diff --git a/python-daemon/marvin_python_daemon/management/notebook.py b/python-daemon/marvin_python_daemon/management/notebook.py
index 73f9684..e938575 100644
--- a/python-daemon/marvin_python_daemon/management/notebook.py
+++ b/python-daemon/marvin_python_daemon/management/notebook.py
@@ -56,10 +56,11 @@ def lab(config, enable_security, port):
         '--notebook-dir', notebookdir,
         '--ip', '0.0.0.0',
         '--port', port,
-        '--no-browser',
+        '--no-browser'
     ]
 
     command.append("--NotebookApp.token=") if not enable_security else None
+    command.append("--allow-root")
 
     return_code = os.system(' '.join(command))
     logger.info("Lab call returned {0}".format(str(return_code)))
diff --git a/python-daemon/marvin_python_daemon/management/test.py b/python-daemon/marvin_python_daemon/management/test.py
index a4c6f18..de80b52 100644
--- a/python-daemon/marvin_python_daemon/management/test.py
+++ b/python-daemon/marvin_python_daemon/management/test.py
@@ -63,7 +63,7 @@ def test(config, cov, no_capture, pdb, args):
                      '--cov-report', 'term-missing',
                      ]
 
-    command = ['py.test'] + cov_args + args
+    command = ['python', '-m', 'pytest'] + cov_args + args
     print(' '.join(command))
     env = os.environ.copy()
     subprocess.call(command, cwd=config['base_path'], env=env)