HetWaterschapshuis / HyDAMOValidatieModule

MIT License
0 stars 2 forks source link

toevoegen heartbeat #21

Open DanielTollenaar opened 4 months ago

DanielTollenaar commented 4 months ago

Wat pseudo-code ter uitbereiding van het script dat de validator aanroept

import threading
import time
from hydamo_validation import validator

def print_heartbeat(interval):
  """Hier moet de logger in"""
    while True:
        print("Heartbeat...")
        time.sleep(interval)

heartbeat_thread = threading.Thread(target=print_heartbeat, args=(heartbeat_interval,))
heartbeat_thread.daemon = True  # Daemonize the thread to exit when main program exits
heartbeat_thread.start()

 """Hier moeten we optioneel de logger instoppen die ook in de heartbeat gaat"""
hydamo_validator = validator(
    output_types=["geopackage"], coverages=coverage, log_level="INFO"
)

datamodel, layer_summary, result_summary = hydamo_validator(
    directory=directory, raise_error=True
)

if __name__ == "__main__":
    main()

Acties: