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

How to manually finish TagUI integrations processes? (eg if Ctrl+C was used to kill TagUI prematurely) #417

Closed
kensoh opened this issue May 2, 2019 · 2 comments
Labels

Comments

@kensoh
Copy link
Member

kensoh commented May 2, 2019

user query

@kensoh kensoh added the feature label May 2, 2019
@kensoh
Copy link
Member Author

kensoh commented May 2, 2019

TagUI will by default send 'finish' signals to its integrations processes automatically (eg Chrome, Python, R, SikuliX). This happens even if errors are encountered during execution, as the cleaning up is done outside the main execution engine, for robustness and reliability.

However, if a user for some reason use Ctrl+C to kill TagUI prematurely, there is no chance for TagUI to send those 'finish' signals to end its integrations processes, as OS will terminate TagUI right away. In this case, users may use the following scripts to terminate the running integration processes.

Without doing so, example of a known side effect (raised in #412) is a SikuliX process when not exit properly, will interfere with execution for the next visual automation script, as there are 2 SikuliX processes running and thus actions are acted out twice (for eg typing text to screen).

This is an uncommon use case, thus it does not make sense to implement as part of main engine. Because it will require adding some delay for each execution for 'finish' signals to be processed. This will slow down execution of all TagUI scripts for the benefit of such edge use case. Thus the following scripts may be used for this purpose.

Note - to rely on programmatically finding the process IDs and killing them is a possible solution but not reliable (for eg, if there are more than 1 existing lost process). And it adds potential failure arcs during executions due to reliance on more OS-level commands. Thus below scripts are the recommended solutions for the use case where users manually terminate TagUI with Ctrl+C.

macOS / Linux - eg end_processes

#!/usr/bin/env bash
# TO KILL INTEGRATION PROCESSES IF CTRL+C WAS USED TO QUIT TAGUI PREMATURELY ~ TEBEL.ORG #

# checking for existence of files before sending finish signal is important
# otherwise for ongoing tagui iterations, all integrations will be invoked

if [ -f "tagui_r/tagui_r.in" ]; then echo "finish" > tagui_r/tagui_r.in; fi
if [ -f "tagui_py/tagui_py.in" ]; then echo "finish" > tagui_py/tagui_py.in; fi
if [ -f "tagui.sikuli/tagui_sikuli.in" ]; then echo "finish" > tagui.sikuli/tagui_sikuli.in; fi
if [ -f "tagui_chrome.in" ]; then echo "finish" > tagui_chrome.in; fi

Windows - eg end_processes.cmd

@echo off
rem # TO KILL INTEGRATION PROCESSES IF CTRL+C WAS USED TO QUIT TAGUI PREMATURELY ~ TEBEL.ORG #

rem checking for existence of files before sending finish signal is important
rem otherwise for ongoing tagui iterations, all integrations will be invoked

if exist "tagui_r\tagui_r.in" echo finish > tagui_r\tagui_r.in
if exist "tagui_py\tagui_py.in" echo finish > tagui_py\tagui_py.in
if exist "tagui.sikuli\tagui_sikuli.in" echo finish > tagui.sikuli\tagui_sikuli.in
if exist "tagui_chrome.in" echo finish > tagui_chrome.in

@kensoh kensoh closed this as completed May 8, 2019
kensoh added a commit that referenced this issue Jun 10, 2019
Committing helper scripts that can be used to kill integration processes if user use Ctrl+C to terminate TagUI prematurely and TagUI can't shutdown the running integration processes.

More details at #417
@kensoh
Copy link
Member Author

kensoh commented Jun 10, 2019

Committed to master. Prior to packaged release, feature available from cutting edge version here -

https://github.com/kelaberetiv/TagUI#set-up

kensoh added a commit that referenced this issue Jun 27, 2019
Making a commit to improve on the existing script to kill TagUI processes.

For eg if Ctrl+C is used to kill TagUI prematurely, TagUI main process would lose the control to do clean-up of integrations (SikuliX, R, Python, Chrome) and Chrome browser.

This shell script (for all the 3 OSes) will kill those processes to free up memory and allows TagUI to start running from a clean state.

These actions are not done by default when TagUI is launched, as it is expected that TagUI exits cleanly. Otherwise cleaning up all processes by default will hide potential issues should they arise and they will end up not getting reported.
kensoh added a commit that referenced this issue Jun 27, 2019
Follow-up update to previous commit below -

Making a commit to improve on the existing script to kill TagUI processes.

For eg if Ctrl+C is used to kill TagUI prematurely, TagUI main process would lose the control to do clean-up of integrations (SikuliX, R, Python, Chrome) and Chrome browser.

This shell script (for all the 3 OSes) will kill those processes to free up memory and allows TagUI to start running from a clean state.

These actions are not done by default when TagUI is launched, as it is expected that TagUI exits cleanly. Otherwise cleaning up all processes by default will hide potential issues should they arise and they will end up not getting reported.
kensoh added a commit to tebelorg/TagUI that referenced this issue Jun 27, 2019
Follow-up update to previous 2 commits below -

Making a commit to improve on the existing script to kill TagUI processes.

For eg if Ctrl+C is used to kill TagUI prematurely, TagUI main process would lose the control to do clean-up of integrations (SikuliX, R, Python, Chrome) and Chrome browser.

This shell script (for all the 3 OSes) will kill those processes to free up memory and allows TagUI to start running from a clean state.

These actions are not done by default when TagUI is launched, as it is expected that TagUI exits cleanly. Otherwise cleaning up all processes by default will hide potential issues should they arise and they will end up not getting reported.
kensoh added a commit that referenced this issue Jun 27, 2019
Follow-up update to previous 2 commits below -

Making a commit to improve on the existing script to kill TagUI processes.

For eg if Ctrl+C is used to kill TagUI prematurely, TagUI main process would lose the control to do clean-up of integrations (SikuliX, R, Python, Chrome) and Chrome browser.

This shell script (for all the 3 OSes) will kill those processes to free up memory and allows TagUI to start running from a clean state.

These actions are not done by default when TagUI is launched, as it is expected that TagUI exits cleanly. Otherwise cleaning up all processes by default will hide potential issues should they arise and they will end up not getting reported.
kensoh added a commit to tebelorg/TagUI that referenced this issue Jun 28, 2019
Follow-up update to previous 3 commits below by improving to remove Linux warning message -

Making a commit to improve on the existing script to kill TagUI processes.

For eg if Ctrl+C is used to kill TagUI prematurely, TagUI main process would lose the control to do clean-up of integrations (SikuliX, R, Python, Chrome) and Chrome browser.

This shell script (for all the 3 OSes) will kill those processes to free up memory and allows TagUI to start running from a clean state.

These actions are not done by default when TagUI is launched, as it is expected that TagUI exits cleanly. Otherwise cleaning up all processes by default will hide potential issues should they arise and they will end up not getting reported.
kensoh added a commit that referenced this issue Jun 28, 2019
Follow-up update to previous 3 commits below by improving to remove Linux warning message -

Making a commit to improve on the existing script to kill TagUI processes.

For eg if Ctrl+C is used to kill TagUI prematurely, TagUI main process would lose the control to do clean-up of integrations (SikuliX, R, Python, Chrome) and Chrome browser.

This shell script (for all the 3 OSes) will kill those processes to free up memory and allows TagUI to start running from a clean state.

These actions are not done by default when TagUI is launched, as it is expected that TagUI exits cleanly. Otherwise cleaning up all processes by default will hide potential issues should they arise and they will end up not getting reported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant