Replies: 2 comments 1 reply
-
Hey, yes there is. Though, as the connection form Python to SAS is asynchronous, there's the possibility that saspy doesn't know SAS has been terminated until after it tries to make a submission to it. The way to check is the SASpid attribute of the SASsession object. While the connection is valid (alive) it has the actual SAS processes pid value. When saspy sees the connection is terminated (for whatever reason), it changes that value to None. So is you have a SASsession names
|
Beta Was this translation helpful? Give feedback.
-
I'm not sure I understand the first part. You're not controlling anything by the pid, that's just a variable you can check. I set it to None when I find the connection is gone; wherever in the code that happens to be. What kind of error you get from a given method, if SAS terminates, will vary depending upon what code was running. It may throw an exception, or it may handle it and print a message (and set SASpid to None). It just depends on what code is being run and how it finds out SAS isn't there. That can also vary by access method too. You will usually see the following message in the log too. I was curious that wasn't in the code I posted above.
|
Beta Was this translation helpful? Give feedback.
-
Hello guys,
Is there a way to check if there is an existing connection instead of establishing a new one? Is it possible to check if the existing connection is alive?
I just want to create a simple code to check the questions above before creating new unneeded connections.
Beta Was this translation helpful? Give feedback.
All reactions