sassoftware / saspy

A Python interface module to the SAS System. It works with Linux, Windows, and Mainframe SAS as well as with SAS in Viya.
https://sassoftware.github.io/saspy
Other
366 stars 149 forks source link

SASPY SUBMIT BECOMES UNRESPONSIVE AND DOES NOT PROCEED TO NEXT STEPS ALTHOUGH INTERNAL PROCESS IS DONE. #551

Closed mr2chowd closed 9 months ago

mr2chowd commented 11 months ago

Describe the bug We are using a python application that needs to connect to sas and run some sas code. We are using saspy library for this.

When the code is small, it goes through smoothly. When the code is large, it seems to run the code and finish the work and then becomes unresponsive and does not move to the next step although internal process is done. Python does not get a response from the submit and hence does not execute the next line.

To Reproduce Steps to reproduce the behavior: To Reproduce Steps to reproduce the behavior:

Open a SAS session using example code and set timeout to 350 minutes : sas_session = saspy.SASsession(cfgname=cfgname, cfgname = 'winionlinux', timeout=120) Submit a long running piece of SAS code e.g. sas.submit(""" Long running SAS macro """) SAS code doesn't complete and just seems to hang

tomweber-sas commented 11 months ago

Hey, can you show me the actual code you're running? Can I see the output? Submit sas_session after it's assigned so I can see the information from it. Can I see you're configuration also? Not sure about that timeout value; it's only something used when trying to connect to the workspace server. Has no effect on anything else. If you're getting a SASsession, then that's not really doing anything else. How long does the code you're running expect to run for? Can you run anything else successfully? Any information will help.

Thansk, Tom

mr2chowd commented 11 months ago

Good morning

Thank you for your reply. Most of the codes that we are running and which are supposed to take more than 50-60 minutes are not getting any response back even though, we can see on the folder the process is done.

We know for sure the code does not have any problem because it can directly run in the SAS Enterprise software but not on the Saspy.

I have attached a sample code below along with the configuration.

Any help is appreciated. Thank you

cfgfile=".\sascfg_personal.py" sas=saspy.SASsession(cfgfile=cfgfile,cfgname='winiomlinux') for i in range(1, 6): sas=saspy.SASsession(cfgfile=cfgfile,cfgname='winiomlinux') print(f"part {i} has begun") result= sas.submit(""" options NoFMTERR; libname user '/sasusers/Datahouse/Final/'; filename source '/sasusers/Run/'; %include source(test_chunks.sas);

%include source(set_macro_var.sas);
%chunk"""+str(i)+"""();
filename source clear;
""")
print(f"part {i} has finished")

These are sas configs: SAS_config_names = ['default', 'ssh', 'iomlinux', 'iomwin', 'winlocal', 'winiomlinux', 'winiomwin', 'httpsviya', 'httpviya', 'iomcom'] #!# #

!# SAS_config_names=['default']

Configuration options for saspy - python Dict # not required unless changing any of the defaults

valid key are:

#

'lock_down' - True | False. True = Prevent runtime overrides of SAS_Config values below

#

'verbose' - True | False. True = Allow print statements for debug type messages

#

'prompt' - True | False. True = Allow prompting as necessary

# SAS_config_options = {'lock_down': False, 'verbose' : True, 'prompt' : True }

Configuration options for SAS output. By default output is HTML 5.0 (using "ods html5" statement) but certain templates might not work

properly with HTML 5.0 so it can also be set to HTML 4.0 instead (using "ods html" statement). This option will only work when using IOM

in local mode. Note that HTML 4.0 will generate images separately which clutters the workspace and if you download the notebook as HTML,

the HTML file will need to be put in the same folder as the images for them to appear.

valid key are:

#

'output' = ['html5', 'html']

# SAS_output_options = {'output' : 'html5'} # not required unless changing any of the default

winiomlinux = {'java' : 'java', 'iomhost' : 'server.abc.ca', 'iomport' : 8591, 'authkey' : 'm_key', }


From: Tom Weber @.> Sent: Friday, July 28, 2023 10:32 AM To: sassoftware/saspy @.> Cc: Mohyminur Rahman Chowdhury @.>; Author @.> Subject: Re: [sassoftware/saspy] SASPY SUBMIT BECOMES UNRESPONSIVE AND DOES NOT PROCEED TO NEXT STEPS ALTHOUGH INTERNAL PROCESS IS DONE. (Issue #551)

Hey, can you show me the actual code you're running? Can I see the output? Submit sas_session after it's assigned so I can see the information from it. Can I see you're configuration also? Not sure about that timeout value; it's only something used when trying to connect to the workspace server. Has no effect on anything else. If you're getting a SASsession, then that's not really doing anything else. How long does the code you're running expect to run for? Can you run anything else successfully? Any information will help.

Thansk, Tom

— Reply to this email directly, view it on GitHubhttps://github.com/sassoftware/saspy/issues/551#issuecomment-1655793408, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AX7R3DZLOUMGYZMFCIZNND3XSPERDANCNFSM6AAAAAA23RCSOI. You are receiving this because you authored the thread.Message ID: @.***>

tomweber-sas commented 11 months ago

Thanks for that. So, as far as configuration, that's fine; simply connecting to a remote workspace server. That is good.

I see the code, but no output of any kind. When you run that, does it produce any output? You have it iterating, does more than one ever happen? Can you get the SAS LOG from any of this? Having no idea what's in those three different sets of code you're executing, I can't tell if there's something they are doing that could cause a problem, and if so, which one. Have you tried submitting each part in a separate submit() method, so you can tell if one of them is what's causing it to hang, and/or at least tell what the output is for each, that do run?

I would run this to see what I see so that I could narrow down where the problem is:

sas=saspy.SASsession(cfgfile=cfgfile,cfgname='winiomlinux')
print(sas)

sas.submitLOG("""
options NoFMTERR;
libname user '/sasusers/Datahouse/Final/';
filename source '/sasusers/Run/';
""")

sas.submitLST('%include source(test_chunks.sas);', method='logandlist')

sas.submitLST('%include source(set_macro_var.sas);', method='logandlist')

sas.submitLST('%chunk1();', method='logandlist')

sas.submitLOG('filename source clear;')
tomweber-sas commented 10 months ago

Do you still need help with this? Thanks, Tom

mr2chowd commented 10 months ago

Hey Tom

Sorry I was away on a vacation. Unfortunately, I couldn’t produce any logs since it just keeps running. Although I could see all the tables being generated fine and the process is finishing. It just doesn’t maybe get a response back or something that it got finished. Just doesn't move on to the next line after I hit submit.Not sure what’s happening

Thank you for all your help.


From: Tom Weber @.> Sent: Tuesday, August 22, 2023 11:56 AM To: sassoftware/saspy @.> Cc: Mohyminur Rahman Chowdhury @.>; Author @.> Subject: Re: [sassoftware/saspy] SASPY SUBMIT BECOMES UNRESPONSIVE AND DOES NOT PROCEED TO NEXT STEPS ALTHOUGH INTERNAL PROCESS IS DONE. (Issue #551)

Do you still need help with this? Thanks, Tom

— Reply to this email directly, view it on GitHubhttps://github.com/sassoftware/saspy/issues/551#issuecomment-1688482465, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AX7R3D7R6MSYLG2XMUIJOELXWTJDTANCNFSM6AAAAAA23RCSOI. You are receiving this because you authored the thread.Message ID: @.***>

tomweber-sas commented 10 months ago

No problem. I'm happy to help, but I have no information of any kind with which to help you. Can you run the code I provided above and show me the entire results. Also, what's the code in the files you are running? Without having any idea what you're running, it makes it harder to have any idea what could be going on. Have you tried just running the actual code from those files/macros one part at a time to see where the problem comes up? I can only guess that most of whatever you're running is working and something you're submitting is causing some problem? Narrowing it down its the first thing to do. That's easy enough is you submit whatever code you're submitting 'some at a time' to see where the problem presents itself.

If you ran the code above I'd see what version of saspy and SAS you're using, at least. Seeing the code you submitting would show if there something that is causing the problem. Are you doing anything like what's documented here, that would be a problem? https://sassoftware.github.io/saspy/limitations.html# There's a workaround for proc printto, so that can be addressed if that's the problem. Are you using an old version of saspy that's had a fix for whatever you're hitting? I just have no information to be able to help.

Thanks, Tom

tomweber-sas commented 9 months ago

Hey, I'm going to close this since I have nothing else to go on and haven't seen any information with which to help. If you'd like to continue looking into this, just reopen it. I'm happy to help, but haven't gotten any information so far. Tom