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

add VEP process management #7

Conversation

sheridancbio
Copy link
Contributor

@sheridancbio sheridancbio commented Jun 22, 2020

- SystemProcessManager class now provides process management services for VEP
    - uses UNIXProcess (if available) for determining a Process pid
    - uses UNIXProcess (if available) for reaping zombies (via waitForProcessExit())
    - determines availability of ps and kill commands on local system
    - manages processes launched if needed tools are available
    - starts ReaperDaemonThread when first VEP process is launched
    - reaper will periodically check for orphaned child processes of a destroyed VEP process and kill them
    - reaper will periodically check for zombie processes and reap them
- unix 'ps' command output parsing encapsulated in ProcessSurveyor class
- remove thread interruption in VepRunner - now StreamTransferrer threads will exit naturally when orphaned children are killed
- shut down reaper as application shuts down

Process psProcess = psProcessBuilder.start();
BufferedReader in = new BufferedReader(new InputStreamReader(psProcess.getInputStream()));
while (true) {
String line = in.readLine();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it equivalent to use:

while ((line = in.readLine()) != null)
...

?

I am hesitant to use true in the while statement

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suppose the item being parsed would also need to be in the while statement check as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed as you suggested

determineIfKillCommandIsAvailable();
}
// ReaperDaemonThread
while (true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hesitant to use true here as well but at the same time there's a lot going on in this block so maybe just keeping it true is best to keep it simple?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed this too. The reaper thread, once started, will continue to run as long as the application is running. So now the condition of the while statement checks whether a shutdown of the reaper was requested and exits if it sees such a request.

I have added a servlet configuration bean which will send the request for reaper shutdown as the servlet is exiting ... and will give a few seconds for the reaper to complete its work before exiting the application.

Copy link
Contributor

@ao508 ao508 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good over all, just had one minor question regarding a couple while statements

@sheridancbio sheridancbio force-pushed the fix-accumulating-orphan-processes branch 2 times, most recently from e5f57b6 to cc1e4d3 Compare June 24, 2020 14:21
@sheridancbio
Copy link
Contributor Author

Squashing and updating commit message

- SystemProcessManager class now provides process management services for VEP
    - uses UNIXProcess (if available) for determining a Process pid
    - uses UNIXProcess (if available) for reaping zombies (via waitForProcessExit())
    - determines availability of ps and kill commands on local system
    - manages processes launched if needed tools are available
    - starts ReaperDaemonThread when first VEP process is launched
    - reaper will periodically check for orphaned child processes of a destroyed VEP process and kill them
    - reaper will periodically check for zombie processes and reap them
- unix 'ps' command output parsing encapsulated in ProcessSurveyor class
- remove thread interruption in VepRunner - now StreamTransferrer threads will exit naturally when orphaned children are killed
- shut down reaper as application shuts down

Co-authored-by: Manda Wilson <1458628+mandawilson@users.noreply.github.com>
Co-authored-by: Robert Sheridan <7747489+sheridancbio@users.noreply.github.com>
@sheridancbio sheridancbio force-pushed the fix-accumulating-orphan-processes branch from 680b0c5 to 46168da Compare June 25, 2020 16:58
@sheridancbio sheridancbio changed the title add process management add VEP process management Jun 25, 2020
@sheridancbio sheridancbio merged commit 5ccefe8 into genome-nexus:master Jun 25, 2020
@sheridancbio sheridancbio added enhancement New feature or request and removed DO NOT MERGE labels Jun 26, 2020
@sheridancbio sheridancbio deleted the fix-accumulating-orphan-processes branch July 6, 2020 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants