How to Stop All Hive Jobs Spawned by Interactive SAS Session
Purpose
It is important to stop all Hive Jobs at the end of your SAS programing session. If Hive jobs are not stopped, they will continue to run for hours or even days until they time out. These unchecked Hive jobs can occupy large portions of your queue in SAS Viya and disrupt or derail any other programs users hope to run.
Note
Using the SAS Viya Global Macro %ps( ); will show you a list of processes that you are running.
Users can also run the code %queue_status() to verify the status of your programs and active queries.
Hive jobs are commonly spawned by Interactive SAS sessions. Simply by logging into SAS Viya in a browser, users are starting an interactive session. Signing in starts a SAS process that will be active until users log out of the SAS Viya application.
It is also important to note that when users submit a SAS program with the %hive_exec_sql(....) macro, it will start a Hive job that will return results to either Hive or SAS. If users cancel the submission in SAS Viya, the Hive job will continue to run. The Hive job does not get killed because the interactive SAS process is still running.
Best Practices
Best Practice 1
Users can easily kill the process by using the SAS Viya global macro %kill( );
To kill your process, just include the PID of the job you are trying to end:
%kill(PID);
Important
Users can only kill their own process - if they submit a PID that is for another user or that is invalid, nothing will happen, and the request will be ignored.
Best Practice 2
One additional way to guarantee that users kill all interactively submitted Hive jobs on the spot would be to sign out of SAS Viya. Signing out of SAS Viya immediately will kill the PID associated with the browser window. It is important to remember that just closing the browser does not kill the program as the session will continue to run.
Related articles