fixing arguments of the profile job
This is to mitigate errors like here: https://eoslhcbhttp.cern.ch//eos/lhcb/storage/lhcbpr/www/PerfTests/UpgradeVelo/logs/Moore/Moore_hlt1_reco_baseline/lhcb-test-throughput.366_2019-10-28_16:28:32_+0100/run.log. See also https://its.cern.ch/jira/browse/LBCORE-1827.
Python interprets "${inputs_profile[@]}"
as a single argument: "-f /scratch/lhcbpr2/00067189.mdf"
. argparse
takes then ' /scratch/lhcbpr2/00067189.mdf'
as an input. See the example:
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-f',
'--inputs',
nargs='+',
)
args = parser.parse_args()
print(args.inputs)
for arg in sys.argv:
print(arg)
which produces:
[maszyman@pclhcb157 ~]$ inputs=(-f /scratch/lhcbpr2/00067189.mdf /scratch/numa1/00067189.mdf)
[maszyman@pclhcb157 ~]$ inputs_profile="${inputs[@]:0:2}"
[maszyman@pclhcb157 ~]$ python test_args.py "${inputs_profile[@]}"
[' /scratch/lhcbpr2/00067189.mdf']
test_args.py
-f /scratch/lhcbpr2/00067189.mdf
[maszyman@pclhcb157 ~]$ python test_args.py ${inputs_profile[@]}
['/scratch/lhcbpr2/00067189.mdf']
test_args.py
-f
/scratch/lhcbpr2/00067189.mdf