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

Handle Prod Timeout Worker Approve Timeout Errors #6238

Merged
merged 3 commits into from
Mar 16, 2020
Merged

Conversation

owocki
Copy link
Contributor

@owocki owocki commented Mar 16, 2020

Description

Uses a solution found here to prevent production timeout errors.

adds a re-usable decorator for managing those timeouts

Refers/Fixes

Production timeout errors on approving users
Screen Shot 2020-03-16 at 11 15 13 AM

Testing
from app.utils import timeout
import time

@timeout(2)
def foo():
    time.sleep(10)

foo()

will yield

---------------------------------------------------------------------------
TimeoutError                              Traceback (most recent call last)
<ipython-input-1-f4b9f2b0c14b> in <module>
      6     time.sleep(10)
      7
----> 8 foo()

/code/app/app/utils.py in func_wrapper(*args, **kwargs)
    508             async_result = pool.apply_async(item, args, kwargs)
    509             # raises a TimeoutError if execution exceeds max_timeout
--> 510             return async_result.get(max_timeout)
    511
    512         return func_wrapper

/usr/lib/python3.6/multiprocessing/pool.py in get(self, timeout)
    638         self.wait(timeout)
    639         if not self.ready():
--> 640             raise TimeoutError
    641         if self._success:
    642             return self._value

TimeoutError:

In [2]:

@@ -1776,7 +1776,10 @@ def helper_handle_approvals(request, bounty):

maybe_market_to_github(bounty, 'work_started', profile_pairs=bounty.profile_pairs)
maybe_market_to_slack(bounty, 'worker_approved')
maybe_market_to_user_slack(bounty, 'worker_approved')
try:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

longer term it may be a good idea to move these jobs to celery instead of pageload

@owocki owocki changed the title Timeouterrors Handles production timeout errors Mar 16, 2020
@owocki owocki changed the title Handles production timeout errors Handle Prod Timeout Errors Mar 16, 2020
@owocki owocki changed the title Handle Prod Timeout Errors Handle Prod Timeout Worker Approve Timeout Errors Mar 16, 2020
@owocki
Copy link
Contributor Author

owocki commented Mar 16, 2020

cc @danlipert for an async review. merging this bc its prod and ppl cant approve certain workers

@owocki owocki merged commit 067161c into stable Mar 16, 2020
@codecov
Copy link

codecov bot commented Mar 16, 2020

Codecov Report

Merging #6238 into stable will increase coverage by 0.03%.
The diff coverage is 82.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           stable    #6238      +/-   ##
==========================================
+ Coverage   28.26%   28.29%   +0.03%     
==========================================
  Files         278      278              
  Lines       25240    25256      +16     
  Branches     3695     3695              
==========================================
+ Hits         7133     7147      +14     
+ Misses      17826    17824       -2     
- Partials      281      285       +4
Impacted Files Coverage Δ
app/app/context.py 75.64% <ø> (ø) ⬆️
app/avatar/views_3d.py 9.59% <0%> (ø) ⬆️
app/app/utils.py 24.68% <100%> (+2.42%) ⬆️
app/dashboard/notifications.py 16.96% <66.66%> (+0.49%) ⬆️
...eting/management/commands/assemble_leaderboards.py 40.48% <0%> (ø) ⬆️
app/dashboard/views.py 11.35% <0%> (ø) ⬆️
...rketing/management/commands/no_applicants_email.py 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84bf94b...0a25dfb. Read the comment docs.

@thelostone-mc thelostone-mc deleted the timeouterrors branch June 27, 2020 00:47
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.

1 participant