MCPcopy Create free account
hub / github.com/ceph/ceph / notify

Method notify

src/mgr/ActivePyModule.cc:58–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void ActivePyModule::notify(const std::string &notify_type, const std::string &notify_id)
59{
60 if (is_dead()) {
61 dout(5) << "cancelling notify " << notify_type << " " << notify_id << dendl;
62 return;
63 }
64
65 ceph_assert(pClassInstance != nullptr);
66
67 Gil gil(py_module->pMyThreadState, true);
68
69 auto _start = ceph::mono_clock::now();
70 // Execute
71 auto pValue = PyObject_CallMethod(pClassInstance,
72 const_cast<char*>("notify"), const_cast<char*>("(ss)"),
73 notify_type.c_str(), notify_id.c_str());
74
75 if (pValue != NULL) {
76 Py_DECREF(pValue);
77 if (py_module->perfcounter) {
78 auto duration = ceph::mono_clock::now() - _start;
79 auto usec = std::chrono::duration_cast<std::chrono::microseconds>(duration).count();
80 py_module->perfcounter->inc(py_module->l_pym_notify_avg_usec, usec);
81 }
82 } else {
83 derr << get_name() << ".notify:" << dendl;
84 derr << handle_pyerror(true, get_name(), "ActivePyModule::notify") << dendl;
85 // FIXME: callers can't be expected to handle a python module
86 // that has spontaneously broken, but Mgr() should provide
87 // a hook to unload misbehaving modules when they have an
88 // error somewhere like this
89 }
90}
91
92void ActivePyModule::notify_clog(const LogEntry &log_entry)
93{

Callers 2

notify_allMethod · 0.45

Calls 6

handle_pyerrorFunction · 0.85
nowFunction · 0.50
get_nameFunction · 0.50
c_strMethod · 0.45
countMethod · 0.45
incMethod · 0.45

Tested by

no test coverage detected