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

Add timeout and process failure event handlers to tasks #1698

Merged

Conversation

casey-green
Copy link
Contributor

Add additional event handlers to tasks

This adds two new event handlers:

  1. Task timeout - gets triggered when a task times out.
  2. Process failure - gets triggered if the process running a task fails for an unexpected reason.

Motivation and Context

We use event handlers to profile and monitor tasks (i.e. trigger alerts when tasks fail). These two task failure types will fail silently in our system because they don't trigger the FAILURE (or any other) event type.

Tests

I included unit tests which test each event handler.

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @Tarrasch, @themalkolm and @daveFNbuck to be potential reviewers

# kill and wait for it to be killed.
os.kill(process.pid, signal.SIGUSR2)
while process.is_alive():
time.sleep(.1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll admit this feels like a weird thing to do in a unit test... but I tried os.waitpid and some other mocking approaches and I couldn't get either to work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't you just create a mock TaskProcess that returns False for is_alive and has a nonzero exit code?

@Tarrasch
Copy link
Contributor

Does @ulzha (event guru ^^) want to review?

@casey-green casey-green force-pushed the task_timeout_process_killed_handlers branch 2 times, most recently from 21f03db to c99b4e7 Compare May 27, 2016 16:22
@casey-green
Copy link
Contributor Author

Addressed comments, thanks!

@codecov-io
Copy link

codecov-io commented May 27, 2016

Current coverage is 53.48%

Merging #1698 into master will decrease coverage by 25.32%

@@             master      #1698   diff @@
==========================================
  Files            94         59     -35   
  Lines         10285       8890   -1395   
  Methods           0          0           
  Messages          0          0           
  Branches          0          0           
==========================================
- Hits           8104       4754   -3350   
- Misses         2181       4136   +1955   
  Partials          0          0           

Powered by Codecov. Last updated by 514a3bd...fd9df8b

@casey-green
Copy link
Contributor Author

ping @Tarrasch - following up on this. Anything to do on my side?

@Tarrasch Tarrasch merged commit c311975 into spotify:master Jun 30, 2016
@Tarrasch
Copy link
Contributor

LGTM. Though I wish somebody else too could have reviewed it too ... Anyways, good job! :)

p7k pushed a commit to Celmatix/luigi that referenced this pull request Jul 11, 2016
* spotify/master: (25 commits)
  Version 2.2.0
  Add tests for hashing parameters (spotify#1719)
  Update call to iteritems in luigi/tools/deps: deprecated in Python 3 (spotify#1749)
  Reset terminal colors in external_program (spotify#1742)
  Caches get_autoconfig_client on a per-thread basis
  Fix bug with GCSFlagTarget
  Add additional event handlers to tasks (spotify#1698)
  Reduce number of get_params calls in common_params.
  Removes redundant function definitions from rpc and server (spotify#1734)
  Fix salesforce default content type (spotify#1724)
  Rename MockTarget class variable _fn to path
  Remove MockTarget path property
  Deprecated LocalTarget fn propery
  Add note about underscore in parameter names (spotify#1729)
  Remove tracking url callback hack (spotify#1722)
  Consistent Luigi spelling in docs (spotify#1723)
  Update example_top_artists.rst (spotify#1662)
  Add combiner to docstrings in mrrunner
  Add luigi-deps-tree visualising tool (spotify#1680)
  Adding release step for Debian packages. (spotify#1718)
  ...
This was referenced Jun 29, 2022
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.

None yet

5 participants