tensorwatch icon indicating copy to clipboard operation
tensorwatch copied to clipboard

Multiplexing multiple .observe() onto the same Watcher?

Open radoye opened this issue 6 years ago • 0 comments

The code

I'm using a slightly modified sum_lazy.py

# create watcher object as usual
w = tw.Watcher()

weights = None
for i in range(10000):
    weights = [random.random() for _ in range(5)]

    # let watcher observe variables we have
    # this has almost no performance cost
    w.observe(weights=weights, pqr=42)
    w.observe(my_test=[-x for x in weights])
    w.observe(**{"my_testX": [-x for x in weights]})
    time.sleep(1)

and a slightly modified lazy_logging.ipynb

client = tw.WatcherClient()
#stream = client.create_stream(expr='lambda d: np.sum(d.my_test)')
stream = client.create_stream(expr='lambda d: print(d)')

Expected behavior

I'd like (expect?) different observations to be multiplexed into the stream.

Observed behavior

Only the first call to .observe() produces an event.

Singularity devX.sif:~/docks/dev/numericcal/radoye/tensorwatch/test/simple_log> python sum_lazy.py 

weights="[0.7598638948148748, 0.9609570253109472, 0.17193771268530844, 0.945312325751268, 0.8840031816567768]", pqr=42
weights="[0.9633391250000072, 0.4817883214569013, 0.5066860131563821, 0.536321656766366, 0.4866203822451308]", pqr=42
weights="[0.8682968602613323, 0.25722248154751726, 0.10094894832942802, 0.8529007560893397, 0.4847747465461011]", pqr=42
weights="[0.1920386201704245, 0.2917508358159102, 0.13423189557362525, 0.48907668597008847, 0.7810377425785467]", pqr=42

radoye avatar Oct 06 '19 18:10 radoye