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 Nov 19, 2019
1 parent bf324a3 commit 6c65ee4
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 @@ -237,7 +239,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 @@ -261,7 +263,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 @@ -278,15 +280,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 @@ -285,7 +287,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 @@ -309,7 +311,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 @@ -326,15 +328,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 6c65ee4

Please sign in to comment.