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 FIFTYONE_ENABLE_ORCHESTRATOR_REGISTRATION warning behavior #5036

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

swheaton
Copy link
Contributor

@swheaton swheaton commented Nov 4, 2024

when this env var is set, it doesn't care that the op is not delegated to throw the error.

What changes are proposed in this pull request?

Cases:

  • allow immediate: "execute"
    • orch reg: previously warns ⚠️ <------------------------- fix here
    • no orch reg: 👍🏼
  • allow delegated
    • orchs
      • orch reg: Schedule on orch1, schedule on orch2 ...
      • no orch reg: ⚠️ deployment misconfiguration 🤷🏼‍♂️
    • no orchs
      • orch reg: Correctly warns
      • no orch reg: "Schedule"
  • allow both
    • orchs
      • orch reg: Execute, schedule on orch1, schedule on orch2 ...
      • no orch reg: ⚠️ deployment misconfiguration 🤷🏼‍♂️
    • no orchs
      • orch reg: previously warns ⚠️ <------------------------- fix here
      • no orch reg: "Execute, Schedule"
  • allow nothing: 🤷🏼‍♂️

The conditional soup is kind of a jumble here but from all the cases listed out above, all we need to do is require that allowImmediate is false in order to show the warning message. If it's true we know we'll at least have the "Execute" button and so should be able to run it. If there are registered orchs they should show up in the dropdown.

How is this patch tested? If it is not, please explain why.

set env var, see that I can execute any non-delegated operator. Delegated ops still gets the error correctly

Summary by CodeRabbit

  • New Features

    • Improved user notifications for operator execution options based on available orchestrators.
  • Bug Fixes

    • Enhanced error handling for abort errors, improving clarity and readability.

Copy link
Contributor

coderabbitai bot commented Nov 4, 2024

Walkthrough

The changes in this pull request focus on modifying the functionality of the state.ts file, particularly regarding operator execution options and prompt management. A new condition has been added to the useOperatorPromptSubmitOptions function, affecting how warnings about orchestrators are displayed based on the allowImmediateExecution flag. Additionally, the error handling in the execute function of the useOperatorExecutor hook has been refined for better clarity, without introducing new functions or altering existing ones.

Changes

File Change Summary
app/packages/operators/src/state.ts - Modified useOperatorPromptSubmitOptions to conditionally display orchestrator warnings.
- Enhanced error handling in execute function of useOperatorExecutor for improved clarity.

Possibly related PRs

  • Warn on missing app events #4768: The changes in this PR involve modifying event handling logic, which may relate to the control flow adjustments made in the state.ts file regarding user notifications and error handling.

Suggested reviewers

  • sashankaryal
  • brimoor

🐇 In the meadow, changes bloom,
With prompts and errors, we make room.
A flag to guide, a warning to show,
Clarity in code helps us all grow.
Hops of joy as we refine,
In the world of code, all will be fine! 🌼


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7e77e08 and 75cd3f7.

📒 Files selected for processing (1)
  • app/packages/operators/src/state.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/packages/operators/src/state.ts

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Comment on lines -950 to +953
const isAbortError = result.error.name === "AbortError" || result.error instanceof DOMException;
const isAbortError =
result.error.name === "AbortError" ||
result.error instanceof DOMException;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not me, just prettier tool

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7c89c13 and 7e77e08.

📒 Files selected for processing (1)
  • app/packages/operators/src/state.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/packages/operators/src/state.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

🔇 Additional comments (1)
app/packages/operators/src/state.ts (1)

951-953: LGTM! Clear and maintainable error handling.

The error handling logic has been improved by splitting the condition across multiple lines, making it more readable while maintaining the same functionality.

Comment on lines 329 to 330
!hasAvailableOrchestators &&
!allowImmediateExecution;
Copy link
Contributor

@coderabbitai coderabbitai bot Nov 4, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix undefined variable reference.

The condition uses allowImmediateExecution which appears to be undefined. This could lead to unexpected behavior.

The variable should likely be executionOptions.allowImmediateExecution:

    executionOptions.orchestratorRegistrationEnabled &&
    !hasAvailableOrchestators &&
-   !allowImmediateExecution;
+   !executionOptions.allowImmediateExecution;

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

problem with changing targets after testing thx rabbit

Copy link
Contributor

Choose a reason for hiding this comment

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

@swheaton, understood. Thank you for the clarification.


✏️ Learnings added
Learnt from: swheaton
PR: voxel51/fiftyone#5036
File: app/packages/operators/src/state.ts:329-330
Timestamp: 2024-11-04T17:01:09.555Z
Learning: In `app/packages/operators/src/state.ts`, within the `useOperatorPromptSubmitOptions` function, the variable `allowImmediateExecution` is correctly used and should not be replaced with `executionOptions.allowImmediateExecution`.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unlearn that. i was saying the suggestion was good

Copy link
Contributor

Choose a reason for hiding this comment

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

@swheaton, understood. I've removed the previous learning as requested. Thank you for the clarification.

@swheaton swheaton merged commit f13a397 into develop Nov 4, 2024
11 checks passed
@swheaton swheaton deleted the fix/enable-orch-reg branch November 4, 2024 18:31
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.

3 participants