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

Runner service implementation feature parity #226

Merged
merged 11 commits into from Feb 27, 2023

Conversation

mxsdev
Copy link
Contributor

@mxsdev mxsdev commented Feb 21, 2023

  • Run background=true as background tasks
  • User-prompts (UI) for ENV variables
  • Unify cmds/script prep?
  • Allow identification of grpc-created terminals

Needs changes in runme service:

  • Curl-ing img (last cell in examples/README.md) with notebook-native png renderer crash-hangs #143
  • Cat-ing LICENSE (in examples/README.md) does not work #144 #155

@mxsdev mxsdev linked an issue Feb 21, 2023 that may be closed by this pull request
5 tasks
@mxsdev
Copy link
Contributor Author

mxsdev commented Feb 23, 2023

Should be mostly done, basically waiting on #155.

I would like to do more testing on the user prompting for env variables, both with and without the grpc runner, since this got changed a bit on both ends.

@mxsdev mxsdev marked this pull request as ready for review February 24, 2023 16:12
Copy link
Member

@sourishkrout sourishkrout left a comment

Choose a reason for hiding this comment

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

Left some comments in the code. From a functional point of view, it appears that "export-only" cells have some unindented behavior.

Please see this clip: https://i.imgur.com/jqYi1yH.mp4

We could rebase and merge this PR and move the remaining issue to a new one. Up to you @mxsdev.

const MIME_TYPES_WITH_CUSTOM_RENDERERS = ['text/plain']

export async function executeRunner(
context: ExtensionContext,
Copy link
Member

Choose a reason for hiding this comment

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

Side note: one of the reasons why I think this the function-abstraction of Executors won't suffice long-term. Not part of this PR, though.

src/extension/executors/runner.ts Outdated Show resolved Hide resolved
/**
* evaluate expression
*/
const expression = placeHolder.slice(2, -1)
const expressionProcess = cp.spawn(expression, {
const expressionProcess = cp.spawn(value, {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this use the Runner APIs versus spawning child processes? Consider addressing in follow up issue/PR.

Copy link
Contributor Author

@mxsdev mxsdev Feb 27, 2023

Choose a reason for hiding this comment

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

The runner executor uses getCommandExportExtractMatches directly - it does not call retrieveShellCommand.

Copy link
Member

Choose a reason for hiding this comment

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

great 👌 , thanks for clarifying!

@@ -106,8 +111,8 @@ export function getKey(runningCell: vscode.TextDocument): keyof typeof executor
* treat cells like like a series of individual commands
* which need to be executed in sequence
*/
export function getCmdShellSeq(cellText: string, os: string): string {
const trimmed = cellText
export function getCmdSeq(cellText: string): string[] {
Copy link
Member

Choose a reason for hiding this comment

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

Once the TUI is using the Runner to execute commands we should consider GRPC exposing APIs to prep an input as a sequence of commands so both Ext/TUI plausible work the same way. Let's make a ticket for this if we haven't already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mxsdev
Copy link
Contributor Author

mxsdev commented Feb 27, 2023

@sourishkrout

Tested with the main example readme and every script worked for me.

Could you test against really quick with the latest changes? Thanks!

@sourishkrout
Copy link
Member

@sourishkrout

Tested with the main example readme and every script worked for me.

Could you test against really quick with the latest changes? Thanks!

Confirmed. Great job 👏

Another thing I noticed is that closeTerminalOnSuccess does not seem to have an effect? Just on my end, @mxsdev?

Copy link
Member

@sourishkrout sourishkrout left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@mxsdev
Copy link
Contributor Author

mxsdev commented Feb 27, 2023

I was able to fix tests, but for the following line in tests/extension/executors/utils.test.ts:

vi.mock('../../../src/extension/utils', () => ({
  replaceOutput: vi.fn(),
}))

I was not able to use importActual as it would result in the process hanging. I guess this is due to cyclic dependency, but that's supposed to be fixed, so idk.

In the meantime I just mocked the method, but this is less than ideal since there's no need to mock it. Lmk if you think this is worth an issue @sourishkrout.

Anyways, this is still good to merge! 🎉

@mxsdev mxsdev merged commit 25482af into stateful:main Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Achieve legacy-extension execution parity
2 participants