Closed bjmuldre-intc closed 1 year ago
Wow, that's bizarre... I'm not sure what might be causing that 🤔 What is this dask? Imports in Python do execute module code, but I can't think of any that would ruin my bar like that... Humm, unless it cheats like trying to run this file where it is being imported in multiple threads/processes. Does it?
Wow, that's bizarre... I'm not sure what might be causing that 🤔 What is this dask?
It’s a tool for data-flow-graph based automatic optimization of complex distributed and/or parallel computations on tabular data
Imports in Python do execute module code, but I can't think of any that would ruin my bar like that... Humm, unless it cheats like trying to run this file where it is being imported in multiple threads/processes. Does it?
I really don’t know. Did not dig into Dask source. I didn’t initiate any multithreading/multiprocessing in the MWE, and Dask isn’t supposed to do any of that until you ask it to. I really would hope that the import doesn’t.
You could try to insert a print in module level, right below your total_reps
for example. See if it is printed twice.
(You might want to comment the alive_bar code for this)
Look like the same problem shows up with sshtunnel: https://lightrun.com/answers/rsalmei-alive-progress-crash-when-reusing-logging-handlers-with-unhashable-type-typessimplenamespace
Yes, but there in #155 the cause is already known, here it isn't. Same outcome, different cause.
I do habe the same problem, running on version 2.4.1
. If I run the code again, it works fine for the failed setting. I'm running my code several times, but it seems that it fails randomly
File "**censored***/experiments.py", line 57, in <module>
train(log_file=log_file_list_train,
File "**censored***/venv/lib/python3.10/site-packages/**censored***/__init__.py", line 77, in train
la.run()
File "**censored***/venv/lib/python3.10/site-packages/**censored***/backend/LogAnalyzer/LogAnalyzer.py", line 146, in run
self.analyze_event_log_characteristics()
File "**censored***/venv/lib/python3.10/site-packages/**censored***/backend/LogAnalyzer/LogAnalyzer.py", line 233, in analyze_event_log_characteristics
with alive_progress.alive_bar(len(self.log_file_imported), title="Analyzing basic characteristics") as bar:
File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
next(self.gen)
File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/progress.py", line 284, in __alive_bar
stop_monitoring()
File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/progress.py", line 170, in stop_monitoring
hook_manager.uninstall()
File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/hook_manager.py", line 85, in uninstall
[_set_stream(handler, original_stream)
File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/hook_manager.py", line 85, in <listcomp>
[_set_stream(handler, original_stream)
File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/hook_manager.py", line 134, in _set_stream
return handler.setStream(stream)
File "/usr/lib/python3.10/logging/__init__.py", line 1124, in setStream
self.flush()
File "/usr/lib/python3.10/logging/__init__.py", line 1084, in flush
self.stream.flush()
File "**censored***/venv/lib/python3.10/site-packages/alive_progress/core/hook_manager.py", line 33, in flush
if buffers[stream]:
TypeError: unhashable type: 'types.SimpleNamespace'
Thanks @chrsdrdt, but this ticket is specific for that Dask Client. The correct place would probably be #155. Please post it there, along with whether your setup might be reusing log handlers...
This is fixed in 3.0, enjoy!
My alive_bar was working quite well for some time. Then, I implemented an optional branch in my program for parallel execution of some stuff using a Dask dataframe. In the course of implementing that branch, the alive_bar stopped working even in the serial-only branch. Turns out, it's due to the import statement importing the dask.distributed.Client class. See my MWE below. Thanks!