result = models.IntegerField(blank=True, null=True)
archive_time = models.DateTimeField(blank=True, null=True)
- def nice_command(self):
- if self.command.startswith('python -m'):
- return self.command[len('python -m '):]
- else:
- return self.command
-
def queue_rank(self):
return Job.objects.filter(queue_time__lt=self.queue_time).filter(start_time__isnull=True).count() + 1
def process_time(self):
if format == u'track':
if queue:
- command = u'python -m ais.show_targets_ships --start=\'' + date_start.strftime('%Y%m%d %H%M%S') + u'\' --granularity=' + unicode(grain*grain_type) + ' --format=track '+ strmmsi
+ command = u'show_targets_ships --start=\'' + date_start.strftime('%Y%m%d %H%M%S') + u'\' --granularity=' + unicode(grain*grain_type) + ' --format=track '+ strmmsi
job = Job()
job.user = request.user
job.command = command
elif format == u'animation':
if queue:
- command = u'python -m ais.show_targets_ships --start=\'' + date_start.strftime('%Y%m%d %H%M%S') + u'\' --granularity=' + unicode(grain*grain_type) + ' --format=animation '+ strmmsi
+ command = u'show_targets_ships --start=\'' + date_start.strftime('%Y%m%d %H%M%S') + u'\' --granularity=' + unicode(grain*grain_type) + ' --format=animation '+ strmmsi
job = Job()
job.user = request.user
job.command = command
elif format == u'csv':
if queue:
- command = u'python -m ais.common --start=\'' + date_start.strftime('%Y%m%d %H%M%S') + u'\' --granularity=' + unicode(grain*grain_type) + ' ' + strmmsi
+ command = u'common --start=\'' + date_start.strftime('%Y%m%d %H%M%S') + u'\' --granularity=' + unicode(grain*grain_type) + ' ' + strmmsi
job = Job()
job.user = request.user
job.command = command
return False
jobid, command, friendly_filename, user_id = row
+ command = 'python -m ais.' + command
logging.info('Starting job %s: %s', jobid, command)
sqlexec(u'UPDATE job SET start_time=now() WHERE id=%(jobid)s', {'jobid': jobid})
{% block content %}
<h3>Job {{ job.id }}</h3>
-<tt>{{ job.nice_command }}</tt><br>
+<tt>{{ job.command }}</tt><br>
{% if job.finish_time %}
Status: <b>Completed</b> at {{ job.finish_time|date:"Y-m-d H:i:s" }} UTC in {{ job.process_time }}<br>
Result: {% if job.result %}<b>Error {{ job.result }}</b>{% else %}<b>Success</b><br>
<ul>
{% for job in jobs %}
<li>Job {{ job.id }}<br>
-<tt>{{ job.nice_command }}</tt><br>
+<tt>{{ job.command }}</tt><br>
{% if job.finish_time %}
Status: <b>Completed</b> at {{ job.finish_time|date:"Y-m-d H:i:s" }} UTC in {{ job.process_time }}<br>
Result: {% if job.result %}<b>Error {{ job.result }}</b>{% else %}<b>Success</b><br>