generated from kartoza/django-react-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from kartoza/feat-validate-input-layer
add task to move input layer directory when privacy type is changed
- Loading branch information
Showing
6 changed files
with
195 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .cleaner import * # noqa | ||
from .runner import * # noqa | ||
from .remove_layers import * # noqa | ||
from .verify_input_layer import * # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import logging | ||
from celery import shared_task | ||
from cplus_api.models import ( | ||
InputLayer | ||
) | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@shared_task(name="verify_input_layer") | ||
def verify_input_layer(layer_id): | ||
""" | ||
Verify input layer: directory + size. | ||
""" | ||
layer = InputLayer.objects.get(id=layer_id) | ||
layer.fix_layer_metadata() | ||
if layer.is_available(): | ||
logger.info( | ||
f'Layer {layer.uuid} is stored in {layer.file.name} ' | ||
f'with size {layer.size}' | ||
) | ||
else: | ||
logger.warn(f'Layer {layer.uuid} is not available!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters