mirror of https://git.kore.io/kore.git
add kore.worker() to the python api.
returns the current worker number or None if on parent.
This commit is contained in:
parent
4a64b4f07b
commit
5055f3c872
|
@ -40,6 +40,7 @@ static PyObject *python_kore_bind(PyObject *, PyObject *);
|
||||||
static PyObject *python_kore_timer(PyObject *, PyObject *);
|
static PyObject *python_kore_timer(PyObject *, PyObject *);
|
||||||
static PyObject *python_kore_fatal(PyObject *, PyObject *);
|
static PyObject *python_kore_fatal(PyObject *, PyObject *);
|
||||||
static PyObject *python_kore_queue(PyObject *, PyObject *);
|
static PyObject *python_kore_queue(PyObject *, PyObject *);
|
||||||
|
static PyObject *python_kore_worker(PyObject *, PyObject *);
|
||||||
static PyObject *python_kore_tracer(PyObject *, PyObject *);
|
static PyObject *python_kore_tracer(PyObject *, PyObject *);
|
||||||
static PyObject *python_kore_fatalx(PyObject *, PyObject *);
|
static PyObject *python_kore_fatalx(PyObject *, PyObject *);
|
||||||
static PyObject *python_kore_suspend(PyObject *, PyObject *);
|
static PyObject *python_kore_suspend(PyObject *, PyObject *);
|
||||||
|
@ -74,6 +75,7 @@ static struct PyMethodDef pykore_methods[] = {
|
||||||
METHOD("bind", python_kore_bind, METH_VARARGS),
|
METHOD("bind", python_kore_bind, METH_VARARGS),
|
||||||
METHOD("timer", python_kore_timer, METH_VARARGS),
|
METHOD("timer", python_kore_timer, METH_VARARGS),
|
||||||
METHOD("queue", python_kore_queue, METH_VARARGS),
|
METHOD("queue", python_kore_queue, METH_VARARGS),
|
||||||
|
METHOD("worker", python_kore_worker, METH_VARARGS),
|
||||||
METHOD("tracer", python_kore_tracer, METH_VARARGS),
|
METHOD("tracer", python_kore_tracer, METH_VARARGS),
|
||||||
METHOD("gather", python_kore_gather, METH_VARARGS | METH_KEYWORDS),
|
METHOD("gather", python_kore_gather, METH_VARARGS | METH_KEYWORDS),
|
||||||
METHOD("fatal", python_kore_fatal, METH_VARARGS),
|
METHOD("fatal", python_kore_fatal, METH_VARARGS),
|
||||||
|
|
10
src/python.c
10
src/python.c
|
@ -1251,6 +1251,16 @@ python_kore_queue(PyObject *self, PyObject *args)
|
||||||
return ((PyObject *)queue);
|
return ((PyObject *)queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
python_kore_worker(PyObject *self, PyObject *args)
|
||||||
|
{
|
||||||
|
if (worker == NULL) {
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (PyLong_FromLong(worker->id));
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
python_kore_tracer(PyObject *self, PyObject *args)
|
python_kore_tracer(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue