首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么不能在slurm脚本中运行带背景选项的wget?

为什么不能在slurm脚本中运行带背景选项的wget?
EN

Stack Overflow用户
提问于 2021-01-17 10:23:41
回答 1查看 541关注 0票数 1

我用这个脚本下载文件。没有-bwget逐个下载文件。有了-b,我可以在后台同时下载文件。不幸的是,这个脚本在SLURM中不起作用。它只在Slurm中不使用-b即可工作。

下载文件的脚本

代码语言:javascript
复制
#!/bin/bash

mkdir data
cd data
for i in 11 08 15 26 ;
do
  wget -c -b -q ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR116/0${i}/SRR116802${i}/SRR116802${i}_1.fastq.gz 
  wget -c -b -q ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR116/0${i}/SRR116802${i}/SRR116802${i}_2.fastq.gz
done

cd ..

Slurm脚本

代码语言:javascript
复制
#!/bin/bash

#SBATCH --job-name=mytestjob     # create a short name for your job
#SBATCH --nodes=2                # node count
#SBATCH --ntasks=2               # total number of tasks across all nodes
#SBATCH --cpus-per-task=2        # cpu-cores per task (>1 if multi-threaded tasks)
#SBATCH --mem-per-cpu=4G         # memory per cpu-core (4G is default
#SBATCH --time=10:01:00          # total run time limit (HH:MM:SS)
#SBATCH --array=1-2              # job array with index values 1, 2

#Execution

bash download.sh

终端上的:sbatch slurmsript.sh (它不起作用) no jobid

EN

回答 1

Stack Overflow用户

发布于 2021-01-17 23:32:27

您可以使用curl同时下载多个文件。

就你的情况而言,这应该是可行的:

代码语言:javascript
复制
# Create an empty bash array of urls.
urls=()

# Add each url to the array, such that '-O' and the url are separate
# items in the array. This is necessary so that the curl command will
# look like 'curl -O <url1> -O <url2> ...', since the -O command must
# be provided for each url.
for i in 11 08 15 16; do
    urls+=( "-O" "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR116/0${i}/SRR116802${i}/SRR116802${i}_1.fastq.gz" )
    urls+=( "-O" "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR116/0${i}/SRR116802${i}/SRR116802${i}_2.fastq.gz" )
done

# Simultaneously download from all urls.
curl --silent -C - "${urls[@]}"

要解释每个curl选项:

  • --silentwget-q。禁用curl的进度meter.
  • -C -相当于wget-c。它告诉curl自动查找在哪里/如何恢复transfer.
  • -O告诉curl将输出写入与远程文件同名的文件(这是wget的行为)。这必须为每个url指定。

f 221

或者,您可能需要考虑安装和使用aria2

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65759481

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档