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

fix quoted commands not being parallelizable #744

Open
wants to merge 8 commits into
base: future
Choose a base branch
from

Conversation

kwakubiney
Copy link

@kwakubiney kwakubiney commented Jan 19, 2025

Attempt to fix #741

Copy link

OS =
CPU =
Ram =
Hash = f8e0d06
Kernel=
||
|-|-|-|-|-|-|-|-|-|

Copy link

OS:ubuntu-20.04
Sun Jan 19 18:29:29 UTC 2025
intro: 2/2 tests passed.
interface: 42/42 tests passed.
compiler: 54/54 tests passed.

Copy link

OS =
CPU =
Ram =
Hash = 17a4a54
Kernel=
||
|-|-|-|-|-|-|-|-|-|

Copy link

OS:ubuntu-20.04
Sun Jan 19 18:54:48 UTC 2025
intro: 2/2 tests passed.
interface: 42/42 tests passed.
compiler: 56/56 tests passed.

Copy link
Member

@angelhof angelhof left a comment

Choose a reason for hiding this comment

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

Thanks for the fix and for adding a test!

In addition to the change that I added in the text, it would also be great if you could rebase this to the future branch, since we always push new changes to future and then later push them to main everytime we do a release!

@@ -66,8 +66,10 @@ def parse_arg_list_to_command_invocation(
command, flags_options_operands
) -> CommandInvocationInitial:
cmd_name = format_arg_chars(command)
#strip quotes from command where necessary
#quoted commands are interpreted as non-parallelizable
cmd_name = cmd_name.strip().strip('"').strip("'")
Copy link
Member

Choose a reason for hiding this comment

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

I think it is better to do this change by making a new function replacing format_arg_chars since that function has access to the actual character codes and not just the string, making any transformation more robust! At this point in the execution, it should certainly be the case that command only is expanded and only has quotes (Q characters), normal (C), and escaped (E) characters I think. So we can make new function called remove_quotes_expanded_arg_chars that:

  1. First checks if the word is indeed expanded, only containing the characters above (to do this we need to traverse the whole argument hierarchically.
  2. Then removes the outer layers of quotes (if any).

Copy link
Author

@kwakubiney kwakubiney Jan 28, 2025

Choose a reason for hiding this comment

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

I attempted this in my latest commit but seems to be breaking some tests. Not sure if I am making an obvious error

@kwakubiney kwakubiney force-pushed the fix/quoted-commands-not-parallelizable branch from 17a4a54 to 6e30d15 Compare January 23, 2025 02:28
@kwakubiney kwakubiney changed the base branch from main to future January 23, 2025 02:29
Copy link

OS =
CPU =
Ram =
Hash = 6e30d15
Kernel=
||
|-|-|-|-|-|-|-|-|-|

Copy link

OS:ubuntu-20.04
Thu Jan 23 02:31:33 UTC 2025
intro: 2/2 tests passed.
interface: 42/42 tests passed.
compiler: 46/56 tests passed.
tee_web_index_bug.sh are not identical
tee_web_index_bug.sh are not identical
bigrams.sh are not identical
bigrams.sh are not identical
topn.sh are not identical
topn.sh are not identical
alt_bigrams.sh are not identical
alt_bigrams.sh are not identical
tr-test.sh are not identical
tr-test.sh are not identical

@kwakubiney kwakubiney force-pushed the fix/quoted-commands-not-parallelizable branch from 6e30d15 to 145c130 Compare January 23, 2025 02:33
Copy link

OS =
CPU =
Ram =
Hash = 145c130
Kernel=
||
|-|-|-|-|-|-|-|-|-|

Copy link

OS:ubuntu-20.04
Thu Jan 23 02:36:00 UTC 2025
intro: 2/2 tests passed.
interface: 42/42 tests passed.
compiler: 46/56 tests passed.
tee_web_index_bug.sh are not identical
tee_web_index_bug.sh are not identical
bigrams.sh are not identical
bigrams.sh are not identical
topn.sh are not identical
topn.sh are not identical
alt_bigrams.sh are not identical
alt_bigrams.sh are not identical
tr-test.sh are not identical
tr-test.sh are not identical

@kwakubiney kwakubiney marked this pull request as draft January 23, 2025 02:51
@kwakubiney kwakubiney marked this pull request as ready for review January 23, 2025 02:52
Copy link

OS =
CPU =
Ram =
Hash = c63fbdd
Kernel=
||
|-|-|-|-|-|-|-|-|-|

Copy link

OS:ubuntu-20.04
Thu Jan 23 02:55:40 UTC 2025
intro: 2/2 tests passed.
interface: 42/42 tests passed.
compiler: 54/56 tests passed.
quoted_cmd.sh are not identical
quoted_cmd.sh are not identical

@kwakubiney kwakubiney marked this pull request as draft January 23, 2025 03:32
@kwakubiney kwakubiney force-pushed the fix/quoted-commands-not-parallelizable branch 2 times, most recently from f8e0d06 to 145c130 Compare January 26, 2025 00:31
BolunThompson and others added 5 commits January 28, 2025 07:57
* Fix typo

Signed-off-by: Bolun Thompson <[email protected]>

* Add check that compile_ast result is an IR

Signed-off-by: Bolun Thompson <[email protected]>

* Add return type hint to compile_node

Signed-off-by: Bolun Thompson <[email protected]>

---------

Signed-off-by: Bolun Thompson <[email protected]>
* Fix: inform_daemon_exit on assertion exit

Otherwise, --assert_compiler_success hangs.
--assert_all_regions_parallelizable doesn't fail,
but I also copied the change there.
The tests using the flag pass.

Signed-off-by: Bolun Thompson <[email protected]>

* Fix: correctly parse "is parallelizable" output

Signed-off-by: Bolun Thompson <[email protected]>

---------

Signed-off-by: Bolun Thompson <[email protected]>
* Fix double-exit bug in parallel pipelines

Signed-off-by: Bolun Thompson <[email protected]>

* Assert running_procs is positive

Signed-off-by: Bolun Thompson <[email protected]>

* Fix: don't use exit handler

The reason why it worked on Ubuntu 20.04 was that the EXIT handler was
not called, while on Ubuntu 24.04 it correctly is.

Signed-off-by: Bolun Thompson <[email protected]>

* Add comment explanation

Signed-off-by: Bolun Thompson <[email protected]>

---------

Signed-off-by: Bolun Thompson <[email protected]>
@kwakubiney kwakubiney force-pushed the fix/quoted-commands-not-parallelizable branch from 145c130 to 5301786 Compare January 28, 2025 07:58
commands to be parallelizable

Signed-off-by: kwakubiney <[email protected]>
@kwakubiney kwakubiney force-pushed the fix/quoted-commands-not-parallelizable branch from 5301786 to 4afd1b9 Compare January 28, 2025 08:07
Signed-off-by: kwakubiney <[email protected]>
@kwakubiney kwakubiney marked this pull request as ready for review January 28, 2025 08:11
Copy link

OS =
CPU =
Ram =
Hash = 72d9793
Kernel=
||
|-|-|-|-|-|-|-|-|-|

Copy link

OS:ubuntu-20.04
Tue Jan 28 08:14:08 UTC 2025
intro: 2/2 tests passed.
interface: 42/42 tests passed.
compiler: 46/56 tests passed.
tee_web_index_bug.sh are not identical
tee_web_index_bug.sh are not identical
bigrams.sh are not identical
bigrams.sh are not identical
topn.sh are not identical
topn.sh are not identical
alt_bigrams.sh are not identical
alt_bigrams.sh are not identical
tr-test.sh are not identical
tr-test.sh are not identical

Copy link

OS:ubuntu-24.04
Tue Jan 28 08:14:33 UTC 2025
intro: 2/2 tests passed.
interface: 42/42 tests passed.
compiler: 46/56 tests passed.
tee_web_index_bug.sh are not identical
tee_web_index_bug.sh are not identical
bigrams.sh are not identical
bigrams.sh are not identical
topn.sh are not identical
topn.sh are not identical
alt_bigrams.sh are not identical
alt_bigrams.sh are not identical
tr-test.sh are not identical
tr-test.sh are not identical

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.

Quoted commands aren’t recognized as being parallelizable
3 participants