| {% extends "skeleton.html" %} |
| {% block page_title %}Cron Jobs{% endblock %} |
| |
| {% block page_head %} |
| <style type="text/css">{% include "cron.css" %}</style> |
| {% endblock %} |
| |
| {% block body %} |
| <div id="cron"> |
| <h3>Cron Jobs</h3> |
| |
| <div id="cron-feedback" {% if cron_error %}class="errorbox"{% endif %}> |
| {% if cron_error %} |
| Error loading cron.yaml: |
| <pre>{{ cron_error }}</pre> |
| {% endif %} |
| </div> |
| |
| {% if cronjobs %} |
| <table id="ae-cron-jobs" class="ae-table"> |
| <colgroup> |
| <col class="ae-cron-job"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Cron Job</th> |
| <th>Schedule</th> |
| </tr> |
| </thead> |
| <tbody> |
| {% for job in cronjobs %} |
| <tr> |
| <td> |
| <h3>{{ job.url }}</h3> |
| <p> |
| {{ job.description }} |
| </p> |
| </td> |
| <td> |
| <strong>{{ job.schedule }}</strong> |
| <button class="ae-cron-run ae-button" name="{{ job.url }}">Run now</button> |
| {% if job.timezone %} |
| <div><strong>Timezone: {{ job.timezone }}</strong></div> |
| {% endif %} |
| {% if job.timezone and not has_pytz %} |
| <div class="ae-cron-message"> |
| pytz is required to calculate future run times for cron jobs |
| with timezones. |
| </div> |
| {% else %} |
| <div class="ae-cron-times"> |
| In production, this would run at these times: |
| <ol> |
| {% for run in job.times %} |
| <li> |
| {{ run.runtime }} <span class="unimportant">{{ run.difference }} from now</span> |
| </li> |
| {% endfor %} |
| </ol> |
| </div> |
| {% endif %} |
| </td> |
| </tr> |
| {% endfor %} |
| </tbody> |
| </table> |
| {% elif not cron_error %} |
| <p> |
| This application doesn't define any cron jobs. See <a href="https://developers.google.com/appengine/docs/">the documentation</a> to learn how to configure cron jobs. |
| </p> |
| {% endif %} |
| <script> |
| $('.ae-cron-run').click(function() { |
| var url = $(this).attr('name'); |
| var data = {'url': url, 'xsrf_token': '{{ xsrf_token }}'}; |
| var request = $.ajax({ |
| url: '/cron', |
| type: 'POST', |
| data: data |
| }) |
| .done(function() { |
| $('#cron-feedback').removeClass().addClass('messagebox').text( |
| 'Request to ' + url + ' succeeded!'); |
| }) |
| .fail(function(xhr, textStatus) { |
| $('#cron-feedback').removeClass().addClass('errorbox').text( |
| 'Request failured with status: ' + request.status); |
| }); |
| }); |
| </script> |
| </div> |
| {% endblock %} |
| |