iterative / iterative/PyDrive2

fs.cp_file: out of memory error (don't store file in RAM)

Offen
#138 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
fs optimization priority-p2
Vorherrschende Sprache
Python
Sterne
670
Forks
75
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

https://github.com/iterative/PyDrive2/blob/378c6e80471d44f4164e64a178efc2f06ecae882/pydrive2/fs/spec.py#L358-L365

ref. https://github.com/iterative/PyDrive2/pull/119#pullrequestreview-753066960 suggestion:

> ```diff
> - """In-memory streamed copy"""
> - with self.open(lpath) as stream:
> - # IterStream objects doesn't support full-length
> - # seek() calls, so we have to wrap the data with
> - # an external buffer.
> - buffer = io.BytesIO(stream.read())
> - self.upload_fobj(buffer, rpath)
> + with self.open(lpath) as stream:
> + self.upload_fobj(stream, rpath)
> ```
>
> and fix `self.open` to return a proper stream.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start at pydrive2/fs/spec.py lines 358-365 and compare the proposed change in PR #119's review. Trace self.open and self.upload_fobj; done means fs.cp_file streams the file without buffering its entire contents in RAM and returns a proper stream.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api, cloud
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.