From dfd1695c110b7da4fcdadc3e7fbc668b519e7034 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 4 Dec 2018 12:11:22 -0500 Subject: [PATCH] Added max_images parameter support --- app/api/processingnodes.py | 2 +- app/templates/app/processing_node.html | 4 ++++ .../0004_processingnode_max_images.py | 18 ++++++++++++++++++ nodeodm/models.py | 4 ++++ .../includes/reference/_processingnode.md | 3 +++ 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 nodeodm/migrations/0004_processingnode_max_images.py diff --git a/app/api/processingnodes.py b/app/api/processingnodes.py index 3a4326b2..f1d4eef5 100644 --- a/app/api/processingnodes.py +++ b/app/api/processingnodes.py @@ -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): """ diff --git a/app/templates/app/processing_node.html b/app/templates/app/processing_node.html index 063b4613..c76007c9 100644 --- a/app/templates/app/processing_node.html +++ b/app/templates/app/processing_node.html @@ -23,6 +23,10 @@ {% trans "Queue Count" %} {{ processing_node.queue_count }} + + {% trans "Max Images Limit" %} + {{ processing_node.max_images }} + {% trans "Last Refreshed" %} {{ processing_node.last_refreshed|timesince }} {% trans 'ago' %} ({{ processing_node.last_refreshed|localtime }}) diff --git a/nodeodm/migrations/0004_processingnode_max_images.py b/nodeodm/migrations/0004_processingnode_max_images.py new file mode 100644 index 00000000..e67aef6d --- /dev/null +++ b/nodeodm/migrations/0004_processingnode_max_images.py @@ -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), + ), + ] diff --git a/nodeodm/models.py b/nodeodm/models.py index 477879ed..d4618dd3 100644 --- a/nodeodm/models.py +++ b/nodeodm/models.py @@ -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() diff --git a/slate/source/includes/reference/_processingnode.md b/slate/source/includes/reference/_processingnode.md index 7bb21c95..4ffd59dc 100644 --- a/slate/source/includes/reference/_processingnode.md +++ b/slate/source/includes/reference/_processingnode.md @@ -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`.