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

Fixing sentinel command response #3191

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

mahigupta
Copy link

@mahigupta mahigupta commented Mar 23, 2024

Pull Request check-list

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

Description of change

For #3139

  • Made change to execute_command function to parse sentinel command response correctly and don't return by default True

@mahigupta
Copy link
Author

@dvora-h Can you please take a look.

@mahigupta
Copy link
Author

@vladvildanov Can you please take a look ?

@vladvildanov
Copy link
Collaborator

@mahigupta Thanks for your input! I'll also include @gerzse into this

@mahigupta
Copy link
Author

Hello,
@vladvildanov @gerzse , Can anyone look in to this PR ?

@vladvildanov
Copy link
Collaborator

@mahigupta Looks fine 👌 Working on fixing CI, docker-compose was removed from default commands in Ubuntu 22.04 LTS runner

@mahigupta
Copy link
Author

@vladvildanov @gerzse Ci fixed now to go ahead with this PR ?

@@ -230,15 +231,24 @@ async def execute_command(self, *args, **kwargs):
if "once" in kwargs.keys():
kwargs.pop("once")

# Check if command suppose to return boolean response.
bool_resp = bool(kwargs.get("bool_resp", False))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can just go with bool_resp = bool(kwargs.pop("bool_resp", False)), so we can avoid additional if condition.

]
responses = await asyncio.gather(*tasks)

if bool_resp:
Copy link
Collaborator

@vladvildanov vladvildanov Sep 19, 2024

Choose a reason for hiding this comment

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

I think we need to change the behaviour here to be backward compatible. The default behaviour should be still "return True", if you want to return the actual responses you have to explicitly specify this.

So instead we would likely to have something like return_responses=True flag and we will return actual response if it will be explicitly set.

@@ -257,12 +258,22 @@ def execute_command(self, *args, **kwargs):
if "once" in kwargs.keys():
kwargs.pop("once")

# Check if command suppose to return boolean response.
bool_resp = bool(kwargs.get("bool_resp", False))
Copy link
Collaborator

Choose a reason for hiding this comment

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

See above

for sentinel in self.sentinels:
responses.append(sentinel.execute_command(*args, **kwargs))

if bool_resp:
Copy link
Collaborator

Choose a reason for hiding this comment

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

See above

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.

2 participants