File indexing completed on 2026-04-09 07:58:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 import socket
0012 from idds.common.utils import pid_exists
0013 from idds.core import health as core_health
0014
0015
0016 def clean_heartbeat():
0017 hostname = socket.getfqdn()
0018 health_items = core_health.retrieve_health_items()
0019 pids, pid_not_exists = [], []
0020 for health_item in health_items:
0021 if health_item['hostname'] == hostname:
0022 pid = health_item['pid']
0023 if pid not in pids:
0024 pids.append(pid)
0025 for pid in pids:
0026 if not pid_exists(pid):
0027 pid_not_exists.append(pid)
0028 if pid_not_exists:
0029 core_health.clean_health(hostname=hostname, pids=pid_not_exists, older_than=None)
0030
0031
0032 if __name__ == "__main__":
0033 clean_heartbeat()