fix: improve error handling in rq-docker script
- Use python3 in shebang for explicit Python 3 - Add exception handling in main() to log errors properly Co-authored-by: abhi1693 <5083532+abhi1693@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
"""RQ worker entrypoint for Docker containers."""
|
"""RQ worker entrypoint for Docker containers."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
@@ -39,7 +39,13 @@ def build_parser() -> argparse.ArgumentParser:
|
|||||||
def main() -> None:
|
def main() -> None:
|
||||||
parser = build_parser()
|
parser = build_parser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
try:
|
||||||
sys.exit(args.func(args))
|
sys.exit(args.func(args))
|
||||||
|
except Exception:
|
||||||
|
# Log unexpected errors before exiting
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user