Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem stopping PBar #436

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion slips_files/core/helpers/progress_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ def pbar_supported(self) -> bool:
return True

def run(self):
"""keeps receiving events until pbar reaches 100%"""
try:
"""keeps receiving events until pbar reaches 100%"""
while self.pbar_supported():
try:
msg: dict = self.pipe.recv()
Expand All @@ -182,10 +182,12 @@ def run(self):

if event == "terminate":
self.terminate()
return

if event == "print":
# let tqdm do th eprinting to avoid conflicts with the pbar
self.print(msg)

except Exception as e:
tqdm.write(f"PBar Error: {e}")

5 changes: 4 additions & 1 deletion slips_files/core/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ def shutdown_gracefully(self):
self.manager.shutdown()
self.send_pipe.close()
self.recv_pipe.close()
if hasattr(self, 'pbar'):
self.pbar.join(3)


def tell_pbar(self, msg: dict):
Expand All @@ -309,7 +311,8 @@ def update(self, msg: dict):
wanna log the text to all logfiles or the cli only?
txt: text to log to the logfiles and/or the cli
bar_info: {
input_type: only given when we send bar:'init', specifies the type of the input file given to slips
input_type: only given when we send bar:'init',
specifies the type of the input file given to slips
eg zeek, argus, etc
total_flows: int,
}
Expand Down
Loading