copy_raster / _ImageryUploaderAGOL.upload_file fails for raster uploads around 50–60 MB
- Vorherrschende Sprache
- Python
- Sterne
- 2.2k
- Forks
- 1.2k
- Ø Merge
- 2 Std. 40 Min.
- Gemergte PRs (30 T.)
- 2
Beschreibung
**Describe the bug**
When publishing hosted imagery layers using copy_raster() (ArcGIS API for Python 2.4.2), raster uploads around 50–60 MB enter an infinite retry loop inside _ImageryUploaderAGOL.upload_file, never completing. Smaller and larger files upload successfully.
**To Reproduce**
Steps to reproduce the behavior:
```python
from arcgis.gis import GIS
from arcgis.raster import copy_raster
gis = GIS("home")
service_item = copy_raster(
input_raster=r"C:\path\to\raster_51mb.tif",
output_name="test_raster",
gis=gis
)
```
error:
```python
# Process stalls indefinitely repeating upload attempts
# No explicit exception is raised
```
**Expected behavior**
Upload should complete successfully regardless of raster size.
**Platform (please complete the following information):**
- OS: Windows 11 / AWS Lambda (AL2)
- Python API Version: 2.4.2
- azure-storage-blob: 12.17.x
- Python: 3.11
**Additional context**
Cause: upload_blob() performs a single PUT for < 64 MiB files; this often times out and loops indefinitely.
Workaround: Replace the call with manual block upload:
```python
import base64
from azure.storage.blob import BlobBlock
blob = self.container.get_blob_client(blobname)
block_ids = []
with open(file_name, "rb") as f:
i = 0
while chunk := f.read(4*1024*1024):
block_id = base64.b64encode(f"{i:08d}".encode()).decode()
blob.stage_block(block_id, data=chunk)
block_ids.append(BlobBlock(block_id=block_id))
i += 1
blob.commit_block_list(block_ids)
```
This resolves the issue for 50–60 MB rasters.
Beitragsleitfaden
Rechercherichtung
Beginne bei _ImageryUploaderAGOL.upload_file und dem upload_blob()-Aufruf, der von copy_raster() verwendet wird; reproduziere den Windows- oder AWS-Lambda-Fall mit einem 50–60 MB großen Raster und untersuche die wiederholten Upload-Versuche. Vergleiche diesen Pfad mit dem bereitgestellten manuellen Workaround für Block-Uploads. Als erledigt gilt, wenn ein Raster in diesem Größenbereich erfolgreich abgeschlossen wird, ohne in eine Endlosschleife bei den Wiederholungsversuchen zu geraten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api, data
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100