Skip to content

Commit 32286ff

Browse files
committed
add instructions and fix
1 parent 0aa1e9f commit 32286ff

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

bioconda-backup/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,40 @@ Support full scan update or update from last repo check
2929

3030
node index.js --help
3131

32+
## CI
33+
34+
github CI will execute at regular interval. Script will check in workdir (see config.yml) for git repo clone.
35+
36+
* if not present, will clone repo and scan for all containers
37+
* if present, will look *record* last commit, pull data, and look at modified files (so containers) to check only related containers (if they need a backup)
38+
39+
GitHub stops jobs after 24 hours, which can occur for very large updates. In this case, script is killed and a lock file will be left, preventing further cron jobs to run.
40+
Lock file is to precent running multiple jobs at the same time. If this occurs (**wokrdir**/sync.lock already present), simply delete the lock file and run
41+
manually the failed job (better in background...):
42+
43+
# workdir = /mnt/data/sync
44+
# look at json file related to date failure
45+
ls -l /mnt/data/sync
46+
drwxr-xr-x 7 ubuntu ubuntu 4096 Jul 22 23:09 bioconda
47+
drwxr-xr-x 902 ubuntu ubuntu 36864 Jul 23 00:40 biocontainers
48+
-rw-r--r-- 1 ubuntu ubuntu 1103453 Jul 20 23:49 biocontainers_1689894554195.json
49+
-rw-rw-r-- 1 ubuntu ubuntu 0 Jul 23 07:10 sync.lock
50+
# example
51+
node index.js --backup --aws --conda --file /mnt/data/sync/biocontainers_1689894554195.json
52+
53+
json files are created at container lookup step, and deleted on success. In case of job failure, json file will be present and ease replay.
54+
final solution is to delete **workdir**/bioconda|biocontainer and run without the --updated option to check for **all** containers (very long job....)
3255

3356
## example
3457

58+
### backup conda containers to registry AND aws
59+
3560
backup conda (quay.io) containers to aws since last run
3661

3762
node index.js --aws --conda --updated
63+
64+
### backup github dockerfile containers to registry AND aws
65+
66+
backup conda (quay.io) containers to aws since last run
67+
68+
node index.js --aws --docker --updated

bioconda-backup/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,19 +585,31 @@ async function getContainers(scan_options) {
585585
let containers = []
586586
let dockerfiles = await scan('biocontainers', scan_options)
587587
let docker_containers = []
588+
let docker_managed = {}
588589
for(let i=0;i<dockerfiles.length;i++){
589590
let elts = dockerfiles[i].split('/');
591+
if(docker_managed[elts[elts.length-3]] !== undefined) {
592+
continue
593+
}
590594
docker_containers.push({'name': elts[elts.length-3], 'tags': [], quay: false})
595+
docker_managed[elts[elts.length-3]] = true
591596
}
597+
docker_managed = null
592598
let data = await dockerhub(docker_containers, scan_options)
593599
containers = containers.concat(data)
594600

595601
let condafiles = await scan('bioconda', scan_options)
596602
let conda_containers = []
603+
let conda_managed = {}
597604
for(let i=0;i<condafiles.length;i++){
598605
let elts = condafiles[i].split('/');
606+
if(conda_managed[elts[elts.length-2]] !== undefined) {
607+
continue
608+
}
599609
conda_containers.push({'name': elts[elts.length-2], 'tags': [], quay: true});
610+
conda_managed[elts[elts.length-2]] = true
600611
}
612+
conda_managed = null
601613
data = await quayio(conda_containers, scan_options)
602614
containers = containers.concat(data)
603615

0 commit comments

Comments
 (0)