Skip to content

Commit

Permalink
QUALITY: Remove print statements from generated project
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac Brannelly committed Oct 28, 2019
1 parent d748f52 commit 33c21f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions templates/new/dodo.py.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import sys
import subprocess
import re
import webbrowser
import logging

from pathlib import Path

Expand All @@ -18,6 +19,7 @@ CONFIG = Config(os.path.dirname(__file__))
DOIT_CONFIG = {{'verbosity':2}}
PACKAGE_PATH = os.path.basename(CONFIG["package_path"])
IMAGE = "%s/%s:%s" % (CONFIG["company"], CONFIG["image"], CONFIG["version"])
LOGGER = logging.getLogger(__name__)

PARAMS = [
{{
Expand Down Expand Up @@ -231,7 +233,7 @@ def task_jupyter():
stderr=subprocess.PIPE,
encoding='utf-8')

print("Starting jupyter notbook server...\n")
LOGGER.info("Starting jupyter notbook server...\n")

# Get the IP address of the container, otherwise use localhost
ip_process = subprocess.Popen(
Expand All @@ -255,7 +257,7 @@ def task_jupyter():
break

if process.poll():
print("Failed to start the server, check if its not running somewhere else!")
LOGGER.error("Failed to start the server, check if its not running somewhere else!")

# Stop any containers that might be running
process = subprocess.Popen(
Expand All @@ -272,15 +274,15 @@ def task_jupyter():
# Open the browser automatically
webbrowser.open('http://%s:55910/tree' % host, new=2)

print("Notebook URL: http://%s:55910/tree\n" % host)
print("Use CTRL+C to stop the server.")
LOGGER.info("Notebook URL: http://%s:55910/tree\n", host)
LOGGER.info("Use CTRL+C to stop the server.")

try:
process.wait()
except KeyboardInterrupt:
pass
finally:
print("Closing server...")
LOGGER.info("Closing server...")
process = subprocess.Popen(
[
'docker',
Expand Down
12 changes: 7 additions & 5 deletions templates/new/web_dodo.py.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import sys
import subprocess
import re
import webbrowser
import logging

from pathlib import Path

Expand All @@ -18,6 +19,7 @@ CONFIG = Config(os.path.dirname(__file__))
DOIT_CONFIG = {{'verbosity':2}}
PACKAGE_PATH = os.path.basename(CONFIG["package_path"])
IMAGE = "%s/%s:%s" % (CONFIG["company"], CONFIG["image"], CONFIG["version"])
LOGGER = logging.getLogger(__name__)

PARAMS = [
{{
Expand Down Expand Up @@ -279,7 +281,7 @@ def task_jupyter():
stderr=subprocess.PIPE,
encoding='utf-8')

print("Starting jupyter notbook server...\n")
LOGGER.info("Starting jupyter notbook server...\n")

# Get the IP address of the container, otherwise use localhost
ip_process = subprocess.Popen(
Expand All @@ -303,7 +305,7 @@ def task_jupyter():
break

if process.poll():
print("Failed to start the server, please try again!")
LOGGER.error("Failed to start the server, please try again!")

# Stop any containers that might be running
process = subprocess.Popen(
Expand All @@ -320,15 +322,15 @@ def task_jupyter():
# Open the browser automatically
webbrowser.open('http://%s:55910/tree' % host, new=2)

print("Notebook URL: http://%s:55910/tree\n" % host)
print("Use CTRL+C to stop the server.")
LOGGER.info("Notebook URL: http://%s:55910/tree\n", host)
LOGGER.info("Use CTRL+C to stop the server.")

try:
process.wait()
except KeyboardInterrupt:
pass
finally:
print("Closing server...")
LOGGER.info("Closing server...")
process = subprocess.Popen(
[
'docker',
Expand Down

0 comments on commit 33c21f5

Please sign in to comment.