Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add sas 9 remote (via IOM bridge) support #592

Merged
merged 53 commits into from
Jan 15, 2024
Merged

feat: add sas 9 remote (via IOM bridge) support #592

merged 53 commits into from
Jan 15, 2024

Conversation

scottdover
Copy link
Contributor

@scottdover scottdover commented Oct 31, 2023

Summary
This adds sas 9 IOM bridge support. There are a few things to note here:

  • This uses ITC to connect to SAS 9 via the IOM bridge protocol. Our current local sas 9 connection uses the same underlying connection. Therefore, instead of recreating the wheel, our current com session was modified.
  • All of the connection files were moved from com -> itc to better match connection info
  • fetching file results no longer assumes the file is on your local machine. Instead, it uses the file service to grab the results from the last run

Testing

  • Test running multiple sas programs via SAS 9.4 (remote - IOM)
  • Test running multiple sas programs via SAS 9.4 (local)
  • Test running with and without ods results enabled
  • Tested printing ODS results of various sizes (small tables, tables w/ 1k+ rows)

@scottdover scottdover force-pushed the feat/sas9itc branch 5 times, most recently from dc67faa to 08ba0cf Compare November 1, 2023 14:04
@scottdover scottdover changed the title Feat/sas9itc feat: add sas 9 remote (via IOM bridge) support Nov 1, 2023
@scottdover scottdover marked this pull request as ready for review November 1, 2023 16:13
@scottdover scottdover requested review from smorrisj and scnwwu November 1, 2023 16:13
client/src/components/profile.ts Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
client/src/connection/itc/index.ts Outdated Show resolved Hide resolved
connect-and-run.md Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
client/src/node/extension.ts Show resolved Hide resolved
connect-and-run.md Outdated Show resolved Hide resolved
client/src/connection/itc/index.ts Show resolved Hide resolved
client/src/connection/itc/index.ts Outdated Show resolved Hide resolved
client/src/connection/itc/index.ts Show resolved Hide resolved
client/src/connection/itc/index.ts Outdated Show resolved Hide resolved
@scottdover scottdover added this to the 1.6.0 milestone Nov 9, 2023
@scottdover scottdover force-pushed the feat/sas9itc branch 3 times, most recently from af08bb2 to 1da05d1 Compare November 10, 2023 16:40
@scottdover scottdover force-pushed the feat/sas9itc branch 2 times, most recently from 6a83d60 to e93d523 Compare November 15, 2023 15:05
Copy link
Member

@scnwwu scnwwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks.

client/src/connection/itc/script.ts Outdated Show resolved Hide resolved
@Zhirong2022
Copy link
Collaborator

Create a new profile with SAS 9.4 (Remote-IOM). The property description is not consistent with the connection type. Put mouse over 'host', 'port' and 'username'.
image

@Zhirong2022
Copy link
Collaborator

I went through all the issues raised in PR.
And now only two left for verification:

  1. Unreadable Chinese characters, the root cause is that I use SAS Dark theme to render the specific SAS code. So, it is nothing to do with OS locale, VSC language configure or locale94/IOM connection.
  2. As @clangsmith mentioned the server configured with encrypted communications (specifically, Triple DES algorithm). It cannot connect to the server. I have no idea how to do verification.

@scottdover
Copy link
Contributor Author

As @clangsmith mentioned the server configured with encrypted communications (specifically, Triple DES algorithm). It cannot connect to the server. I have no idea how to do verification.

Fwiw, we believe this one is now resolved. @clangsmith tested this yesterday I believe

@clangsmith
Copy link
Contributor

As @clangsmith mentioned the server configured with encrypted communications (specifically, Triple DES algorithm). It cannot connect to the server. I have no idea how to do verification.

Fwiw, we believe this one is now resolved. @clangsmith tested this yesterday I believe

Correct. I have tested it and it is now (after Scott's fix) working as expected for me -- the ODS results are now appearing. I played around with that server using our extension for awhile and did not encounter any other issues.

@Zhirong2022
Copy link
Collaborator

Zhirong2022 commented Jan 12, 2024

The issue that Chinese characters were not rendered correctly has been fixed in the latest package. However I found a performance issue with coding running.
1.Suppose I ran the same sample code against old package and new package.
old package: 5-8 seconds to show result page
new package 50seconds-1miniute30seconds to show result page
2. If try to run the given code below to show a big table with same IOM connection.

proc print data=maps.africa;

old package: 1minute50seconds to show result table
new package: sometimes it will keep showing 'SAS code running' without any response.
At such scenario, try to cancel the running. The running man icon will be disabled even switching to a new profile.

@scottdover
Copy link
Contributor Author

scottdover commented Jan 12, 2024

The issue that Chinese characters were not rendered correctly has been fixed in the latest package. However I found a performance issue with coding running. 1.Suppose I ran the same sample code against old package and new package. old package: 5-8 seconds to show result page new package 50seconds-1miniute30seconds to show result page 2. If try to run the given code below to show a big table with same IOM connection.

proc print data=maps.africa;

old package: 1minute50seconds to show result table new package: sometimes it will keep showing 'SAS code running' without any response. At such scenario, try to cancel the running. The running man icon will be disabled even switching to a new profile.

This was one of my concerns in making a change to "collect all the bytes" first (in ad48cd1). Before this commit, we were reading bytes and writing them directly to a file. Now, we are storing all of the bytes in memory (which we'll eventually exhaust) and then attempting to encode all of them at once (which again, could be a problem for a huge number of bytes).

I'm not sure the best approach to take here. It seems the options are:

  • Write to the file system as often as possible, keeping a lower memory overhead but ending up with some encoding issues, or...
  • Write to the file system once, with a much higher memory footprint and potential for failed runs, but no encoding issues

@clangsmith @smorrisj @scnwwu Thoughts on how to proceed, here?

@scnwwu
Copy link
Member

scnwwu commented Jan 12, 2024

The issue that Chinese characters were not rendered correctly has been fixed in the latest package. However I found a performance issue with coding running. 1.Suppose I ran the same sample code against old package and new package. old package: 5-8 seconds to show result page new package 50seconds-1miniute30seconds to show result page 2. If try to run the given code below to show a big table with same IOM connection.

proc print data=maps.africa;

old package: 1minute50seconds to show result table new package: sometimes it will keep showing 'SAS code running' without any response. At such scenario, try to cancel the running. The running man icon will be disabled even switching to a new profile.

This was one of my concerns in making a change to "collect all the bytes" first (in ad48cd1). Before this commit, we were reading bytes and writing them directly to a file. Now, we are storing all of the bytes in memory (which we'll eventually exhaust) and then attempting to encode all of them at once (which again, could be a problem for a huge number of bytes).

I'm not sure the best approach to take here. It seems the options are:

  • Write to the file system as often as possible, keeping a lower memory overhead but ending up with some encoding issues, or...
  • Write to the file system once, with a much higher memory footprint and potential for failed runs, but no encoding issues

@clangsmith @smorrisj @scnwwu Thoughts on how to proceed, here?

Some thoughts:

  1. How about simply read files with Nodejs for local connection (same as main branch)? Currently it already checks this._config.protocol === ITCProtocol.COM to resolve file path. I don't know if it will be faster than the IOM approach. If we're not able to make a perfect solution for remote IOM, at least it's not a regression compared to v1.5.
  2. How about replace System.IO.StreamWriter with System.IO.FileStream? So we read bytes and write bytes thus can be safely sliced. I guess this is a desired way if it works, as it supports text and non-text files uniformly.
  3. If the above doesn't work, how about replace $objFile.OpenBinaryStream with $objFile.OpenTextStream? It looks like designed for characters.

@clangsmith
Copy link
Contributor

The issue that Chinese characters were not rendered correctly has been fixed in the latest package. However I found a performance issue with coding running. 1.Suppose I ran the same sample code against old package and new package. old package: 5-8 seconds to show result page new package 50seconds-1miniute30seconds to show result page 2. If try to run the given code below to show a big table with same IOM connection.

proc print data=maps.africa;

old package: 1minute50seconds to show result table new package: sometimes it will keep showing 'SAS code running' without any response. At such scenario, try to cancel the running. The running man icon will be disabled even switching to a new profile.

This was one of my concerns in making a change to "collect all the bytes" first (in ad48cd1). Before this commit, we were reading bytes and writing them directly to a file. Now, we are storing all of the bytes in memory (which we'll eventually exhaust) and then attempting to encode all of them at once (which again, could be a problem for a huge number of bytes).
I'm not sure the best approach to take here. It seems the options are:

  • Write to the file system as often as possible, keeping a lower memory overhead but ending up with some encoding issues, or...
  • Write to the file system once, with a much higher memory footprint and potential for failed runs, but no encoding issues

@clangsmith @smorrisj @scnwwu Thoughts on how to proceed, here?

Some thoughts:

  1. How about simply read files with Nodejs for local connection (same as main branch)? Currently it already checks this._config.protocol === ITCProtocol.COM to resolve file path. I don't know if it will be faster than the IOM approach. If we're not able to make a perfect solution for remote IOM, at least it's not a regression compared to v1.5.
  2. How about replace System.IO.StreamWriter with System.IO.FileStream? So we read bytes and write bytes thus can be safely sliced. I guess this is a desired way if it works, as it supports text and non-text files uniformly.
  3. If the above doesn't work, how about replace $objFile.OpenBinaryStream with $objFile.OpenTextStream? It looks like designed for characters.

@scottdover and I stepped through the EG code and we are now doing essentially the same thing that EG is (pseudo-code):

binaryStream = SAS.IFileref.OpenBinaryStream(Mode.StreamOpenModeForReading)
while (true)
{
	binaryStream.Read(CommonDownloadHelper.ChunkSize, out data); // EG ChunkSize is 8192
	if (data == null || data.Length == 0)
		break;
	fileStream.Write((byte[])data, 0, data.Length);
}

The previous issue is that we were encoding the byte chunks as we received them, which would break up DBCS characters if they fell on the border.

The testing I have done since the last fix appears to have resolved the issue. I also feel good knowing this is now the same way that EG handles it, considering EG has been doing it for many years (field-proven experience).

(Btw, given that printing maps.africa generates a 20MB results file, I consider that to be an edge-case scenario. EG doesn't even attempt to open results files larger than 5MB by default. I still tried this scenario in the extension with the latest changes, and it was successful, but took about a minute total before I saw the results. This is not unreasonable in my opinion.)

@scnwwu, @Zhirong2022, when you all return next week, please take another look, and if you feel this is reasonably addressed, don't encounter any other serious issues, or have any other concerns, please feel free to go ahead and merge this in.

@Zhirong2022
Copy link
Collaborator

All issues have been fixed properly.

@Zhirong2022 Zhirong2022 added testing-complete Complete the pull requests testing and removed testing Test the pull requests labels Jan 15, 2024
@scnwwu scnwwu merged commit c25c6ea into main Jan 15, 2024
1 check passed
@scnwwu scnwwu deleted the feat/sas9itc branch January 15, 2024 03:06
@scottdover
Copy link
Contributor Author

Thanks, @scnwwu and @Zhirong2022 🎉

@Zhirong2022 Zhirong2022 added ready for release Code pushed, but not released in VS code marketplace yet and removed testing-complete Complete the pull requests testing labels Jan 15, 2024
@Zhirong2022 Zhirong2022 added automation Issue has been covered by automation test and removed ready for release Code pushed, but not released in VS code marketplace yet labels Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation Issue has been covered by automation test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants