sassoftware / vscode-sas-extension

This SAS Extension for Visual Studio Code provides support for the SAS language, including features such as SAS syntax highlighting, code completion, hover help, code folding, outline, SAS code snippets and run SAS code.
https://sassoftware.github.io/vscode-sas-extension/
Apache License 2.0
105 stars 44 forks source link

Support for Remote SAS 9.4 #61

Closed gowerc closed 10 months ago

gowerc commented 1 year ago

Is your feature request related to a problem? Please describe.

My company/department currently has licensed SAS9.4. We work on a server that we SSH into and then use the terminal sas command to run programs. This extension doesn't appear to currently have any support for this way of working. Current work around is just to open a sas interactive session via sas --nodms and have a keyboard shortcut for submitting commands to the terminal however it would be great if this way of working + sas9.4 could have formal support.

Describe the solution you'd like Integration with local sas + sas9.4.

smorrisj commented 1 year ago

We're going to repurpose this issue to specifically target SAS 9.4 Remote Support implementation and testing of PR #134. We'll use #11 for adding support to target a local SAS installation. Thanks for logging this issue!

smorrisj commented 1 year ago

@Sonny-W would it be possible to assign this out for verification?

Becky-Williamson commented 1 year ago

Tested the following scenarios:

gowerc commented 1 year ago

Hey @Becky-Williamson & @smorrisj , Just wanted to say that when I tried testing this feature it looks like it doesn't work if the ssh address requires a proxy. At least within our company the main server requires a proxy entry point i.e. we have the following in our ~/.ssh/config files:

Host <ssh-server>
    User gowerc
    IdentityFile ~/.ssh/id_rsa
    ProxyCommand ssh -W %h:%p gowerc@<proxy-server>

If I just enter <ssh-server> into your host config setting it fails with error message:

getaddrinfo ENOTFOUND <ssh-server>

Source: SAS (Extension)

EDIT: Just to add encase it wasn't completely clear I've used <ssh-server> instead of the real server address as I'm not sure if I'm allowed to post the addresses publicly :)

gowerc commented 1 year ago

Hi @Becky-Williamson & @smorrisj ,

Testing this against a different server that doesn't need a proxy it appears that the connection / state does not persist e.g.

If I submit:

data test;
    set sashelp.iris;
run;

NOTE: There were 150 observations read from the data set SASHELP.IRIS. NOTE: The data set WORK.TEST has 150 observations and 5 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds

However if I then submit the following on the same connection:

data test2;
    set test;
run;

ERROR: File WORK.TEST.DATA does not exist.

I'm afraid that the functionality isn't overly useful to my team if it can only handle batch (complete program) submissions :(. At least not in how we currently work / use SAS. Would the local sas feature being developed for #11 also have these same limitations ?

smorrisj commented 1 year ago

Hey @Becky-Williamson & @smorrisj , Just wanted to say that when I tried testing this feature it looks like it doesn't work if the ssh address requires a proxy. At least within our company the main server requires a proxy entry point i.e. we have the following in our ~/.ssh/config files:

@gowerc thanks for testing this out. We can look into implementing support for a jump connection. If it's agreeable could we possibly track this feature in a separate issue?

smorrisj commented 1 year ago

I'm afraid that the functionality isn't overly useful to my team if it can only handle batch (complete program) submissions :(. At least not in how we currently work / use SAS. Would the local sas feature being developed for #11 also have these same limitations ?

@gowerc thanks for reporting. It seems like there is possibly a bug in how the session is being handled where the work tables are not persisting. I can look into this and report back.

smorrisj commented 1 year ago

When I dump out the work directories in between the two runs on the same connection, I'm seeing two different directory names in /tmp.

When I look at the run command, it's calling setup and run functions on the session every time the run button is pressed. The problem here is that for the ssh connection provider the setup function essentially reconnects to the server and starts up sas again in -nodms mode.

I think that the desired functionality we want is for it to behave closer to how interactive line mode behaves, meaning that we invoke sas once, perform 1-n commands and then exit when the close button is pressed.

smorrisj commented 1 year ago

Bug logged for the session issue on #155

gowerc commented 1 year ago

@gowerc thanks for testing this out. We can look into implementing support for a jump connection. If it's agreeable could we possibly track this feature in a separate issue?

Yup am happy for this to be a separate issue, do you want me to create it ?

HwangWonYoung commented 1 year ago

Tested the following scenarios:

  • Create 9.4 ssh profile using VSC prompts
  • Create 9.4 ssh profile manually in json
  • Run SAS code connected to 9.4
  • Switching between ssh and viya profiles
  • Verify that Explorer pane is not displayed in when connected to 9.4
  • Verify that SYSTEM options can be defined in profile

Can I get an example of creating 9.4 ssh profile in detail?

Becky-Williamson commented 1 year ago

@HwangWonYoung, information on creating the 9.3 ssh profile can be found in the Details tab for the SAS Extension.

HwangWonYoung commented 1 year ago

@Becky-Williamson Thanks for quick reply! Is it possible using this extension when using SAS Connect over TCP/IP without SSH?

cjdinger commented 1 year ago

@HwangWonYoung SAS/CONNECT allows one SAS session to connect and exchange data/code/results with another SAS session. So this extension still needs to connect to a SAS session using one of the supported methods (like ssh), and then that SAS session could connect to another SAS session via rsubmit and other traditional SAS/CONNECT methods.

smorrisj commented 1 year ago

Yup am happy for this to be a separate issue, do you want me to create it ?

@gowerc apologies for the delay. That would be great. Thanks!

HwangWonYoung commented 1 year ago

@cjdinger Hi, I'm trying to set up this extension using visx file because my sas is in offline environment. I downloaded file at this url(https://marketplace.visualstudio.com/items?itemName=SAS.sas-lsp), but it doesn't seem it reflects this feature(support for remote sas). Can you please check if the latest version is uploaded? Thank you in advance.

GaryLiuTelus commented 1 year ago

Just tested and could not connect to the remote server, and got below error when submitting SAS script:

SSH_AUTH_SOCK not set, Check Environment Variables.

My Environment:

OS: Window 10 Remote server in within VPN

Extension settings: image

Any suggestions? What value I should assign to SSH_AUTH_SOCK system variable?

smorrisj commented 1 year ago

Hi @GaryLiuTelus, see #202 for how to set this up to run on windows.

gro1m commented 1 year ago

@gowerc thanks for testing this out. We can look into implementing support for a jump connection. If it's agreeable could we possibly track this feature in a separate issue?

Yup am happy for this to be a separate issue, do you want me to create it ?

@gowerc Did you create an issue for this or did you find another way?

shenzj1994 commented 1 year ago

Hi @smorrisj , I am having the same issue as @GaryLiuTelus and we use username and password to authenticate SSH with the server. Do we have support for this type of authentication?

smorrisj commented 1 year ago

@shenzj1994 currently we only support password-less authentication using public and private key pair where the private key is registered with the ssh-agent.

smorrisj commented 1 year ago

Hi @smorrisj , I am having the same issue as @GaryLiuTelus and we use username and password to authenticate SSH with the server. Do we have support for this type of authentication?

@shenzj1994 if it's agreeable do you mind logging an issue for this? We may be able to use the extension api's secret storage facility to securely support a username/password type auth.

scnwwu commented 10 months ago

Additional requests tracked in separated issues, closing this one.