copy_raster / _ImageryUploaderAGOL.upload_file fails for raster uploads around 50–60 MB
- Lingua principale
- Python
- Stelle
- 2.2k
- Fork
- 1.2k
- Merge medio
- 2h 40m
- PR unite (30g)
- 2
Descrizione
**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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da _ImageryUploaderAGOL.upload_file e dalla chiamata a upload_blob() utilizzata da copy_raster(); riproduci il caso Windows o AWS Lambda con un raster da 50–60 MB e analizza i tentativi di upload ripetuti. Confronta questo percorso con il workaround manuale di upload a blocchi fornito. Il lavoro è completato quando un raster di queste dimensioni viene completato correttamente senza entrare in un ciclo infinito di tentativi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- api, data
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100