-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I've been trying to run the build process, have not been successful yet, but I have come across some hurdles which I addressed as I was going:
- tmp folder must exist before creating files in it.
- flaky download process: I had about 1/3 chance of getting an unexpected EOF as the connection was broken during download
- existing files get downloaded again
- image magic fails mysteriously
I'm now stuck on imagemagic after messing around with its policy file. Managed to convert one file, the rest give:
$ convert tmp/world.200404.3x21600x21600.B2.png -scale 50% tmp/world.B2.2.png
convert-im6.q16: no images defined `tmp/world.B2.2.png' @ error/convert.c/ConvertImageCommand/3229.
For a more robust download, I added this little helper:
(defn- download
[url out & {:keys [force? retries]
:or {force? false
retries 3}}]
(let [target (io/file out)
exists? (java.io.File/.exists target)]
(.println *err* (str "Downloading " url " ..."))
(println url out exists?)
(when (or (not (java.io.File/.exists target)) force?)
(try
(io/copy
(io/input-stream url)
target)
(catch Exception e
(.println *err* (str "Exception during download" e))
(if (pos? retries)
(download url out :force? force? :retries (dec retries))
(throw e)))))))Metadata
Metadata
Assignees
Labels
No labels