Added max_images parameter support

pull/571/head
Piero Toffanin 2018-12-04 12:11:22 -05:00
rodzic 3913526456
commit dfd1695c11
5 zmienionych plików z 30 dodań i 1 usunięć

Wyświetl plik

@ -30,7 +30,7 @@ class ProcessingNodeFilter(FilterSet):
class Meta:
model = ProcessingNode
fields = ['has_available_options', 'id', 'hostname', 'port', 'api_version', 'queue_count', ]
fields = ['has_available_options', 'id', 'hostname', 'port', 'api_version', 'queue_count', 'max_images', ]
class ProcessingNodeViewSet(viewsets.ModelViewSet):
"""

Wyświetl plik

@ -23,6 +23,10 @@
<td>{% trans "Queue Count" %}</td>
<td>{{ processing_node.queue_count }}</td>
</tr>
<tr>
<td>{% trans "Max Images Limit" %}</td>
<td>{{ processing_node.max_images }}</td>
</tr>
<tr>
<td>{% trans "Last Refreshed" %}</td>
<td>{{ processing_node.last_refreshed|timesince }} {% trans 'ago' %} ({{ processing_node.last_refreshed|localtime }})</td> <!-- TODO: timezone? -->

Wyświetl plik

@ -0,0 +1,18 @@
# Generated by Django 2.0.3 on 2018-12-04 17:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nodeodm', '0003_auto_20180625_1230'),
]
operations = [
migrations.AddField(
model_name='processingnode',
name='max_images',
field=models.PositiveIntegerField(blank=True, help_text='Maximum number of images accepted by this node.', null=True),
),
]

Wyświetl plik

@ -42,6 +42,7 @@ class ProcessingNode(models.Model):
queue_count = models.PositiveIntegerField(default=0, help_text="Number of tasks currently being processed by this node (as reported by the node itself)")
available_options = fields.JSONField(default=dict(), help_text="Description of the options that can be used for processing")
token = models.CharField(max_length=1024, blank=True, default="", help_text="Token to use for authentication. If the node doesn't have authentication, you can leave this field blank.")
max_images = models.PositiveIntegerField(help_text="Maximum number of images accepted by this node.", blank=True, null=True)
def __str__(self):
return '{}:{}'.format(self.hostname, self.port)
@ -76,6 +77,9 @@ class ProcessingNode(models.Model):
self.api_version = info['version']
self.queue_count = info['taskQueueCount']
if 'maxImages' in info:
self.max_images = info['maxImages']
options = api_client.options()
self.available_options = options
self.last_refreshed = timezone.now()

Wyświetl plik

@ -11,6 +11,7 @@
"api_version": "1.0.1",
"last_refreshed": "2017-03-01T21:14:49.918276Z",
"queue_count": 0,
"max_images": null,
"available_options": [
{
"help": "Oct-tree depth at which the Laplacian equation is solved in the surface reconstruction step. Increasing this value increases computation times slightly but helps reduce memory usage. Default: 9",
@ -34,6 +35,7 @@ port | int | Port
api_version | string | Version of NodeODM currently running
last_refreshed | string | Date and time this node was last seen online. This value is typically refreshed every 15-30 seconds and is used to decide whether a node is offline or not
queue_count | int | Number of [Task](#task) items currently being processed/queued on this node.
max_images | int | Optional maximum number of images this processing node can accept. null indicates no limit.
available_options | JSON[] | JSON-encoded list of options that this node is capable of handling. See [Available Options](#available-options) for more information
@ -83,6 +85,7 @@ hostname | | "" | Filter by hostname
port | | "" | Filter by port
api_version | | "" | Filter by API version
queue_count | | "" | Filter by queue count
max_images | | "" | Filter by max images
ordering | | "" | Ordering field to sort results by
has_available_options | | "" | Return only processing nodes that have a valid set of processing options (check that the `available_options` field is populated). Either `true` or `false`.