You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

  1. # Measuring Script Run Time
  2. Append `/start` to a ping URL and use it to signal when a job starts.
  3. After receiving a start signal, Healthchecks.io will show the check as "Started".
  4. It will store the "start" events and display the job execution times. The job
  5. execution times are calculated as the time gaps between adjacent "start" and
  6. "complete" events.
  7. Signalling a start kicks off a separate timer: the job now **must** signal a
  8. success within its configured "Grace Time", or it will get marked as "down".
  9. Below is a code example in Python:
  10. ```python
  11. import requests
  12. URL = "PING_URL"
  13. # "/start" kicks off a timer: if the job takes longer than
  14. # the configured grace time, the check will be marked as "down"
  15. try:
  16. requests.get(URL + "/start", timeout=5)
  17. except requests.exceptions.RequestException:
  18. # If the network request fails for any reason, we don't want
  19. # it to prevent the main job from running
  20. pass
  21. # TODO: run the job here
  22. fib = lambda n: n if n < 2 else fib(n - 1) + fib(n - 2)
  23. print("F(42) = %d" % fib(42))
  24. # Signal success:
  25. requests.get(URL)
  26. ```