-
Notifications
You must be signed in to change notification settings - Fork 279
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
Uninstall OpenSearch after testing on dashboards and modify the exception handle to skip irrelevant exception #3823
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,9 +66,9 @@ def terminate(self) -> int: | |
try: | ||
for item in proc.open_files(): | ||
if self.stdout.name == item.path: | ||
raise Exception(f"stdout {item} is being used by process {proc}") | ||
except Exception as err: | ||
logging.error(f"{err.args}") | ||
logging.error(f"stdout {item} is being used by process {proc}") | ||
except Exception: | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Catching and exception and not doing anything is not making sense. Can you elaborate what you are trying to do here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These exceptions caught are mainly some process that were not related to our testing or they were already closed during the iteration so we may not have permission to go through it. I have seen quite few examples of using this regarding of whether certain file is closed/not used by any process. e.g. https://stackoverflow.com/questions/64599502/how-can-i-check-if-a-file-is-actively-open-in-another-process-outside-of-my-pyth. I think it's safe to do this. |
||
os.unlink(self.stdout.name) | ||
self.stdout = None | ||
|
||
|
@@ -81,9 +81,9 @@ def terminate(self) -> int: | |
try: | ||
for item in proc.open_files(): | ||
if self.stderr.name == item.path: | ||
raise Exception(f"stderr {item} is being used by process {proc}") | ||
except Exception as err: | ||
logging.error(f"{err.args}") | ||
logging.error(f"stderr {item} is being used by process {proc}") | ||
except Exception: | ||
pass | ||
os.unlink(self.stderr.name) | ||
self.stderr = None | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,16 +83,16 @@ def start(self) -> None: | |
def terminate(self) -> None: | ||
if self.service: | ||
self.termination_result = self.service.terminate() | ||
self.__save_test_result_data(self.termination_result) | ||
|
||
for service in self.dependencies: | ||
termination_result = service.terminate() | ||
self.__save_test_result_data(termination_result) | ||
service.uninstall() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you make sure the uninstallation of dependencies wont affect |
||
|
||
if not self.termination_result: | ||
raise ClusterServiceNotInitializedException() | ||
|
||
self.__save_test_result_data(self.termination_result) | ||
|
||
self.service.uninstall() | ||
peterzhuamazon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def __save_test_result_data(self, termination_result: ServiceTerminationResult) -> None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this happened because we are checking all the process that is running on the host. The host has a number of processes running that may or may not be related to testing. Can you narrow down what process and open files we are checking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's the properties of
psutil
to iterate all the running process though some of them are not related to our testing at all. I don't think there is a way to narrow down to specific process across platforms. Also some of the exception may be caused by race condition and we think we could pass on them since they are already outdated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get the process id from line 48. See if the process is subprocess of it? Rather than iterating over all the existing processes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gaiksaya Basically in windows, according to my research, the
python.exe
was the process that was holding the file from removing which is not theOpenSearch/Dashboards
process so that process id is not the one we want to check.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pid thing needs another research and bug fix as it was initially only designed for tar, not any other dist that can be handled by external means.
As of now the pid is not accurate unless is tar.
Thanks.