[Python] ValueError: min() arg is an empty sequence using bash orders

Discussão em 'Python' iniciado por Stack, Setembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    I am using a .sh bash orders file with the following calls to slurm jobs

    for i in {0..705..13}
    do
    run -t 200:00 -c 1 -m 270 python3 code.py $i $((i + 13))
    sleep 0.1
    done


    The file code.py, after importing libraries, contains

    l_random_portions = np.arange(1000, 1800000000+2.5*10**6, 2.5*10**6)[int(sys.argv[1]):int(sys.argv[2])]
    print(f'\nRandom portions from {min(l_random_portions)} to {max(l_random_portions)} tokens will be selected')


    Strangely enough, some jobs give the following error just in the moment they start running

    Traceback (most recent call last):
    File "code.py", line n, in <module>
    print(f'\nRandom portions from {min(l_random_portions)} to {max(l_random_portions)} tokens will be selected')
    ValueError: min() arg is an empty sequence
    srun: error: slurm21: task 0: Exited with exit code 1


    I can't understand. If I define the vector and iterate over its elements manually I cannot find a way of creating an empty vector so that I reproduce the error. Where can it come from?

    Continue reading...

Compartilhe esta Página