Comments (3)
The most flexible way should be something like this:
def models = [
'https://grobid.s3.amazonaws.com/dataseer-binary_bert-0.3.1.zip',
'https://grobid.s3.amazonaws.com/dataseer-first_bert-0.3.1.zip',
'https://grobid.s3.amazonaws.com/dataseer-reuse_bert-0.3.1.zip',
'https://grobid.s3.amazonaws.com/datasets-BERT_CRF-0.3.2.zip',
'https://grobid.s3.amazonaws.com/context_bert-0.3.2.zip',
'https://grobid.s3.amazonaws.com/context_bert_used-0.3.2.zip',
'https://grobid.s3.amazonaws.com/context_bert_creation-0.3.2.zip',
'https://grobid.s3.amazonaws.com/context_bert_shared-0.3.2.zip'
]
def installModels = tasks.register("installModels")
models.eachWithIndex { model, index ->
def downloadTask = tasks.register("downloadModel_$index", Download) {
src(model)
dest "${projectDir}/models/"
onlyIfNewer true
// overwrite true
}
def unzipTask = tasks.register("unzipModel_$index", Copy) {
dependsOn downloadTask
from zipTree(downloadTask.get().outputs.files.first())
into "${projectDir}/models/extracted/"
}
installModels.get().dependsOn(unzipTask)
}
Creating a separate task for every model has the additional benefit that downloading and unzipping can happen in parallel: as soon as the first model has been downloaded, it can already be unzipped even though the other files are still downloading. Also, using tasks for everything (instead of the download.run
extension) helps with caching. If you execute the task again and nothing has changed, it will be skipped with an UP-TO-DATE
message.
Please note that I've replaced overwrite true
with onlyIfNewer true
to avoid downloading the models over and over again. This is probably what you want.
Let me know if this helps and if so, please close the issue. Thanks!
from gradle-download-task.
I did this:
doLast {
print "Copy models under grobid-home: ${grobidHome}"
download.run {
src([
'https://grobid.s3.amazonaws.com/dataseer-binary_bert-0.3.1.zip',
'https://grobid.s3.amazonaws.com/dataseer-first_bert-0.3.1.zip',
'https://grobid.s3.amazonaws.com/dataseer-reuse_bert-0.3.1.zip',
'https://grobid.s3.amazonaws.com/datasets-BERT_CRF-0.3.2.zip',
'https://grobid.s3.amazonaws.com/context_bert-0.3.2.zip',
'https://grobid.s3.amazonaws.com/context_bert_used-0.3.2.zip',
'https://grobid.s3.amazonaws.com/context_bert_creation-0.3.2.zip',
'https://grobid.s3.amazonaws.com/context_bert_shared-0.3.2.zip'
])
dest "${grobidHome}/models/"
overwrite true
fileTree(dir: "${grobidHome}/models/", includes: ['*.zip']).each { zipFile ->
from zipTree(zipFile)
}
into "${grobidHome}/models/"
}
}
but it does not work, the download works, but not the unzip. 💦
from gradle-download-task.
Thanks!
from gradle-download-task.
Related Issues (20)
- Download Task with Private Repo HOT 5
- Explicit file naming for src property HOT 1
- Only if Modified Recipe to then run Zip or other methods HOT 6
- Documentation unclear about `useETag` HOT 2
- Does plugin support to download file from local a relative file? HOT 6
- Configuration-cache-safe use of download and verify extensions HOT 14
- Problems when use with Kotlin Gradle Plugin 1.7.20 HOT 10
- responseInterceptor missing HOT 3
- Support progress bar when executing task via IntelliJ HOT 1
- How to send Post Body Parameter (data) HOT 4
- Downloading from Internal Repo using Token HOT 10
- untar and unxz HOT 1
- SSLPeerUnverifiedException jfrog-prod-usw2-shared-oregon-main.s3.amazonaws.com HOT 7
- query parameters in src url HOT 2
- Download plugin doesn't encoded files HOT 2
- Allow `src` to take `URI` objects HOT 1
- Cached download should be ignored if URL changes HOT 4
- Can download task add new property to avoid directly throw exception? HOT 7
- Bad request after redirect HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradle-download-task.