No longer storing the 'python -m ais.' prefix in job commands
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Thu, 11 Nov 2010 14:11:38 +0000 (14:11 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Thu, 11 Nov 2010 14:11:38 +0000 (14:11 +0000)
bin/djais/models.py
bin/djais/views.py
bin/jobrunner.py
html_templates/job.html
html_templates/jobs.html

index 5d9ae8442b30fdd72103fc05be0d92a30bfd676a..c89d32aa7bf1eac2c77a59d97381f9cf369725c5 100644 (file)
@@ -218,12 +218,6 @@ class Job(models.Model):
     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):
index 27731742e1e9fc6e1952331946585ac2af839ab8..03b8e48e7bc8b27572954ebbed5a708b6f9b36fc 100644 (file)
@@ -414,7 +414,7 @@ def vessel_history(request, strmmsi, format=None):
 
     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
@@ -432,7 +432,7 @@ def vessel_history(request, strmmsi, format=None):
 
     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
@@ -450,7 +450,7 @@ def vessel_history(request, strmmsi, format=None):
 
     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
index c0e7ccd717c59f3469265ca19f13e40ba2110c0b..0af8f90b86435fb5e0aa0e36ba71c4db6a62d726 100755 (executable)
@@ -58,6 +58,7 @@ def runjob():
         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})
index 015a39398df475aab8ff61b97de67af1083e3a38..2547915a89f5991cc3e58c6fe2cc744c3de9ceab 100644 (file)
@@ -10,7 +10,7 @@
 {% 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>
index 581683689df32cfb10489f30f0df31b608377a92..e8f63901efad1f03e0fcb1c76112e75611d8b4fa 100644 (file)
@@ -15,7 +15,7 @@
 <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>