Skip to content

Commit

Permalink
Clean up print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
jarusified committed Aug 20, 2020
1 parent 240d165 commit 9881018
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
13 changes: 8 additions & 5 deletions callflow/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import errno
import json
import base64
import argparse

# The following five types enumerate the possible return values of the
# `start` function.
Expand Down Expand Up @@ -171,6 +170,9 @@ def _get_info_dir():


def get_launch_information():
"""
Dump all current instances's CallFlowLaunchInfo into a list.
"""
info_dir = _get_info_dir()
results = []
for filename in os.listdir(info_dir):
Expand Down Expand Up @@ -204,7 +206,7 @@ def start(args, args_string):
match = _find_matching_instance(
cache_key(working_directory=os.getcwd(), arguments=vars(args),),
)
print(match)
print("Is there a matching pid?", match != None)
if match:
return StartReused(info=match)

Expand Down Expand Up @@ -235,9 +237,7 @@ def _find_matching_instance(cache_key):
"""
infos = get_launch_information()
candidates = [info for info in infos if info["cache_key"] == cache_key]
print(candidates)
for candidate in sorted(candidates, key=lambda x: x.port):
print(candidate)
return candidate
return None

Expand All @@ -249,8 +249,11 @@ def launch_cmd(cmd, timeout=datetime.timedelta(seconds=60), alias=""):
stdprefix_path = "/tmp/.callflow-info/" + alias + "-"
(stdout_fd, stdout_path) = tempfile.mkstemp(prefix=stdprefix_path + "stdout-")
(stderr_fd, stderr_path) = tempfile.mkstemp(prefix=stdprefix_path + "stderr-")
pid_path = _get_info_file_path()

print(stdout_path, stderr_path)
print(f"stdout for {alias} is dumped in {stdout_path}.")
print(f"stderr for {alias} is dumped in {stdout_path}.")
print(f"CallFlow instance info is dumped in {pid_path}")

start_time_seconds = time.time()
try:
Expand Down
1 change: 0 additions & 1 deletion callflow/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def _jupyter_args_to_argparse(args_string):
parser.add_argument("--verbose", action="store_true")
parser.add_argument("--process", action="store_true")
parser.add_argument("--config", nargs="*")

return parser.parse_args(shlex.split(args_string))


Expand Down
13 changes: 5 additions & 8 deletions examples/%callflow-ipython-magic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,17 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe id=\"callflow-frame-6c813a9202487dca\" width=\"100%\" height=\"800\" frameborder=\"0\">\n",
" <iframe id=\"callflow-frame-1e29df6686ac1ace\" width=\"100%\" height=\"800\" frameborder=\"0\">\n",
" </iframe>\n",
" <script>\n",
" (function() {\n",
" const frame = document.getElementById(\"callflow-frame-6c813a9202487dca\");\n",
" const frame = document.getElementById(\"callflow-frame-1e29df6686ac1ace\");\n",
" const url = new URL(\"/\", window.location);\n",
" const port = 1024;\n",
" if (port) {\n",
Expand All @@ -55,13 +53,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"eyJhcmd1bWVudHMiOnsiY29uZmlnIjpbIi9ob21lL3N1cmFqL1dvcmsvbGxubC9DYWxsRmxvdy9kYXRhL2x1bGVzaC04LXJ1bnMvY2FsbGZsb3cuY29uZmlnLmpzb24iXSwicHJvY2VzcyI6ZmFsc2UsInZlcmJvc2UiOmZhbHNlfSwid29ya2luZ19kaXJlY3RvcnkiOiIvaG9tZS9zdXJhai9Xb3JrL2xsbmwvQ2FsbEZsb3cvZXhhbXBsZXMifQ==\n",
"[]\n",
"None\n",
"Launching Server\n",
"/tmp/.callflow-info/server-stdout-6b0mpjot /tmp/.callflow-info/server-stderr-v48raafr\n",
"/tmp/.callflow-info/server-stdout-6bpjwqyp /tmp/.callflow-info/server-stderr-trhorh0o\n",
"Launching client\n",
"/tmp/.callflow-info/client-stdout-p5zozvzt /tmp/.callflow-info/client-stderr-563ka6o2\n",
"/tmp/.callflow-info/client-stdout-wnehx4g7 /tmp/.callflow-info/client-stderr-4sjt9a3d\n",
"StartLaunched(info='Started')\n"
]
}
Expand Down

0 comments on commit 9881018

Please sign in to comment.