-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSS-6912: Add workload container health check (#14)
* add workload container health check
- Loading branch information
Showing
9 changed files
with
235 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2023 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
"""Temporal worker status checker.""" | ||
|
||
|
||
import logging | ||
import sys | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def check_worker_status(): | ||
"""Check Temporal worker status by reading status file.""" | ||
try: | ||
with open("worker_status.txt", "r") as status_file: | ||
status = status_file.read().strip() | ||
logger.info(f"Async status: {status}") | ||
|
||
if "Error" in status: | ||
exit_code = 1 | ||
else: | ||
exit_code = 0 | ||
except FileNotFoundError: | ||
logger.error("Status file not found. Worker is not running.") | ||
exit_code = 1 | ||
|
||
sys.exit(exit_code) | ||
|
||
|
||
if __name__ == "__main__": | ||
check_worker_status() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.