-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from PanDAWMS/next
3.6.7.10
- Loading branch information
Showing
10 changed files
with
162 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.6.6.22 | ||
3.6.7.10 |
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
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,46 @@ | ||
#!/usr/bin/env python | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Authors: | ||
# - Paul Nilsson, [email protected], 2023 | ||
|
||
import os | ||
try: | ||
import psutil | ||
except ImportError: | ||
print('FAILED; psutil module could not be imported') | ||
is_psutil_available = False | ||
else: | ||
is_psutil_available = True | ||
|
||
# from pilot.common.exception import MiddlewareImportFailure | ||
|
||
import logging | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def is_process_running_by_pid(pid): | ||
return os.path.exists(f"/proc/{pid}") | ||
|
||
|
||
def is_process_running(pid): | ||
""" | ||
Is the given process still running? | ||
Note: if psutil module is not available, this function will raise an exception. | ||
:param pid: process id (int) | ||
:return: True (process still running), False (process not running) | ||
:raises: MiddlewareImportFailure if psutil module is not available. | ||
""" | ||
|
||
if not is_psutil_available: | ||
is_running = is_process_running_by_pid(pid) | ||
logger.warning(f'using /proc/{pid} instead of psutil (is_running={is_running})') | ||
return is_running | ||
# raise MiddlewareImportFailure("required dependency could not be imported: psutil") | ||
else: | ||
return psutil.pid_exists(pid) |
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