Skip to content

Commit

Permalink
Do not use pool for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
gaogaotiantian committed Oct 10, 2024
1 parent 7d29662 commit 8e2b973
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/test_logsparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,20 @@ def f(x):

file_multiprocess_spawn = """
import multiprocessing
import multiprocessing.pool
from viztracer import get_tracer
def bar():
pass
def child(idx):
with get_tracer().log_event("custom_event"):
bar()
def child(it):
for idx in it:
with get_tracer().log_event(f"custom_event"):
bar()
def main():
with multiprocessing.pool.Pool(
2,
context=multiprocessing.get_context('spawn'),
) as pool:
pool.map(child, range(3))
p = multiprocessing.get_context("spawn").Process(target=child, args=(range(3), ))
p.start()
p.join()
if __name__ == "__main__":
main()
Expand Down

0 comments on commit 8e2b973

Please sign in to comment.