Skip to content

Conversation

@ricardogsilva
Copy link
Member

@ricardogsilva ricardogsilva commented Sep 27, 2021

This PR implements aborting of on-going harvesting-related asynchronous tasks.

It improves the existing concept of a harvesting session by implementing the AsynchronousHarvestingSession model. This model is now used for the two types of async operations supported by a harvester:

  • Refreshing the list of harvestable resources that are available for being harvested on the remote;
  • Performing the actual harvesting of the selected remote resources.

Each session also stores some useful properties and can be used to get a sense of progress. For now, some of these properties are also being reflected on the Harvester model. In the future we may remove them from the harvester and use the session exclusively, as it seems like a more natural place to store them.

Despite introducing better support for harvesting-related sessions, the HarvesterAdmin continues to be the main place to kickoff/abort new sessions. As such, the admin section for harvesting.harvesters gains new actions for aborting on-going sessions. An aborted session is signaled as aborted by means of its status field. On the API side this means that the harvesting sessions continue to be read-only and that the harvesters/{harvester-id} continues to be the endpoint to reach for whenever starting/aborting a new session - this is done via sending HTTP PATCH requests that modify the harvester's status field and was not changed.

Another notable change introduced by this PR is that when a harvester is created via the django admin it no longer automatically updates its underlying harvestable resources list. The user must now explicitly ask for a refresh of the harvestable resources. This change was introduced to both a) make the code cleaner and b) give the user one more chance to review the harvester parameters after creation, without forcing him to wait for a potentially long time before the harvester becomes ready again.

fixes #7955

giohappy and others added 30 commits January 20, 2021 09:37
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.2 to 1.26.3.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/1.26.3/CHANGES.rst)
- [Commits](urllib3/urllib3@1.26.2...1.26.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Toni <toni.schoenbuchner@csgis.de>
…6881)

* [Fixes GeoNode#6880] Circle CI upload tests fail irregulary

* CircleCI test fix: sometimes expires due to upload timeout in the test environment

* - Avoid infinite loop on upload testing

* Revert "CircleCI test fix: sometimes expires due to upload timeout in the test environment"

This reverts commit 66139fd.

Co-authored-by: Alessio Fabiani <alessio.fabiani@geo-solutions.it>
Co-authored-by: afabiani <alessio.fabiani@gmail.com>
…de#6911)

* get meaningful document filenames on download

* - Strip extension from document title before slugify it (e.g.: image.jpg instead of imagejpg.jpg)

Co-authored-by: afabiani <alessio.fabiani@gmail.com>
Co-authored-by: Alessio Fabiani <alessio.fabiani@geo-solutions.it>
…ng slash at the end of GEOSERVER_LOCATION (GeoNode#6913)

* [Fixes GeoNode#6916] gsimporter.api.NotFound caused by missing trailing slash at the end of GEOSERVER_LOCATION

* [Fixes GeoNode#6916] unit test for GEOSERVER_LOCATION
Bumps [django-cors-headers](https://github.com/adamchainz/django-cors-headers) from 3.6.0 to 3.7.0.
- [Release notes](https://github.com/adamchainz/django-cors-headers/releases)
- [Changelog](https://github.com/adamchainz/django-cors-headers/blob/master/HISTORY.rst)
- [Commits](adamchainz/django-cors-headers@3.6.0...3.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [amqp](https://github.com/celery/py-amqp) from 5.0.3 to 5.0.5.
- [Release notes](https://github.com/celery/py-amqp/releases)
- [Changelog](https://github.com/celery/py-amqp/blob/master/Changelog)
- [Commits](celery/py-amqp@v5.0.3...v5.0.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [pip](https://github.com/pypa/pip) from 21.0 to 21.0.1.
- [Release notes](https://github.com/pypa/pip/releases)
- [Changelog](https://github.com/pypa/pip/blob/master/NEWS.rst)
- [Commits](pypa/pip@21.0...21.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.3.1 to 5.4.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](coveragepy/coveragepy@coverage-5.3.1...coverage-5.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@6.2.1...6.2.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [djangorestframework-gis](https://github.com/openwisp/django-rest-framework-gis) from 0.16 to 0.17.
- [Release notes](https://github.com/openwisp/django-rest-framework-gis/releases)
- [Changelog](https://github.com/openwisp/django-rest-framework-gis/blob/master/CHANGES.rst)
- [Commits](openwisp/django-rest-framework-gis@v0.16.0...v0.17.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
… it has… (GeoNode#6923)

* [Fixes GeoNode#6922][REST API v2] Expose the curated thumbnail URL if it has been uploaded

* - Add REST APIs test suite to CircleCI
* [Cleanup and Refactor] Remove QGIS server backend dependencies

* [Cleanup and Refactor] Remove QGIS server backend dependencies

* - Fix LGTM issues
…iddleware

Feature#650 basic auth middleware
@ricardogsilva ricardogsilva force-pushed the 7955-allow-stopping-tasks branch from 8f6b489 to d9f3a3d Compare September 30, 2021 09:26
@lgtm-com
Copy link

lgtm-com bot commented Sep 30, 2021

This pull request introduces 1 alert when merging d9f3a3d into 2164b02 - view on LGTM.com

new alerts:

  • 1 for Signature mismatch in overriding method

@lgtm-com
Copy link

lgtm-com bot commented Sep 30, 2021

This pull request introduces 1 alert when merging da9a933 into 2164b02 - view on LGTM.com

new alerts:

  • 1 for Signature mismatch in overriding method

@ricardogsilva ricardogsilva marked this pull request as ready for review September 30, 2021 11:24
@ricardogsilva
Copy link
Member Author

@afabiani the drop in coverage seems to be unrelated to this PR. Perhaps due to other parts of the codebase changing? Or maybe I am reading things wrong?

@lgtm-com
Copy link

lgtm-com bot commented Sep 30, 2021

This pull request introduces 1 alert when merging 795c90c into 2164b02 - view on LGTM.com

new alerts:

  • 1 for Signature mismatch in overriding method

@afabiani
Copy link
Member

@ricardogsilva no worries, I really don't think it is depending by this PR

@afabiani
Copy link
Member

@ricardogsilva
Copy link
Member Author

@afabiani yeah let me fix that before you move on

Ricardo Garcia Silva and others added 11 commits September 30, 2021 15:04
Add the `AsynchronousHarvestingSession` model, which is used
to implement sessions for both refreshing of a harvester's
harvestable resources and for the harvesting of remote
resources.

Refactor the `admin`, `api` and `tasks` to use this new model.

Moved some functions out of `harvesting.utils` module in order
to avoid circular imports
@ricardogsilva ricardogsilva force-pushed the 7955-allow-stopping-tasks branch from c007191 to e091f05 Compare September 30, 2021 14:06
@ricardogsilva
Copy link
Member Author

@afabiani should be fixed now

@ricardogsilva
Copy link
Member Author

@afabiani I accidentally left a commented line in settings.py (I'm using the default test runner) - let me quickly fix that and then I think it would be good to merge.

@ricardogsilva
Copy link
Member Author

done!

@afabiani afabiani added this to the 4.0.0 milestone Oct 1, 2021
@afabiani afabiani merged commit 0867642 into GeoNode:master Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed CLA Bot: community license agreement signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Django admin action to stop running tasks

9 participants