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

Create timeout signal for hostcontext only #3647

Merged
merged 0 commits into from
Jan 10, 2023
Merged

Conversation

lhuett
Copy link
Contributor

@lhuett lhuett commented Jan 9, 2023

All Pull Requests:

Check all that apply:

  • Have you followed the guidelines in our Contributing document, including the instructions about commit messages?
  • Is this PR to correct an issue?
  • Is this PR an enhancement?

Complete Description of Additions/Changes:

  • Since timeout signals are only needed when HostContext is used we only need to set the signal in that case, logic was change to skip when using any other context than Hostcontext.
  • Changes were made to the pytest module to add HostContext object to the broker in present tests
  • Additional pytests were added to test when not HostContext

@lhuett lhuett changed the title Signal hostcontext only Create timeout signal for hostcontext only Jan 9, 2023
@@ -99,8 +100,9 @@ def invoke(self, broker):
# Grab the timeout from the decorator, or use the default of 120.
self.timeout = getattr(self, "timeout", 120)

signal.signal(signal.SIGALRM, self._handle_timeout)
signal.alarm(self.timeout)
if HostContext in broker:
Copy link
Contributor

Choose a reason for hiding this comment

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

@lhuett - do you think it's reasonable to also move the definition of the self.timeout (L101) into the if clause? since it's only used in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xiangce Good point, I can do that.

@lhuett lhuett force-pushed the signal_hostcontext_only branch from d6d0211 to 49b2430 Compare January 10, 2023 19:07
@bfahr bfahr merged commit 944547c into master Jan 10, 2023
bfahr pushed a commit that referenced this pull request Jan 10, 2023
* feat: Check if HostContext before setting signal in invoke().

* feat: Check if HostContext before setting signal in invoke().

* feat: Check if HostContext before setting signal in invoke().
Foxed flake8 issue

* feat: Check if HostContext before setting signal in invoke().
Foxed move self.timeout set under check for HostContext

Signed-off-by: lhuett <[email protected]>

Signed-off-by: lhuett <[email protected]>
(cherry picked from commit 944547c)
@xiangce xiangce deleted the signal_hostcontext_only branch January 11, 2023 01:03
xiangce pushed a commit that referenced this pull request Sep 6, 2024
* feat: Check if HostContext before setting signal in invoke().

* feat: Check if HostContext before setting signal in invoke().

* feat: Check if HostContext before setting signal in invoke().
Foxed flake8 issue

* feat: Check if HostContext before setting signal in invoke().
Foxed move self.timeout set under check for HostContext

Signed-off-by: lhuett <[email protected]>

Signed-off-by: lhuett <[email protected]>
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