[Zope-CVS] CVS: Packages/zasync/www - analyzeCalls.zpt:1.1

Gary Poster gary at zope.com
Fri Nov 12 20:10:53 EST 2004


Update of /cvs-repository/Packages/zasync/www
In directory cvs.zope.org:/tmp/cvs-serv17226/www

Added Files:
	analyzeCalls.zpt 
Log Message:
A new diagnostic page for the ZMI call manager.  An attempt to improve the README file to give people more of a chance to get this set up and going.  A clean up of the two example configuration scripts to remove references to Zope 3, which really probably just confused matters.  I probably will announce this version as a beta sometime this weekend.



=== Added File Packages/zasync/www/analyzeCalls.zpt ===
<tal:block replace="structure here/manage_page_header">Header</tal:block>
<tal:block replace="structure here/manage_tabs">Tabs</tal:block>
<tal:block define="
    total here/lenNewCalls;
    ">
<h2>New calls</h2>
<p class="form-help">
  The manager currently has <strong tal:content="total">42</strong>
  new calls, not yet accepted by the zasync client.
</p>
</tal:block>
<tal:block define="
    total here/lenAcceptedCalls;
    ">
<h2>Accepted calls</h2>
<p class="form-help">
  The manager currently has <strong tal:content="total">42</strong>
  accepted calls, not yet resolved by the zasync client.
</p>
</tal:block>
<tal:block define="
    total here/lenResolvedCalls;
    rotation_period here/rotation_period;
    buckets here/lenResolvedBuckets;
    min_stay python: rotation_period * (buckets-1);
    max_stay python: rotation_period * buckets;
    next_rotate here/nextResolvedBucketRotation;
    analyze request/analyzeResolved|nothing;
    batch request/batch|nothing;
    batchBucket request/analyzeBucket|nothing;
    ">
<h2>Resolved calls</h2>
<p class="form-help">
  The manager currently has <strong tal:content="total">42</strong>
  resolved calls.  These will be kept in the database for no less than 
  <span tal:replace="min_stay">1</span> seconds and, typically, no more than 
  <span tal:replace="max_stay">2</span> seconds.</p>
<p class="form-help">The resolved calls are an aggregate of 
  <span tal:replace="buckets">2</span> rotating buckets, ordered from newest to
  oldest. <span tal:repeat="bucketIndex python: range(buckets)">Bucket <span
  tal:replace="bucketIndex">0</span> has <span tal:replace="python:
  here.lenResolvedCalls(bucketIndex)">0</span> calls.</span></p>
<p class="form-help">The buckets rotate every 
  <span tal:replace="rotation_period">86400</span> seconds, with the oldest
  bucket discarding its contents.  Change the rotation period on the properties
  tab.<span tal:condition="next_rotate">The buckets will rotate next at
  approximately <span
  tal:replace="next_rotate/isoformat">isoformatDateGoesHere</span>.</span>
  <span class="form-help" tal:condition="not: next_rotate">The buckets are not
  currently scheduled to rotate.</span></p>
<tal:block condition="analyze">
  <tal:block define="
      all_info python:here.listResolvedCalls(batchBucket);
      next_batch python:batch+20;
      prev_batch python:max(0,batch-20);
      batch_info python:all_info[batch:next_batch];
      is_more python:all_info[next_batch:];
      is_less python:batch>0;
      ">
    <table>
      <tr style="background-color: gray; margin: 2px;">
        <th>creation date</th>
        <th>resolution date</th>
        <th>time elapsed</th>
        <th>original resolution state</th>
        <th>final resolution state</th>
        <th>key</th>
        <th>user</th>
        <th>plugin</th>
      </tr>
      <tal:block repeat="row batch_info">
        <tr tal:define="odd repeat/row/odd;"
            tal:attributes="style python:odd and 'background-color: yellow'">
          <td tal:content="row/creation_date/isoformat">date</td> 
          <td tal:content="row/resolution_date/isoformat" 
            tal:condition="row/resolution_date">date</td>
          <td tal:condition="not:row/resolution_date">Not Available</td>
          <td tal:condition="row/resolution_date">
            <tal:block define="
              diff python:row['resolution_date']-row['creation_date'];
              raw_seconds diff/seconds;
              hours python:raw_seconds//(24*60);
              minutes python:raw_seconds%(24*60)//60;
              seconds python:raw_seconds%60;
              ">
              <span tal:replace="diff/days">0</span> day(s), 
              <span tal:replace="hours">0</span> hour(s), 
              <span tal:replace="minutes">0</span> minute(s), 
              <span tal:replace="seconds">0</span> second(s)
            </tal:block>
          </td>
          <td tal:condition="not:row/resolution_date">Not Available</td>
          <td tal:content="row/original_state">success/failure</td> 
          <td tal:content="row/state">success/failure</td> 
          <td tal:content="row/key">key</td> 
          <td tal:content="row/user">user</td> 
          <td tal:content="row/plugin">plugin</td> 
        </tr>
        <tr tal:define="
            odd repeat/row/odd;
            "
            tal:attributes="style python:odd and 'background-color: yellow'">
          <td colspan="8">
            <p><strong>Plugin Arguments</strong></p>
            <p tal:content="row/args">args</p> 
            <p tal:content="row/kwargs">kwargs</p> 
          </td>
        </tr>
        <tr tal:define="
            success python: row['original_state']=='success';
            odd repeat/row/odd;"
            tal:attributes="style python:odd and 'background-color: yellow'">
          <td colspan="8">
            <p><strong>Original Resolution Value</strong></p>
            <pre tal:replace="row/original_value" tal:condition="success">value
            </pre> 
            <p tal:condition="python: success and row['original_value'] is None">
              (None)</p>
            <pre tal:content="row/original_value/getTraceback" 
              tal:condition="not:success">traceback</pre>
          </td>
        </tr>
        <tr tal:define="
            success python: row['state']=='success';
            same python:row['original_value'] is row['value'];
            odd repeat/row/odd;"
            tal:attributes="style python:odd and 'background-color: yellow'">
          <td colspan="8">
            <p><strong>Final Resolution Value (after callback chain)</strong></p>
            <p tal:condition="same">(Same as original resolution)</p>
            <tal:block condition="not:same">
              <pre tal:replace="row/value" tal:condition="success">value</pre> 
              <p tal:condition="python: success and row['value'] is None">
                (None)</p>
              <pre tal:content="row/value/getTraceback" 
                tal:condition="not:success">traceback</pre>
            </tal:block>
          </td>
        </tr>
      </tal:block>
    </table>
    <form method="post" tal:condition="is_less">
      <input type="submit" name="analyzeResolved" value="Newer calls">
      <input type="hidden" tal:attributes="value prev_batch"
        name="batch:int" />
      <input type="hidden" tal:attributes="value batchBucket"
        name="analyzeBucket:int" tal:condition="batchBucket" />
    </form>
    <form method="post" tal:condition="is_more">
      <input type="submit" name="analyzeResolved" value="Older calls">
      <input type="hidden" tal:attributes="value next_batch"
        name="batch:int" />
      <input type="hidden" tal:attributes="value batchBucket"
        name="analyzeBucket:int" tal:condition="batchBucket" />
    </form>
  </tal:block>
</tal:block>
<tal:block condition="python: not analyze and total">
  <form method="post">
    <input type="submit" name="analyzeResolved"
      value="analyze all resolved calls" />
    <input type="hidden" name="batch:int" value="0" />
  </form>
  <form tal:repeat="bucketIndex python: range(buckets)" method="post">
    <input type="submit" name="analyzeResolved" value="analyze bucket calls" 
      tal:attributes="value string:analyze bucket $bucketIndex calls" />
    <input type="hidden" name="batch:int" value="0" />
    <input type="hidden" name="analyzeBucket:int" value="0" 
      tal:attributes="value bucketIndex" />
  </form>
</tal:block>
</tal:block>
<tal:block replace="structure here/manage_page_footer">Footer</tal:block>



More information about the Zope-CVS mailing list