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

Usage Tracking: Only log messages when tracking is enabled #3748

Merged
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
2 changes: 0 additions & 2 deletions parsl/dataflow/dflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,10 +1200,8 @@ def cleanup(self) -> None:
self._checkpoint_timer.close()

# Send final stats
logger.info("Sending end message for usage tracking")
self.usage_tracker.send_end_message()
self.usage_tracker.close()
logger.info("Closed usage tracking")

logger.info("Closing job status poller")
self.job_status_poller.close()
Expand Down
21 changes: 13 additions & 8 deletions parsl/usage_tracking/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,14 @@ def send_UDP_message(self, message: bytes) -> None:

def send_start_message(self) -> None:
if self.tracking_level:
logger.info("Sending start message for usage tracking")
self.start_time = time.time()
message = self.construct_start_message()
self.send_UDP_message(message)

def send_end_message(self) -> None:
if self.tracking_level == 3:
logger.info("Sending end message for usage tracking")
message = self.construct_end_message()
self.send_UDP_message(message)

Expand All @@ -229,11 +231,14 @@ def close(self, timeout: float = 10.0) -> None:
definitely either: going to behave broadly the same as to SIGKILL,
or won't respond to SIGTERM.
"""
for proc in self.procs:
logger.debug("Joining usage tracking process %s", proc)
proc.join(timeout=timeout)
if proc.is_alive():
logger.warning("Usage tracking process did not end itself; sending SIGKILL")
proc.kill()

proc.close()
if self.tracking_level:
logger.info("Closing usage tracking")

for proc in self.procs:
logger.debug("Joining usage tracking process %s", proc)
proc.join(timeout=timeout)
if proc.is_alive():
logger.warning("Usage tracking process did not end itself; sending SIGKILL")
proc.kill()

proc.close()
Loading