Skip to content

Commit e69b0b6

Browse files
committed
Python backward compatability
1 parent 6e2cd14 commit e69b0b6

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

test/test_psutil_memory_full_info.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ def func():
9898
n_jobs = 8
9999
size = 3000
100100

101-
print(f"Creating data: {size}x{size} ... ", end="")
101+
print("Creating data: {size}x{size} ... ".format(size=size), end="")
102102
a = np.random.random((size, size))
103-
print(f"done ({a.size * a.itemsize / 1024**3:.02f} Gb). ", end="")
103+
print("done ({size:.02f} Gb). ".format(size=a.size * a.itemsize / 1024**3), end="")
104104

105105
def subprocess(i):
106106
aa = a.copy()
@@ -116,21 +116,20 @@ def subprocess(i):
116116
pass
117117

118118
start = datetime.datetime.now()
119-
print(f"Starting processing: n_jobs={n_jobs} ... ", end="")
119+
print("Starting processing: n_jobs={n_jobs} ... ".format(n_jobs=n_jobs), end="")
120120
results = joblib.Parallel(n_jobs=n_jobs)(
121121
joblib.delayed(subprocess)(i)
122122
for i in range(n_jobs))
123-
print(f"done ({datetime.datetime.now() - start}). ", end="")
123+
print("done ({}). ".format(datetime.datetime.now() - start), end="")
124124

125125
return results
126126

127127
rss = memory_usage(proc=func, max_usage=True, backend="psutil", include_children=True, multiprocess=True)
128-
print(f"RSS: {rss:.02f}")
128+
print("RSS: {rss:.02f}".format(rss=rss))
129129
uss = memory_usage(proc=func, max_usage=True, backend="psutil_uss", include_children=True, multiprocess=True)
130-
print(f"USS: {uss:.02f}")
130+
print("USS: {uss:.02f}".format(uss=uss))
131131
pss = memory_usage(proc=func, max_usage=True, backend="psutil_pss", include_children=True, multiprocess=True)
132-
print(f"PSS: {pss:.02f}")
133-
print(f"RSS: {rss:.02f}, USS: {uss:.02f}, PSS: {pss:.02f}")
132+
print("PSS: {pss:.02f}".format(pss=pss))
134133

135134

136135
if __name__ == "__main__":

0 commit comments

Comments
 (0)