Alimente as variáveis de ambiente através do bsub (Platform LSF)

0

Parece que não consigo transmitir variáveis de ambiente para scripts enviados para um agendador de cluster por meio de bsub . Ele funciona bem quando submeto comandos que usam essas variáveis de ambiente diretamente, mas essas variáveis de ambiente não podem ser usadas em scripts subseqüentes. Por que isso e como posso corrigi-lo?

Aqui está um exemplo simples em que tentei passar x=1 para um script:

me@cluster:~[407]$ bsub -I -tty -env 'x=1' 'echo .$x.'
Info: No jobname given, set to: Job_with_no_name
Info: No output file given, set to: output_%J_%I.txt
Info: No memory limit given, set to: 512MB
Info: No runtime limit given, set to: 15min
Job <35590315> is submitted to queue <normal>.
<<Waiting for dispatch ...>>
<<Starting on linuxbmc0243>>
.1.

me@cluster:~[408]$ echo 'echo .$x.' > myechox

me@cluster:~[409]$ more myechox
echo .$x.

me@cluster:~[410]$ chmod +x myechox

me@cluster:~[411]$ bsub -I -tty -env 'x=1' myechox
Info: No jobname given, set to: Job_with_no_name
Info: No output file given, set to: output_%J_%I.txt
Info: No memory limit given, set to: 512MB
Info: No runtime limit given, set to: 15min
Job <35590318> is submitted to queue <normal>.
<<Waiting for dispatch ...>>
<<Starting on linuxbmc1279>>
..

me@cluster:~[412]$ bsub -I -tty -env 'x=1' 'export x;myechox'
Info: No jobname given, set to: Job_with_no_name
Info: No output file given, set to: output_%J_%I.txt
Info: No memory limit given, set to: 512MB
Info: No runtime limit given, set to: 15min
Job <35590340> is submitted to queue <normal>.
<<Waiting for dispatch ...>>
<<Starting on linuxbmc1045>>
..

Atualizar : isso funciona:

me@cluster:~[456]$ bsub -I -tty -env 'x=1' 'export x=$x;myechox'
Info: No jobname given, set to: Job_with_no_name
Info: No output file given, set to: output_%J_%I.txt
Info: No memory limit given, set to: 512MB
Info: No runtime limit given, set to: 15min
Job <35609253> is submitted to queue <normal>.
<<Waiting for dispatch ...>>
<<Starting on linuxbmc0975>>
.1.

Nesse meio tempo, descobri também que bsub prefere ser usado com bsub < scriptfile em vez de bsub scriptfile ; isso parece ser necessário para habilitar a análise de opções incorporadas (usando #BSUB ) e também explica porque as variáveis são definidas apenas localmente (porque nenhum sub-script deve ser chamado).

No entanto, agora também tentei isso, o que, surpreendentemente, não funciona:

me@cluster:~[457]$ bsub -I -tty -env 'x=1' < myechox
Info: No jobname given, set to: Job_with_no_name
Info: No output file given, set to: output_%J_%I.txt
Info: No memory limit given, set to: 512MB
Info: No runtime limit given, set to: 15min
Job <35609459> is submitted to queue <normal>.
<<Waiting for dispatch ...>>
<<Starting on linuxbmc1140>>
..

Atualização 2 : tentei export ing x primeiro, que tem o mesmo efeito que usar -env 'x=1' :

me@cluster:~[458]$ export x=1

me@cluster:~[460]$ bsub -I -tty 'echo .$x.'
Info: No jobname given, set to: Job_with_no_name
Info: No output file given, set to: output_%J_%I.txt
Info: No memory limit given, set to: 512MB
Info: No runtime limit given, set to: 15min
Job <35610151> is submitted to queue <normal>.
<<Waiting for dispatch ...>>
<<Starting on linuxbmc1140>>
.1.

me@cluster:~[459]$ bsub -I -tty < myechox
Info: No jobname given, set to: Job_with_no_name
Info: No output file given, set to: output_%J_%I.txt
Info: No memory limit given, set to: 512MB
Info: No runtime limit given, set to: 15min
Job <35609990> is submitted to queue <normal>.
<<Waiting for dispatch ...>>
<<Starting on linuxbmc1140>>
..

Atualização 3 : isso funciona novamente, o que considero uma resposta à minha pergunta:

me@cluster:~[571]$ (echo export x=$x && cat myechox) | bsub -I -tty
Info: No jobname given, set to: Job_with_no_name
Info: No output file given, set to: output_%J_%I.txt
Info: No memory limit given, set to: 512MB
Info: No runtime limit given, set to: 15min
Job <35641024> is submitted to queue <normal>.
<<Waiting for dispatch ...>>
<<Starting on linuxbmc1045>>
.1.
    
por bers 27.03.2017 / 11:31

0 respostas