Replies: 12 comments 7 replies
-
Hey, I can help with this. There are two different things I would have input on. First is since your users are connecting to your SAS servers via EG, this means your deployment is a production deployment with workspace servers, metadata server, and configurations providing authentication and authorization. By having SASPy use STDIO to connect to the local Linux deployment, you're bypassing all of that deployment configuration. You're not connecting users to any workspace server, you're letting each just start independent SAS session on the Workspace server machine. The more correct way to connect is via the IOM access method, which uses metadata credential to connect to actual Workspace servers based upon metadata configuration. This is normally done by the clients themselves from their client machine. But, having the clients run scripts to call your server side python, is a choice; maybe you don't expect your users to have python on their own machines? So, 1st question is why wouldn't the users use IOM to connect to the workspace servers from their own machines, same as using EG? Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hey, thanks for that, that helps. Yes, I didn't expect the prompt to be the problem, but couldn't tell without more info. So that's good. What you have seems like it could work for you. I suspect the hang has something to do with your script or the system() function from the data step. I mocked up something similar and it worked fine with this method. I wasn't able to get what you show as '{workpathOnServer} {tableLocatedOnWorkpath}` to resolve to anything. I tried both SAS macros and environment variables, but I only get the stings themselves. Here's the script I tried:
And when I use the system() call from SAS:
Can you just run that python script locally without the hang? Can you comment out the SASPy parts and just have some prints so you can see if it's doing anythin g, or what it's getting as parms when calling it from SAS? Do you see it execute when called from SAS? Tom |
Beta Was this translation helpful? Give feedback.
-
Ok, so that's more clear. I see your notation of Are you saying that when you have an syntax error in the python code, that it returns, in EG, with that failure? As well as if you remove the saspy code (without python syntax errors), then it works in EG also? The python script actually ran and did something on the server side. And, I'm not really sure what you mean by the terms pipe-command and rc-command. I just see you're using the system function in the data step. Do you use those other terms to refer to that? Or is there something else that I'm missing? I'm curios of the case where you ran locally being Can you see if the python process that should be started from EG is actually running or not, when you try that case? Is the SAS process saspy tries to start, actually running on that machine or not? While EG is hung; what's happening on the server side? If it all works from EG except for when you do this, unless you try to use saspy in that script, then I can only think of permission issues where the userid starting the workspace server has issue with somethin gin the saspy config, like the file you're pointing to. But that would simply fail and return then. So, I'm really not sure what can be happening without looking at what's actually happening on that server side system when you try this. Tom |
Beta Was this translation helpful? Give feedback.
-
Actually, I was gonna see about getting on a teams call to see this, next. Let's do that, as it will make this much quicker to figure out! I can set that up, or you can, either way! Some time tomorrow? |
Beta Was this translation helpful? Give feedback.
-
Ok, I'm EST, so +5 currently. I'm a bit swamped right now with other (not saspy) customer problems I'm involved with. Can we set this up for Monday? I bet we can figure it out looking at it together. I do this with customers a fair amount and it does make strange things like this much easier to figure out! |
Beta Was this translation helpful? Give feedback.
-
Yes, please, that will be great! |
Beta Was this translation helpful? Give feedback.
-
Got it! I'll send an invite soon |
Beta Was this translation helpful? Give feedback.
-
Hi Tom! I got the things running. I figured out that SAS ships with a private java which means I don't need to install any separate java. Still a bit uncertain if this is a good setup with using the private runtime, but perhaps you can enlighten me on that? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Actually, that's perfectly fine. The IOM access method uses the Java IOM Client to interact with an actual workspace server, so that's the more correct way to connect; you're actually getting a defined workspace server same as EG. So any predefined libraries will already be assigned and any other configuration will be in place. As opposed to just starting your own SAS session. And, any java is fine, it just need a basic JVM for that client. So the JRE SAS ships with is just fine! That's Great! |
Beta Was this translation helpful? Give feedback.
-
I don't use that, no. For STDIO I don't know or care who the user is. For IOM, there needs to be metadata credentials, else you can't start a workspace server. So yes, I think this user issue is part of the problem, though I still am not sure why it would be hanging. Thus the diagnostics we were trying. Since we kelp getting permission problems, maybe try using a file in /tmp to get around that, so we can see if saspy is getting stderr or stdout back from SAS (cuz it seems to not be, else it shouldn't hang). |
Beta Was this translation helpful? Give feedback.
-
Okay, so I redirected the file to /tmp and now the script runs fine from console, but just hangs when executing from EG (without any permission errors thrown). The file however gets zero content in it, so there is nothing to be found in the log. |
Beta Was this translation helpful? Give feedback.
-
There's something off between what user is running this and what SAS settings are being used when trying it that way. Just didn't get far enough to see what was really going on with it. What happens when you run the script locally, but from that user: 'sas' was it? |
Beta Was this translation helpful? Give feedback.
-
Hi!
I've been up and down the documentation of saspy for a couple of days now and I feel I might need some help on this one.
First let me give you some background on what I'm working with.
We have a setup where we run SAS from on Linux (RHEL).
All of our end users have access to SAS through clients like SAS Enterprise Guide or other windows clients.
On the linux server I have installed a lot of python modules, like saspy and pandas to enable some of our end users to work with SAS data in python instead of only using SAS-code.
The setup seems to work fine and I am able to create python scripts with functions that call saspy to get tables in and out of SAS. The scripts run fine when I call them directly from the command prompt in putty.
Right now I am using the default connection in sascfg_personal.py and I have pointed the variable to match our folder tree for SASHome/SASFoundation/.../... so that we point out the correct binary file (sas_u8).
Now to my problem:
As mentioned before our users access SAS through clients like EG.
What I would like to achieve is that they can submit some sort of rc/x/pipe command towards the python code that is stored on the server and get the data back into a sas library in EG. Everything seems to be in order except one little thing and that is the connection between my client session and saspy.
As soon as I submit an rc-command from EG towards the python script the session just hangs and becomes unresponsive. I've tracked this down to the connection string to saspy that I have in my python-script. The connection string looks like this:
sas = saspy.SASsession(cfgfile='/home/xxx/.local/lib/python3.8/site-packages/saspy/sascfg_personal.py')
The above code works from command line, but not when submitting the script from EG. As said above, the session just hangs and gives zero response back to what might be wrong.
One other thing to mention is that I'm using the same user on the server as in EG, hence it's probably not an access right problem.
The difference as I can tell is that EG connects via the Metadata Server and executes on the workspace server while the putty session is directly towards the workspace server.
I have a hunch that it could have something to do with the connection typ used, but I am not sure and have not been able to connect with any other connection setup either.
Could someone please advice on how to proceed or come with some clever suggestions?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions