From dc3e1cc037c9914bbdc791770061178d1c684d41 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sat, 26 Jul 2025 13:57:59 -0400 Subject: [PATCH] Remove abort checks --- app/raster_utils.py | 8 +------- worker/tasks.py | 7 ++----- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/app/raster_utils.py b/app/raster_utils.py index 66c989ac..ba02c3c1 100644 --- a/app/raster_utils.py +++ b/app/raster_utils.py @@ -87,7 +87,7 @@ def compute_block_aligned_subwindows(src, win): def padded_window(w, pad): return Window(w.col_off - pad, w.row_off - pad, w.width + pad * 2, w.height + pad * 2) -def export_raster(input, output, progress_callback=None, is_aborted=None, **opts): +def export_raster(input, output, progress_callback=None, **opts): now = time.time() current_progress = 0 @@ -313,8 +313,6 @@ def export_raster(input, output, progress_callback=None, is_aborted=None, **opts with rasterio.open(output_raster, 'w', **profile) as dst: for idx, (w, dst_w) in enumerate(subwins): - if is_aborted is not None and is_aborted(): - return p(f"Processing tile {idx}/{num_wins}", progress_per_win) data = src.read(indexes=indexes, window=w, out_dtype=np.float32) @@ -352,8 +350,6 @@ def export_raster(input, output, progress_callback=None, is_aborted=None, **opts # Apply hillshading, colormaps to elevation with rasterio.open(output_raster, 'w', **profile) as dst: for idx, (w, dst_w) in enumerate(subwins): - if is_aborted is not None and is_aborted(): - return p(f"Processing tile {idx}/{num_wins}", progress_per_win) # Apply colormap? @@ -406,8 +402,6 @@ def export_raster(input, output, progress_callback=None, is_aborted=None, **opts # Copy bands as-is with rasterio.open(output_raster, 'w', **profile) as dst: for idx, (w, dst_w) in enumerate(subwins): - if is_aborted is not None and is_aborted(): - return p(f"Processing tile {idx}/{num_wins}", progress_per_win) arr = src.read(indexes=indexes, window=w) diff --git a/worker/tasks.py b/worker/tasks.py index eae52e95..cd7c5a35 100644 --- a/worker/tasks.py +++ b/worker/tasks.py @@ -20,7 +20,6 @@ from nodeodm.models import ProcessingNode from webodm import settings import worker from .celery import app -from celery.contrib.abortable import AbortableTask from app.raster_utils import export_raster as export_raster_sync, extension_for_export_format from app.pointcloud_utils import export_pointcloud as export_pointcloud_sync from django.utils import timezone @@ -191,17 +190,15 @@ def process_pending_tasks(): process_task.delay(task.id) -@app.task(bind=True, time_limit=settings.WORKERS_MAX_TIME_LIMIT, base=AbortableTask) +@app.task(bind=True, time_limit=settings.WORKERS_MAX_TIME_LIMIT) def export_raster(self, input, **opts): try: logger.info("Exporting raster {} with options: {}".format(input, json.dumps(opts))) tmpfile = tempfile.mktemp('_raster.{}'.format(extension_for_export_format(opts.get('format', 'gtiff'))), dir=settings.MEDIA_TMP) def progress_callback(status, perc): self.update_state(state="PROGRESS", meta={"status": status, "progress": perc}) - def is_aborted(): - return self.is_aborted() - export_raster_sync(input, tmpfile, progress_callback=progress_callback, is_aborted=is_aborted, **opts) + export_raster_sync(input, tmpfile, progress_callback=progress_callback, **opts) result = {'file': tmpfile} if settings.TESTING: