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

Fixed error forwarding to client for failed command executions #432

Merged
merged 1 commit into from Dec 8, 2023

Conversation

TripleKai
Copy link
Contributor

@TripleKai TripleKai commented Dec 1, 2023

Description

Added error forwarding to client upon any command execution failures. Allows proper error workflow to complete for internal errors.

Fixes #257

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Tested with plain bazel test //... to ensure all pass as well as bazel test //... after adding deliberate modifications to deployment-examples/docker-compose/worker.json to ensure error forwarding to client (ex. "entrypoint_cmd": "foo").

Checklist

  • Updated documentation if needed
  • Tests added/amended
  • bazel test //... passes locally
  • PR is contained in a single commit, using git amend see some docs

This change is Reviewable

Copy link
Collaborator

@MarcusSorealheis MarcusSorealheis left a comment

Choose a reason for hiding this comment

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

There are two small concerns

First, it would be great if you could amend this commit, git commit --amend, and force push a test, git push -f. The reason for it is we need to have regression detection in pace specifically for this bug. It was a tricky one for a first contribution, especially when new to Rust, so I commend you.

The second thing is a nit:

I would change the commit message to Fixes because this code lives on. Also, in the PR description, is "displays" the correct word?

Reviewable status: 0 of 1 files reviewed, all discussions resolved

Copy link
Collaborator

@MarcusSorealheis MarcusSorealheis left a comment

Choose a reason for hiding this comment

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

note (I'm still ramping on Reviewable myself some days): Needs tests

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @TripleKai)


-- commits line 2 at r1:
nit: Fixes

Copy link
Collaborator

@allada allada left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @MarcusSorealheis and @TripleKai)

a discussion (no related file):
We need a test for this. @TripleKai , do you want to take a swing at making a test for it?


@TripleKai
Copy link
Contributor Author

Sounds good, I'll make those changes for the commit and reword the description to something like "Added error forwarding to client upon any command execution failures. Allows proper error workflow to complete for internal errors."

@TripleKai
Copy link
Contributor Author

Previously, allada (Nathan (Blaise) Bruer) wrote…

We need a test for this. @TripleKai , do you want to take a swing at making a test for it?

Sure thing, I'll give it a try

@TripleKai
Copy link
Contributor Author

And thanks for the praise, I'm glad I could contribute!

Copy link
Collaborator

@allada allada left a comment

Choose a reason for hiding this comment

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

Awesome, good job. Just some minor nits and :lgtm:

Reviewed 1 of 1 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @blakehatch and @TripleKai)


native-link-scheduler/tests/simple_scheduler_test.rs line 1409 at r2 (raw file):

    #[tokio::test]
    async fn ensure_task_or_worker_change_notification_received_test() -> Result<(), Error> {

nit: Please add a comment above referencing the ticket this regression test is checking.


native-link-scheduler/tests/simple_scheduler_test.rs line 1420 at r2 (raw file):

        let mut rx_from_worker1 = setup_new_worker(&scheduler, WORKER_ID1, PlatformProperties::default()).await?;
        let insert_timestamp = make_system_time(1);

nit: inline this.


native-link-scheduler/tests/simple_scheduler_test.rs line 1441 at r2 (raw file):

        }

        let action_info_hash_key = ActionInfoHashKey {

nit: inline this.


native-link-scheduler/tests/simple_scheduler_test.rs line 1459 at r2 (raw file):

        {
            // Other tests check full data. We only care if we got StartAction.
            match rx_from_worker2.recv().await.unwrap().update {

Nit: use ?

Code quote:

.unwrap()

@TripleKai
Copy link
Contributor Author

Sure thing, will do

@TripleKai
Copy link
Contributor Author

native-link-scheduler/tests/simple_scheduler_test.rs line 1459 at r2 (raw file):

Previously, allada (Nathan (Blaise) Bruer) wrote…

Nit: use ?

I tried converting the whole "match" expression into something like "rx_from_worker2.recv().await?.update;"
but this doesn't work because "recv()" returns an Option and our test function returns a Result, so I see a complaint when trying to use "?". Am I misusing this "?" operator?

Copy link
Collaborator

@allada allada left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @blakehatch and @TripleKai)


native-link-scheduler/tests/simple_scheduler_test.rs line 1459 at r2 (raw file):

Previously, TripleKai (Kailash Saravanan) wrote…

I tried converting the whole "match" expression into something like "rx_from_worker2.recv().await?.update;"
but this doesn't work because "recv()" returns an Option and our test function returns a Result, so I see a complaint when trying to use "?". Am I misusing this "?" operator?

try:

.er_tip(|| "worker went away")?

Signed-off-by: Kailash Saravanan <kskeystone@gmail.com>
@TripleKai TripleKai force-pushed the client_hang_error_forward_fix branch from 5f18628 to 52763a7 Compare December 7, 2023 17:31
Copy link
Collaborator

@allada allada left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @blakehatch and @TripleKai)

Copy link
Contributor

@adam-singer adam-singer left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @blakehatch and @TripleKai)

@TripleKai
Copy link
Contributor Author

-- commits line 2 at r1:

Previously, MarcusSorealheis (Marcus Eagan) wrote…

nit: Fixes

Just commenting here to mention this is done

Copy link
Collaborator

@allada allada left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @blakehatch and @MarcusSorealheis)

Copy link
Collaborator

@allada allada left a comment

Choose a reason for hiding this comment

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

Dismissed @MarcusSorealheis and @TripleKai from a discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TripleKai)

@allada allada merged commit 0c225da into TraceMachina:main Dec 8, 2023
16 checks passed
@MarcusSorealheis
Copy link
Collaborator

Amazing!

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.

Errors should be forwarded to client if it could not execute command
5 participants