Skip to content

Commit f9364aa

Browse files
committed
Fix linter
1 parent 88b48c0 commit f9364aa

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

tests/app/performance_test.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,30 @@
66

77

88
def get_cell(seconds):
9-
cell = ', { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "time.sleep(' + str(seconds) + ')\\n", "t1 = time.time()\\n", "log += str(t1 - t0) + \'\\\\n\'\\n", "t0 = t1" ] }'
9+
cell = ', { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], '
10+
'"source": [ "time.sleep(' + str(seconds) + ')\\n", "t1 = time.time()\\n", "log += '
11+
'str(t1 - t0) + \'\\\\n\'\\n", "t0 = t1" ] }'
1012
return cell
1113

14+
1215
def get_ipynb(cell_nb, sleep_per_cell, result_dir):
13-
ipynb = '{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import uuid\\n", "import time\\n", "fname = str(uuid.uuid4()) + \'.log\'\\n", "log = \'\'\\n", "t0 = time.time()" ] }'
16+
ipynb = '{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs"'
17+
': [], "source": [ "import uuid\\n", "import time\\n", "fname = str(uuid.uuid4()) + \''
18+
'.log\'\\n", "log = \'\'\\n", "t0 = time.time()" ] }'
1419
for i in range(cell_nb):
1520
cell = get_cell(sleep_per_cell)
1621
ipynb += cell
17-
ipynb += ', { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "with open(\'' + result_dir + '/\' + fname, \'w\') as f:\\n", " f.write(log)" ] }'
18-
ipynb += ' ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.1" } }, "nbformat": 4, "nbformat_minor": 4 }'
22+
ipynb += ', { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], '
23+
'"source": [ "with open(\'' + result_dir + '/\' + fname, \'w\') as f:\\n", " '
24+
'f.write(log)" ] }'
25+
ipynb += ' ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", '
26+
'"name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", '
27+
'"version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python"'
28+
', "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.1" } }'
29+
', "nbformat": 4, "nbformat_minor": 4 }'
1930
return ipynb
2031

32+
2133
def test_performance():
2234
sleep_per_cell = 0.1 # each cell sleeps for that amount of seconds
2335
cell_nb = 100 # each notebook consists of so many cells
@@ -52,13 +64,13 @@ def test_performance():
5264
i = 0
5365
exec_time = cell_nb * sleep_per_cell # notebook execution time
5466
launch_time = client_nb * 0.5 # kernel takes about 0.5s to launch
55-
min_time = launch_time + exec_time # theoretical time for all notebooks to execute
67+
# min_time = launch_time + exec_time # theoretical time for all notebooks to execute
5668
timeout_time = launch_time + 2 * exec_time # timeout allows slow machines to finish
5769
while not done:
5870
time.sleep(1)
5971
done = True
6072
i += 1
61-
#print(i, '/', min_time)
73+
# print(i, '/', min_time)
6274
for client in clients:
6375
if client.poll() is None:
6476
done = False

0 commit comments

Comments
 (0)