MOE icon indicating copy to clipboard operation
MOE copied to clipboard

[Python] Put timing calls around each endpoint. first step toward monitoring

Open suntzu86 opened this issue 10 years ago • 2 comments

One of the bugs found in #82 was:

DEFAULT_GRADIENT_DESCENT_MULTISTARTS = 10000
DEFAULT_OPTIMIZATION_MULTISTARTS = 10000

Those values should've been more like a few hundred.

If we reported (in http response and/or log) the runtime of each endpoint, we would've been more able to see that something was going bonkers. and more generally having MONITORING will help us see when stuff breaks or behaves unexpectedly.

suntzu86 avatar Jul 15 '14 23:07 suntzu86

It'd also be nice to have a decorator for timing functions. Something like what's here: http://stackoverflow.com/questions/5478351/python-time-measure-function

although due to this: http://stackoverflow.com/questions/7680446/get-python-functions-owning-class-from-decorator

we'll prob want to accept some extra descriptor arguments to disambiguate names (b/c func.__name__ isn't enough when you have many things w/the same name in diff modules) like this: http://stackoverflow.com/questions/3931627/how-to-build-a-python-decorator-with-optional-parameters

suntzu86 avatar Jul 17 '14 07:07 suntzu86

note: a simple timing context manager was added through the commit for #82 and I added timing calls to the most expensive parts of each REST endpoint. I'm leaving this ticket up for refining that.

suntzu86 avatar Jul 28 '14 17:07 suntzu86