Classes | |
class | Subprocess |
Functions | |
def | _pipe_cloexec |
def | _reseed_random |
def | cpu_count |
def | fork_processes |
def | task_id |
Variables | |
_task_id = None | |
long = int | |
multiprocessing = None |
def tornado.process._pipe_cloexec | ( | ) | [private] |
Definition at line 81 of file process.py.
def tornado.process._reseed_random | ( | ) | [private] |
Definition at line 67 of file process.py.
def tornado.process.cpu_count | ( | ) |
Returns the number of processors on this machine.
Definition at line 51 of file process.py.
def tornado.process.fork_processes | ( | num_processes, | |
max_restarts = 100 |
|||
) |
Starts multiple worker processes. If ``num_processes`` is None or <= 0, we detect the number of cores available on this machine and fork that number of child processes. If ``num_processes`` is given and > 0, we fork that specific number of sub-processes. Since we use processes and not threads, there is no shared memory between any server code. Note that multiple processes are not compatible with the autoreload module (or the ``autoreload=True`` option to `tornado.web.Application` which defaults to True when ``debug=True``). When using multiple processes, no IOLoops can be created or referenced until after the call to ``fork_processes``. In each child process, ``fork_processes`` returns its *task id*, a number between 0 and ``num_processes``. Processes that exit abnormally (due to a signal or non-zero exit status) are restarted with the same id (up to ``max_restarts`` times). In the parent process, ``fork_processes`` returns None if all child processes have exited normally, but will otherwise only exit by throwing an exception.
Definition at line 91 of file process.py.
def tornado.process.task_id | ( | ) |
Returns the current task id, if any. Returns None if this process was not created by `fork_processes`.
Definition at line 175 of file process.py.
tornado::process::_task_id = None |
Definition at line 88 of file process.py.
tornado::process::long = int |
Definition at line 48 of file process.py.
Definition at line 43 of file process.py.