Skip to content

Commit 78cdc3a

Browse files
author
Federico Ceratto
committed
Trim S3 cache immediately
1 parent bbb61ec commit 78cdc3a

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

af/fastpath/debian/changelog

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
fastpath (0.29) unstable; urgency=medium
22

3-
* sshfeeder fixes
3+
* Trim S3 cache immediately
4+
* Sshfeeder fixes
45

56
-- Federico Ceratto <[email protected]> Mon, 25 May 2020 12:35:26 +0100
67

af/fastpath/fastpath/core.py

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def setup():
110110
help="Do not write measurement on disk")
111111
ap.add_argument("--no-write-to-db", action="store_true",
112112
help="Do not insert measurement in database")
113+
ap.add_argument("--keep-s3-cache", action="store_true",
114+
help="Keep files downloaded from S3 in the local cache")
113115
conf = ap.parse_args()
114116

115117
if conf.devel or conf.stdout or no_journal_handler:

af/fastpath/fastpath/s3feeder.py

+6
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ def stream_cans(conf, start_day: date, end_day: date) -> Generator[MsmtTup, None
222222
except Exception as e:
223223
log.error(str(e), exc_info=True)
224224

225+
if not conf.keep_s3_cache:
226+
try:
227+
can_f.unlink()
228+
except FileNotFoundError:
229+
pass
230+
225231
day += timedelta(days=1)
226232

227233
if end_day:

0 commit comments

Comments
 (0)