Skip to content

Commit e3be31f

Browse files
committed
add some debug prints
Signed-off-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
1 parent 2ee1170 commit e3be31f

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ checks: check
8383

8484
TEST_ARGS :=
8585
test-py: ## Clean and Make unit tests
86-
python -m pytest -v csp/tests --junitxml=junit.xml $(TEST_ARGS)
86+
python -m pytest -sv csp/tests --junitxml=junit.xml $(TEST_ARGS)
8787

8888
coverage-py:
8989
python -m pytest -v csp/tests --junitxml=junit.xml --cov=csp --cov-report xml --cov-report html --cov-branch --cov-fail-under=80 --cov-report term-missing $(TEST_ARGS)

csp/impl/wiring/threaded_runtime.py

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def stop(self):
2121
self._pusher.unregister_impl()
2222

2323
def signal_stop(self):
24+
print("_EngineStopSignalImpl.signal_stop called")
2425
self.push_tick(True)
2526

2627

@@ -29,19 +30,23 @@ def signal_stop(self):
2930

3031
class _EngineStopper:
3132
def __init__(self):
33+
print("_EngineStopper.__init__")
3234
self._pushimpl = None
3335
self._deferred_stop = False
3436

3537
def register_impl(self, impl):
38+
print(f"_EngineStopper.register_impl: {impl}")
3639
self._pushimpl = impl
3740
# For the case where stop is called before push input was actually created on the engine thread
3841
if self._deferred_stop:
42+
print("_EngineStopper.register_impl: signal_stop() called")
3943
self._pushimpl.signal_stop()
4044

4145
def unregister_impl(self):
4246
self._pushimpl = None
4347

4448
def stop_engine(self):
49+
print(f"_EngineStopper.stop_engine: {self._pushimpl}")
4550
if self._pushimpl is not None:
4651
self._pushimpl.signal_stop()
4752
else:

csp/tests/test_engine.py

+3
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,7 @@ def test_threaded_run(self):
13861386
@csp.graph
13871387
def g(count: int) -> csp.ts[int]:
13881388
x = csp.count(csp.timer(timedelta(seconds=0.1)))
1389+
print(f"g: count, x: {count} {x}")
13891390
stop = x == count
13901391
stop = csp.filter(stop, stop)
13911392

@@ -1400,7 +1401,9 @@ def g(count: int) -> csp.ts[int]:
14001401
runner = csp.run_on_thread(g, 50000, starttime=datetime.utcnow(), endtime=timedelta(minutes=1), realtime=True)
14011402
import time
14021403

1404+
print("calling sleep")
14031405
time.sleep(1)
1406+
print("calling stop_engine")
14041407
runner.stop_engine()
14051408
res = runner.join()[0]
14061409
self.assertLess(len(res), 20)

0 commit comments

Comments
 (0)