Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/check status python process #1848

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

nguyenhoangthuan99
Copy link
Contributor

@nguyenhoangthuan99 nguyenhoangthuan99 commented Jan 9, 2025

Describe Your Changes

Pull Request Summary: Add Process Status Check for PythonEngine Model Management

Overview

This pull request introduces a utility to check if a process is running and integrates this functionality into the PythonEngine class for enhanced model management. The primary focus is to ensure that model processes are effectively monitored, improving reliability and debuggability.

Key Changes

  1. Process Status Check Utility:

    • Introduced process_status_utils.h, a utility header to determine if a process is currently running.
    • Supports both Windows and Unix-like systems (Linux and macOS) using appropriate system calls.
  2. Integration with PythonEngine:

    • Enhanced the GetModelStatus method to utilize the new IsProcessRunning utility.
    • The method now verifies the live status of model processes and provides a more accurate response.
  3. Code Refactoring:

    • Included the newly created process_status_utils.h in python_engine.h to leverage the process status utility.
  4. Error Handling Improvements:

    • Improved error handling in the GetModelStatus function. It now correctly identifies when a model process is loading versus when it has encountered an error.

Detailed Modifications:

  • engine/extensions/python-engine/python_engine.cc:

    • Added checks for process activity using IsProcessRunning.
    • Improved callback response based on process and health check status.
  • engine/extensions/python-engine/python_engine.h:

    • Included process_status_utils.h for process management.
  • New File: engine/utils/process_status_utils.h:

    • Added inline utility function IsProcessRunning.
    • Implemented cross-platform checks for whether a given process ID is active.

This update focuses on enhancing the robustness of model lifecycle management within the PythonEngine, providing better feedback on the status of running models, and improving the system's overall reliability.

Copy link
Contributor

github-actions bot commented Jan 9, 2025

Preview URL: https://88e6b87c.cortex-docs.pages.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant