Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
f654111
Merge pull request #626 from geosolutions-it/merge_from_upsteram
giohappy Jan 20, 2021
0df9357
Merge branch 'master' of https://github.com/GeoNode/geonode
allyoucanmap Feb 1, 2021
2a11ead
Bump urllib3 from 1.26.2 to 1.26.3 (#6908)
dependabot[bot] Feb 2, 2021
040772e
[Fixes #6880] Circle CI upload tests fail irregulary (#6881)
t-book Feb 2, 2021
65c6267
[Fixes #6914] Remove "add to basket" tool for documents and maps (#6915)
Feb 2, 2021
158511a
Added malnajdi as contributor
t-book Feb 2, 2021
e9efc3d
[Fixes #6910] meaningful filename for document download (#6911)
gannebamm Feb 2, 2021
91f1a4e
- CircleCI Upload Tests: trying to reduce more the risk of infinite …
afabiani Feb 2, 2021
5e77b39
[Fixes #6916] gsimporter.api.NotFound caused by missing trailing slas…
malnajdi Feb 3, 2021
ec6d728
Bump django-cors-headers from 3.6.0 to 3.7.0 (#6901)
dependabot[bot] Feb 3, 2021
c5432b5
Bump amqp from 5.0.3 to 5.0.5 (#6905)
dependabot[bot] Feb 3, 2021
28424ca
Bump pip from 21.0 to 21.0.1 (#6900)
dependabot[bot] Feb 3, 2021
be313d5
Bump coverage from 5.3.1 to 5.4 (#6903)
dependabot[bot] Feb 3, 2021
f073274
Bump pytest from 6.2.1 to 6.2.2 (#6907)
dependabot[bot] Feb 3, 2021
9a3913e
Bump djangorestframework-gis from 0.16 to 0.17 (#6902)
dependabot[bot] Feb 3, 2021
ae6f6c1
- Algin setup.cfg to requirements.txt
afabiani Feb 3, 2021
0dad216
[Fixes #6922][REST API v2] Expose the curated thumbnail URL if it has…
Feb 3, 2021
30910b2
[Fixes #6918] Removal of QGIS support (#6919)
Feb 3, 2021
dbb4ac0
Merge branch 'master' of https://github.com/GeoNode/geonode
Feb 4, 2021
0bcf2fb
allow Basic authenticated requests in LOCKDOWN mode
bieganowski Feb 5, 2021
af22a3c
fix to avoid circular import
bieganowski Feb 5, 2021
c7ede4f
flake8 check fix
bieganowski Feb 5, 2021
b557f6d
added tests
bieganowski Feb 5, 2021
0a82a14
Merge pull request #652 from geosolutions-it/feature#650_basic_auth_m…
Feb 5, 2021
11f40ba
Merge pull request #678 from geosolutions-it/upstream_master
Feb 23, 2021
482080a
Merge remote-tracking branch 'upstream/master'
giohappy Mar 1, 2021
2f70532
Merge remote-tracking branch 'upstream/master'
giohappy Mar 2, 2021
de43e90
Merge branch 'master' of https://github.com/geosolutions-it/geonode
Mar 4, 2021
40408a3
Merge remote-tracking branch 'origin/master' into geosolutions-master
giohappy Mar 9, 2021
4ce20ab
Merge branch 'master' of https://github.com/GeoNode/geonode into geos…
afabiani Mar 12, 2021
2fd3272
[Fixes #6880] Circle CI upload tests fail irregulary (#6881)
t-book Feb 2, 2021
4539658
[Fixes #6914] Remove "add to basket" tool for documents and maps (#6915)
Feb 2, 2021
ba85f23
Added malnajdi as contributor
t-book Feb 2, 2021
e47daa6
Bump pip from 21.0 to 21.0.1 (#6900)
dependabot[bot] Feb 3, 2021
1346aeb
- Algin setup.cfg to requirements.txt
afabiani Feb 3, 2021
8ed0f4d
[Fixes #6922][REST API v2] Expose the curated thumbnail URL if it has…
Feb 3, 2021
65c7605
[Fixes #6918] Removal of QGIS support (#6919)
Feb 3, 2021
9af1c3b
allow Basic authenticated requests in LOCKDOWN mode
bieganowski Feb 5, 2021
97ed2c5
fix to avoid circular import
bieganowski Feb 5, 2021
ee282a2
- Align to upstream master branch
afabiani Mar 12, 2021
706ea43
Merge remote-tracking branch 'upstream/master'
giohappy Apr 22, 2021
711a619
Merge remote-tracking branch 'origin/master' into geosolutions-master
giohappy Apr 30, 2021
354764e
Merge remote-tracking branch 'origin/master' into geosolutions-master
giohappy May 11, 2021
e18bc6f
Merge branch 'master' of github.com:geosolutions-it/geonode
Jun 23, 2021
e5cf581
Merge branch 'master' of github.com:GeoNode/geonode
Jul 21, 2021
06d2930
Merge branch 'master' of github.com:GeoNode/geonode
Jul 22, 2021
3db74fc
Merge branch 'master' of github.com:GeoNode/geonode
Jul 28, 2021
5a65e39
Merge branch 'master' of github.com:GeoNode/geonode
Jul 28, 2021
dd6073e
Merge branch 'master' of github.com:GeoNode/geonode
Jul 29, 2021
0e4c038
Merge branch 'master' of github.com:GeoNode/geonode
Sep 7, 2021
a12c12b
Merge branch 'master' of github.com:GeoNode/geonode
Sep 28, 2021
43edc47
Merge branch 'master' of github.com:GeoNode/geonode
Sep 29, 2021
bd8de19
Merge branch 'master' of github.com:GeoNode/geonode
Sep 30, 2021
4fa8283
[Fixes #7945] Ingest harvested layer data to geonode
meomancer Aug 13, 2021
dd43d6c
Improve harvesting session and the admin
Sep 17, 2021
4edd83d
fix migration files conflict
Sep 21, 2021
51eb810
Initial work for implementing stoppable harvesting sessions
Sep 24, 2021
31f9370
Implement aborting of harvesting celery tasks
Sep 27, 2021
4f3c228
fix tests
Sep 29, 2021
28e25e9
fix conflicts
Sep 30, 2021
aa39ffd
Remove accidental duplication of code that crept in during conflict r…
Sep 30, 2021
9e1f59e
Add a couple more tests
Sep 30, 2021
e091f05
Update signature of get_resource method in WMS harvester worker
Sep 30, 2021
8359065
Uncomment `settings.py` line that designates the GeoNode test runner …
Sep 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
289 changes: 146 additions & 143 deletions geonode/harvesting/admin.py

Large diffs are not rendered by default.

27 changes: 16 additions & 11 deletions geonode/harvesting/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from .. import (
models,
tasks,
utils,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -141,7 +140,7 @@ def validate(self, data):
worker_config_field, getattr(self.instance, worker_config_field, None))
if worker_type is not None and worker_config is not None:
try:
utils.validate_worker_configuration(worker_type, worker_config)
models.validate_worker_configuration(worker_type, worker_config)
except jsonschema.exceptions.ValidationError:
raise serializers.ValidationError(
f"Invalid {worker_config_field!r} configuration")
Expand All @@ -162,7 +161,7 @@ def create(self, validated_data):
f"value of {models.Harvester.STATUS_READY!r}"
)
harvester = super().create(validated_data)
available = utils.update_harvester_availability(harvester)
available = harvester.update_availability()
if available:
harvester.status = harvester.STATUS_UPDATING_HARVESTABLE_RESOURCES
harvester.save()
Expand Down Expand Up @@ -208,12 +207,17 @@ def update(self, instance: models.Harvester, validated_data):
f"This status can only be set by the server, when appropriate."
)
elif desired_status == models.Harvester.STATUS_UPDATING_HARVESTABLE_RESOURCES:
post_update_task = tasks.update_harvestable_resources.signature(
args=(instance.id,))
session = models.AsynchronousHarvestingSession.objects.create(
harvester=instance,
session_type=models.AsynchronousHarvestingSession.TYPE_DISCOVER_HARVESTABLE_RESOURCES
)
post_update_task = tasks.update_harvestable_resources.signature(args=(session.pk,))
elif desired_status == models.Harvester.STATUS_PERFORMING_HARVESTING:
harvesting_session = models.HarvestingSession.objects.create(harvester=instance)
post_update_task = tasks.harvesting_dispatcher.signature(
args=(instance.pk, harvesting_session.pk))
session = models.AsynchronousHarvestingSession.objects.create(
harvester=instance,
session_type=models.AsynchronousHarvestingSession.TYPE_HARVESTING
)
post_update_task = tasks.harvesting_dispatcher.signature(args=(session.pk,))
elif desired_status == models.Harvester.STATUS_CHECKING_AVAILABILITY:
post_update_task = tasks.check_harvester_available.signature(
args=(instance.id,))
Expand All @@ -239,15 +243,16 @@ def update(self, instance: models.Harvester, validated_data):
return updated_instance


class BriefHarvestingSessionSerializer(DynamicModelSerializer):
class BriefAsynchronousHarvestingSessionSerializer(DynamicModelSerializer):
class Meta:
model = models.HarvestingSession
model = models.AsynchronousHarvestingSession
fields = (
"id",
"started",
"updated",
"ended",
"records_harvested",
"total_records_to_process",
"records_done",
)


Expand Down
2 changes: 1 addition & 1 deletion geonode/harvesting/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
basename='harvestable-resources',
parents_query_lookups=['harvester_id']
)
router.register('harvesting-sessions', views.HarvestingSessionViewSet)
router.register('harvesting-sessions', views.AsynchronousHarvestingSessionViewSet)

urlpatterns = router.urls
6 changes: 3 additions & 3 deletions geonode/harvesting/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_serializer_context(self):
return context


class HarvestingSessionViewSet(WithDynamicViewSetMixin, viewsets.ReadOnlyModelViewSet):
queryset = models.HarvestingSession.objects.all()
serializer_class = serializers.BriefHarvestingSessionSerializer
class AsynchronousHarvestingSessionViewSet(WithDynamicViewSetMixin, viewsets.ReadOnlyModelViewSet):
queryset = models.AsynchronousHarvestingSession.objects.all()
serializer_class = serializers.BriefAsynchronousHarvestingSessionSerializer
pagination_class = GeoNodeApiPagination
4 changes: 0 additions & 4 deletions geonode/harvesting/harvesters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def get_geonode_resource_type(self, remote_resource_type: str) -> ResourceBase:
def get_resource(
self,
harvestable_resource: "HarvestableResource", # noqa
harvesting_session_id: int
) -> typing.Optional[HarvestedResourceInfo]:
"""Harvest a single resource from the remote service.

Expand Down Expand Up @@ -155,7 +154,6 @@ def finalize_resource_update(
geonode_resource: ResourceBase,
harvested_info: HarvestedResourceInfo,
harvestable_resource: "HarvestableResource", # noqa
harvesting_session_id: int
) -> ResourceBase:
"""Perform additional actions just after having created/updated a local GeoNode resource.

Expand Down Expand Up @@ -262,7 +260,6 @@ def update_geonode_resource(
self,
harvested_info: HarvestedResourceInfo,
harvestable_resource: "HarvestableResource", # noqa
harvesting_session_id: int,
):
"""Create or update a local GeoNode resource with the input harvested information.

Expand Down Expand Up @@ -297,7 +294,6 @@ def update_geonode_resource(
geonode_resource,
harvested_info,
harvestable_resource,
harvesting_session_id
)

def _create_new_geonode_resource(self, geonode_resource_type, defaults: typing.Dict):
Expand Down
1 change: 0 additions & 1 deletion geonode/harvesting/harvesters/geonodeharvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ def get_geonode_resource_type(self, remote_resource_type: str) -> typing.Type[ty
def get_resource(
self,
harvestable_resource: models.HarvestableResource,
harvesting_session_id: int
) -> typing.Optional[base.HarvestedResourceInfo]:
resource_unique_identifier = harvestable_resource.unique_identifier
local_resource_type = self.get_geonode_resource_type(harvestable_resource.remote_resource_type)
Expand Down
1 change: 0 additions & 1 deletion geonode/harvesting/harvesters/wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def get_geonode_resource_type(self, remote_resource_type: str) -> ResourceBase:
def get_resource(
self,
harvestable_resource: "HarvestableResource", # noqa
harvesting_session_id: int
) -> typing.Optional[base.HarvestedResourceInfo]:
resource_unique_identifier = harvestable_resource.unique_identifier
data = self._get_data()
Expand Down
29 changes: 29 additions & 0 deletions geonode/harvesting/migrations/0037_alter_harvester_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.2.4 on 2021-09-24 09:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('harvesting', '0036_alter_harvester_harvester_type'),
]

operations = [
migrations.AlterField(
model_name='harvester',
name='status',
field=models.CharField(
choices=[
('ready', 'ready'),
('updating-harvestable-resources', 'updating-harvestable-resources'),
('aborting-update-harvestable-resources', 'aborting-update-harvestable-resources'),
('harvesting-resources', 'harvesting-resources'),
('aborting-harvesting-resources', 'aborting-harvesting-resources'),
('checking-availability', 'checking-availability')
],
default='ready',
max_length=50
),
),
]
34 changes: 34 additions & 0 deletions geonode/harvesting/migrations/0038_auto_20210927_1455.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 3.2.4 on 2021-09-27 14:55

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('harvesting', '0037_alter_harvester_status'),
]

operations = [
migrations.AlterField(
model_name='harvestingsession',
name='status',
field=models.CharField(choices=[('pending', 'pending'), ('on-going', 'on-going'), ('finished-all-ok', 'finished-all-ok'), ('finished-all-failed', 'finished-all-failed'), ('finished-some-failed', 'finished-some-failed'), ('aborting', 'aborting'), ('aborted', 'aborted')], default='pending', editable=False, max_length=50),
),
migrations.CreateModel(
name='AsynchronousHarvestingSession',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('session_type', models.CharField(choices=[('harvesting', 'harvesting'), ('discover-harvestable-resources', 'discover-harvestable-resources')], editable=False, max_length=50)),
('started', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('ended', models.DateTimeField(blank=True, null=True)),
('status', models.CharField(choices=[('pending', 'pending'), ('on-going', 'on-going'), ('finished-all-ok', 'finished-all-ok'), ('finished-all-failed', 'finished-all-failed'), ('finished-some-failed', 'finished-some-failed'), ('aborting', 'aborting'), ('aborted', 'aborted')], default='pending', editable=False, max_length=50)),
('details', models.TextField(blank=True)),
('total_records_to_process', models.IntegerField(default=0, editable=False, help_text='Number of records being processed in this session')),
('records_done', models.IntegerField(default=0, help_text='Number of records that have already been processed')),
('harvester', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sessions', to='harvesting.harvester')),
],
),
]
16 changes: 16 additions & 0 deletions geonode/harvesting/migrations/0039_delete_harvestingsession.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 3.2.4 on 2021-09-27 15:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('harvesting', '0038_auto_20210927_1455'),
]

operations = [
migrations.DeleteModel(
name='HarvestingSession',
),
]
Loading