Move profiling to c++ (#5771)

* Move profiling to c++

* comments

* Fix tests

* Start after constructor

* fix comment

* always init logging

* Fix logging

* fix logging issue

* shared_ptr for profiler

* DEBUG -> WARNING

* fix killed_ init

* Fix flaky checkpointing tests

* Fix checkpoint test logic

* Fix exception matching

* timeout exception

* Fix import

* fix build

* use boost::asio

* fix double const

* Properly reset async_wait

* remove SIGINT

* Change error message

* increase timeout

* small nits

* Don't trap on SIGINT

* -v for tune

* Fix test
This commit is contained in:
Edward Oakes
2019-10-01 10:06:25 -07:00
committed by GitHub
parent 443feb75f0
commit 963bbe8bbd
20 changed files with 308 additions and 252 deletions
+42
View File
@@ -0,0 +1,42 @@
from libcpp.string cimport string as c_string
from ray.includes.libcoreworker cimport CProfileEvent
import json
import traceback
cdef class ProfileEvent:
"""Cython wrapper class of C++ `ray::worker::ProfileEvent`."""
cdef:
unique_ptr[CProfileEvent] inner
dict extra_data
@staticmethod
cdef make(unique_ptr[CProfileEvent] event, dict extra_data):
cdef ProfileEvent self = ProfileEvent.__new__(ProfileEvent)
self.inner = move(event)
self.extra_data = extra_data
return self
def set_extra_data(self, c_string extra_data):
self.inner.get().SetExtraData(extra_data)
def __enter__(self):
pass
def __exit__(self, type, value, tb):
extra_data = {}
if type is not None:
extra_data = {
"type": str(type),
"value": str(value),
"traceback": str(traceback.format_exc()),
}
elif self.extra_data is not None:
extra_data = self.extra_data
self.inner.get().SetExtraData(json.dumps(extra_data).encode("ascii"))
# Deleting the CProfileEvent will add it to a queue to be pushed to
# the driver.
self.inner.reset()