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

Properly kill the buck2 daemon #5373

Closed
wants to merge 1 commit into from
Closed

Conversation

dbort
Copy link
Contributor

@dbort dbort commented Sep 14, 2024

Fix the buck2 kill command. Because of scoping issues, in some cases we only ran " kill" because the local value of $BUCK2 was empty.

This should help avoid failures like

  Error validating working directory
  Caused by:
      0: Failed to stat `/home/ubuntu/cmodi/executorch/buck-out/v2`
      1: ENOENT: No such file or directory

which are typically fixed by running buck2 kill.

Add "COMMAND_ECHO" to the kill command to show what we're running.

Also, make the function consistently use executorch_root as the working directory. We should always run buck2 from the ET repo.

Test Plan:

rm -rf buck-out
(rm -rf cmake-out \
    && mkdir cmake-out \
    && cd cmake-out \
    && cmake ..)

Output showed that the local variable works:

-- Resolved buck2 as /Users/***/local/executorch/cmake-out/buck2-bin/buck2-99773fe6f7963a72ae5f7b737c02836e.
-- Killing buck2 daemon
'/Users/***/local/executorch/cmake-out/buck2-bin/buck2-99773fe6f7963a72ae5f7b737c02836e kill'

And that the parent variable still works:

-- ******** Summary ********
...
--   BUCK2                         : /Users/***/local/executorch/cmake-out/buck2-bin/buck2-99773fe6f7963a72ae5f7b737c02836e

Copy link

pytorch-bot bot commented Sep 14, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/5373

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit f278a60 with merge base a91eb8a (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 14, 2024
@facebook-github-bot
Copy link
Contributor

@dbort has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@dbort
Copy link
Contributor Author

dbort commented Sep 14, 2024

Didn't fix it. https://github.com/pytorch/executorch/actions/runs/10858643573/job/30136900450?pr=5373#step:9:651

  -- Resolved buck2 as buck2.
  'mkdir -p '/Users/ec2-user/runner/_work/executorch/executorch/pytorch/executorch/buck-out/v2''
  -- Killing buck2 daemon
  'buck2 kill'

...

  Caused by:
      0: Failed to stat `/Users/ec2-user/runner/_work/executorch/executorch/pytorch/executorch/buck-out/v2`
      1: ENOENT: No such file or directory

Fix the `buck2 kill` command. Because of scoping issues, in some cases
we only ran "` kill`" because the local value of `$BUCK2` was empty.

This should help avoid failures like

```
  Error validating working directory
  Caused by:
      0: Failed to stat `/home/ubuntu/cmodi/executorch/buck-out/v2`
      1: ENOENT: No such file or directory
```

which are typically fixed by running `buck2 kill`.

Add "COMMAND_ECHO" to the kill command to show what we're running.

Also, make the function consistently use `executorch_root` as the
working directory. We should always run buck2 from the ET repo.

Test Plan:

```
rm -rf buck-out
(rm -rf cmake-out \
    && mkdir cmake-out \
    && cd cmake-out \
    && cmake ..)
```

Output showed that the local variable works:
```
-- Resolved buck2 as /Users/***/local/executorch/cmake-out/buck2-bin/buck2-99773fe6f7963a72ae5f7b737c02836e.
'mkdir -p '/Users/***/local/executorch/buck-out/v2''
-- Killing buck2 daemon
'/Users/***/local/executorch/cmake-out/buck2-bin/buck2-99773fe6f7963a72ae5f7b737c02836e kill'
```

And that the parent variable still works:
```
-- ******** Summary ********
...
--   BUCK2                         : /Users/***/local/executorch/cmake-out/buck2-bin/buck2-99773fe6f7963a72ae5f7b737c02836e
```
@dbort dbort changed the title Create buck-out/v2 dir, and properly kill the buck2 daemon Properly kill the buck2 daemon Oct 2, 2024
@dbort
Copy link
Contributor Author

dbort commented Oct 2, 2024

Reducing the scope of this PR to fix the buck2 kill part since that's still helpful.

@facebook-github-bot
Copy link
Contributor

@dbort has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@dbort dbort closed this Oct 3, 2024
@dbort dbort deleted the mkdir-buck2 branch October 3, 2024 22:16
@dbort
Copy link
Contributor Author

dbort commented Oct 3, 2024

@pytorchbot cherry-pick --onto release/0.4 -c critical

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants