HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/doc/python3-django-q/html/monitor.html
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Monitor &mdash; Django Q2 1.6.1 documentation</title>
      <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b76e3c8a" />
      <link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=86f27845" />

  
    <link rel="shortcut icon" href="_static/favicon.ico"/>
  
        <script src="_static/jquery.js?v=8dae8fb0"></script>
        <script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
        <script src="_static/documentation_options.js?v=d6a008b6"></script>
        <script src="_static/doctools.js?v=888ff710"></script>
        <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Admin pages" href="admin.html" />
    <link rel="prev" title="Cluster" href="cluster.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="index.html" class="icon icon-home">
            Django Q2
          </a>
              <div class="version">
                1.6
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install.html"> Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="configure.html"> Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="brokers.html"> Brokers</a></li>
<li class="toctree-l1"><a class="reference internal" href="tasks.html"> Tasks</a></li>
<li class="toctree-l1"><a class="reference internal" href="group.html"> Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="iterable.html"> Iterable</a></li>
<li class="toctree-l1"><a class="reference internal" href="chain.html"> Chains</a></li>
<li class="toctree-l1"><a class="reference internal" href="schedules.html"> Schedules</a></li>
<li class="toctree-l1"><a class="reference internal" href="cluster.html"> Cluster</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#"> Monitor</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#legend">Legend</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#host">Host</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id">Id</a></li>
<li class="toctree-l3"><a class="reference internal" href="#state">State</a></li>
<li class="toctree-l3"><a class="reference internal" href="#pool">Pool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#tq">TQ</a></li>
<li class="toctree-l3"><a class="reference internal" href="#rq">RQ</a></li>
<li class="toctree-l3"><a class="reference internal" href="#rc">RC</a></li>
<li class="toctree-l3"><a class="reference internal" href="#up">Up</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#info">Info</a></li>
<li class="toctree-l2"><a class="reference internal" href="#status">Status</a></li>
<li class="toctree-l2"><a class="reference internal" href="#reference">Reference</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#Stat"><code class="docutils literal notranslate"><span class="pre">Stat</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#Stat.cluster_id"><code class="docutils literal notranslate"><span class="pre">Stat.cluster_id</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.tob"><code class="docutils literal notranslate"><span class="pre">Stat.tob</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.uptime"><code class="docutils literal notranslate"><span class="pre">Stat.uptime()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.reincarnations"><code class="docutils literal notranslate"><span class="pre">Stat.reincarnations</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.status"><code class="docutils literal notranslate"><span class="pre">Stat.status</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.task_q_size"><code class="docutils literal notranslate"><span class="pre">Stat.task_q_size</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.done_q_size"><code class="docutils literal notranslate"><span class="pre">Stat.done_q_size</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.pusher"><code class="docutils literal notranslate"><span class="pre">Stat.pusher</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.monitor"><code class="docutils literal notranslate"><span class="pre">Stat.monitor</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.sentinel"><code class="docutils literal notranslate"><span class="pre">Stat.sentinel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.workers"><code class="docutils literal notranslate"><span class="pre">Stat.workers</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.empty_queues"><code class="docutils literal notranslate"><span class="pre">Stat.empty_queues()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.get"><code class="docutils literal notranslate"><span class="pre">Stat.get()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#Stat.get_all"><code class="docutils literal notranslate"><span class="pre">Stat.get_all()</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="admin.html"> Admin</a></li>
<li class="toctree-l1"><a class="reference internal" href="errors.html"> Errors</a></li>
<li class="toctree-l1"><a class="reference internal" href="signals.html"> Signals</a></li>
<li class="toctree-l1"><a class="reference internal" href="architecture.html"> Architecture</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html"> Examples</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">Django Q2</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active">Monitor</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/monitor.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="monitor">
<h1>Monitor<a class="headerlink" href="#monitor" title="Link to this heading"></a></h1>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Blessed needs to be installed to get this to work! See: <a class="reference external" href="https://pypi.org/project/blessed/">https://pypi.org/project/blessed/</a></p>
</div>
<p>The cluster monitor shows live information about all the Q clusters connected to your project.</p>
<p>Start the monitor with Django’s <cite>manage.py</cite> command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python manage.py qmonitor
</pre></div>
</div>
<img alt="_images/monitor.png" src="_images/monitor.png" />
<p>For all broker types except the Redis broker, the monitor utilizes Django’s cache framework to store statistics of running clusters.
This can be any type of cache backend as long as it can be shared among Django instances. For this reason, the local memory backend will not work.</p>
<section id="legend">
<h2>Legend<a class="headerlink" href="#legend" title="Link to this heading"></a></h2>
<section id="host">
<h3>Host<a class="headerlink" href="#host" title="Link to this heading"></a></h3>
<p>Shows the hostname of the server this cluster is running on.</p>
</section>
<section id="id">
<h3>Id<a class="headerlink" href="#id" title="Link to this heading"></a></h3>
<p>The cluster Id. Same as the cluster process ID or pid.</p>
</section>
<section id="state">
<h3>State<a class="headerlink" href="#state" title="Link to this heading"></a></h3>
<p>Current state of the cluster:</p>
<ul class="simple">
<li><p><strong>Starting</strong> The cluster is spawning workers and getting ready.</p></li>
<li><p><strong>Idle</strong> Everything is ok, but there are no tasks to process.</p></li>
<li><p><strong>Working</strong> Processing tasks like a good cluster should.</p></li>
<li><p><strong>Stopping</strong> The cluster does not take on any new tasks and is finishing.</p></li>
<li><p><strong>Stopped</strong> All tasks have been processed and the cluster is shutting down.</p></li>
</ul>
</section>
<section id="pool">
<h3>Pool<a class="headerlink" href="#pool" title="Link to this heading"></a></h3>
<p>The current number of workers in the cluster pool.</p>
</section>
<section id="tq">
<h3>TQ<a class="headerlink" href="#tq" title="Link to this heading"></a></h3>
<p><strong>Task Queue</strong> counts the number of tasks in the queue <a class="footnote-reference brackets" href="#f1" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p>
<p>If this keeps rising it means you are taking on more tasks than your cluster can handle.
You can limit this by settings the <a class="reference internal" href="configure.html#queue-limit"><span class="std std-ref">queue_limit</span></a> in your cluster configuration, after which it will turn green when that limit has been reached.
If your task queue is always hitting its limit and your running out of resources, it may be time to add another cluster.</p>
</section>
<section id="rq">
<h3>RQ<a class="headerlink" href="#rq" title="Link to this heading"></a></h3>
<p><strong>Result Queue</strong> shows the number of results in the queue. <a class="footnote-reference brackets" href="#f1" id="id2" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p>
<p>Since results are only saved by a single process which has to access the database.
It’s normal for the result queue to take slightly longer to clear than the task queue.</p>
</section>
<section id="rc">
<h3>RC<a class="headerlink" href="#rc" title="Link to this heading"></a></h3>
<p><strong>Reincarnations</strong> shows the amount of processes that have been reincarnated after a recycle, sudden death or timeout.
If this number is unusually high, you are either suffering from repeated task errors or severe timeouts and you should check your logs for details.</p>
</section>
<section id="up">
<h3>Up<a class="headerlink" href="#up" title="Link to this heading"></a></h3>
<p><strong>Uptime</strong> the amount of time that has passed since the cluster was started.</p>
<p class="centered">
<strong>Press <cite>q</cite> to quit the monitor and return to your terminal.</strong></p></section>
</section>
<section id="info">
<h2>Info<a class="headerlink" href="#info" title="Link to this heading"></a></h2>
<p>If you just want to see a one-off summary of your cluster stats you can use the <cite>qinfo</cite> management command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python manage.py qinfo
</pre></div>
</div>
<img alt="_images/info.png" src="_images/info.png" />
<p>All stats are summed over all available clusters.</p>
<p>Task rate is calculated over the last 24 hours and will show the number of tasks per second, minute, hour or day depending on the amount.
Average execution time (<cite>Avg time</cite>) is calculated in seconds over the last 24 hours.</p>
<p>Since some of these numbers are based on what is available in your tasks database, limiting or disabling the result backend will skew them.</p>
<p>Like with the monitor, these statistics come from a Redis server or Django’s cache framework. So make sure you have either one configured.</p>
<p>To print out the current configuration run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python manage.py qinfo --config
</pre></div>
</div>
</section>
<section id="status">
<h2>Status<a class="headerlink" href="#status" title="Link to this heading"></a></h2>
<p>You can check the status of your clusters straight from your code with the <a class="reference internal" href="#Stat" title="Stat"><code class="xref py py-class docutils literal notranslate"><span class="pre">Stat</span></code></a> class:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django_q.status</span> <span class="kn">import</span> <span class="n">Stat</span>

<span class="k">for</span> <span class="n">stat</span> <span class="ow">in</span> <span class="n">Stat</span><span class="o">.</span><span class="n">get_all</span><span class="p">():</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">stat</span><span class="o">.</span><span class="n">cluster_id</span><span class="p">,</span> <span class="n">stat</span><span class="o">.</span><span class="n">status</span><span class="p">)</span>

<span class="c1"># or if you know the cluster id</span>
<span class="n">cluster_id</span> <span class="o">=</span> <span class="mi">1234</span>
<span class="n">stat</span> <span class="o">=</span> <span class="n">Stat</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">cluster_id</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">stat</span><span class="o">.</span><span class="n">status</span><span class="p">,</span> <span class="n">stat</span><span class="o">.</span><span class="n">workers</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="reference">
<h2>Reference<a class="headerlink" href="#reference" title="Link to this heading"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="Stat">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Stat</span></span><a class="headerlink" href="#Stat" title="Link to this definition"></a></dt>
<dd><p>Cluster status object.</p>
<blockquote>
<div><dl class="py attribute">
<dt class="sig sig-object py" id="Stat.cluster_id">
<span class="sig-name descname"><span class="pre">cluster_id</span></span><a class="headerlink" href="#Stat.cluster_id" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>Id of this cluster. Corresponds with the process id.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="Stat.tob">
<span class="sig-name descname"><span class="pre">tob</span></span><a class="headerlink" href="#Stat.tob" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>Time Of Birth</p>
<dl class="py method">
<dt class="sig sig-object py" id="Stat.uptime">
<span class="sig-name descname"><span class="pre">uptime</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Stat.uptime" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>Shows the number of seconds passed since the time of birth</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="Stat.reincarnations">
<span class="sig-name descname"><span class="pre">reincarnations</span></span><a class="headerlink" href="#Stat.reincarnations" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>The number of times the sentinel had to start a new worker process.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="Stat.status">
<span class="sig-name descname"><span class="pre">status</span></span><a class="headerlink" href="#Stat.status" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>String representing the current cluster status.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="Stat.task_q_size">
<span class="sig-name descname"><span class="pre">task_q_size</span></span><a class="headerlink" href="#Stat.task_q_size" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>The number of tasks currently in the task queue. <a class="footnote-reference brackets" href="#f1" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p>
<dl class="py attribute">
<dt class="sig sig-object py" id="Stat.done_q_size">
<span class="sig-name descname"><span class="pre">done_q_size</span></span><a class="headerlink" href="#Stat.done_q_size" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>The number of tasks currently in the result queue. <a class="footnote-reference brackets" href="#f1" id="id4" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p>
<dl class="py attribute">
<dt class="sig sig-object py" id="Stat.pusher">
<span class="sig-name descname"><span class="pre">pusher</span></span><a class="headerlink" href="#Stat.pusher" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>The pid of the pusher process</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="Stat.monitor">
<span class="sig-name descname"><span class="pre">monitor</span></span><a class="headerlink" href="#Stat.monitor" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>The pid of the monitor process</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="Stat.sentinel">
<span class="sig-name descname"><span class="pre">sentinel</span></span><a class="headerlink" href="#Stat.sentinel" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>The pid of the sentinel process</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="Stat.workers">
<span class="sig-name descname"><span class="pre">workers</span></span><a class="headerlink" href="#Stat.workers" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>A list of process ids of the workers currently in the cluster pool.</p>
<dl class="py method">
<dt class="sig sig-object py" id="Stat.empty_queues">
<span class="sig-name descname"><span class="pre">empty_queues</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Stat.empty_queues" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>Returns true or false depending on any tasks still present in the task or result queue.</p>
<dl class="py method">
<dt class="sig sig-object py" id="Stat.get">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cluster_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">broker</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#Stat.get" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>Gets the current <a class="reference internal" href="#Stat" title="Stat"><code class="xref py py-class docutils literal notranslate"><span class="pre">Stat</span></code></a> for the cluster id. Takes an optional broker connection.</p>
<dl class="py method">
<dt class="sig sig-object py" id="Stat.get_all">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_all</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">broker</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#Stat.get_all" title="Link to this definition"></a></dt>
<dd></dd></dl>

<p>Returns a list of <a class="reference internal" href="#Stat" title="Stat"><code class="xref py py-class docutils literal notranslate"><span class="pre">Stat</span></code></a> objects for all active clusters. Takes an optional broker connection.</p>
</div></blockquote>
</dd></dl>

<p class="rubric">Footnotes</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="f1" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<span class="backrefs">(<a role="doc-backlink" href="#id1">1</a>,<a role="doc-backlink" href="#id2">2</a>,<a role="doc-backlink" href="#id3">3</a>,<a role="doc-backlink" href="#id4">4</a>)</span>
<p>Uses <code class="xref py py-meth docutils literal notranslate"><span class="pre">multiprocessing.Queue.qsize()</span></code> which is not implemented on OS X and always returns 0.</p>
</aside>
</aside>
</section>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="cluster.html" class="btn btn-neutral float-left" title="Cluster" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="admin.html" class="btn btn-neutral float-right" title="Admin pages" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2015-2023, Ilan Steemers - 2022, Stan Triepels.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>