pai icon indicating copy to clipboard operation
pai copied to clipboard

The command failed on 0.10.1 while it works on 0.8.3

Open hellocandy opened this issue 7 years ago • 11 comments

Organization Name: Advantech

Short summary about the issue/question: We have update one of our openpai to 0.10.1 from 0.8.3. When we submit job on the 0.10.1. The command which works on 0.8.3, now failed on 0.10.1. The log is [INFO] USER COMMAND START

/pai/bootstrap/docker_bootstrap.sh: line 168: warning: here-document at line 168 delimited by end-of-file (wanted EOF') /pai/bootstrap/docker_bootstrap.sh: line 168: warning: here-document at line 168 delimited by end-of-file (wanted EOF') /pai/bootstrap/docker_bootstrap.sh: line 168: warning: here-document at line 168 delimited by end-of-file (wanted EOF') /pai/bootstrap/docker_bootstrap.sh: eval: line 168: syntax error near unexpected token (' /pai/bootstrap/docker_bootstrap.sh: eval: line 168: `nmkdir ~/AFSnn# Set default PyPi urlnmkdir -p ~/.config/pipncat << EOF > ~/.config/pip/pip.confn[global]nindex-url = http://10.100.0.8:8080ntrusted-host = 10.100.0.8nEOFnn# Hide headernmkdir -p ~/.jupyter/nbconfigncat << EOF > ~/.jupyter/nbconfig/notebook.jsonn{n "Notebook": {n "Header": false,n "Toolbar": truen }n}nEOFnn# Disable SQLite historynmkdir -p ~/.ipython/profile_defaultncat << EOF > ~/.ipython/profile_default/ipython_kernel_config.pynn# Configuration file for ipython-kernel.nc = get_config()nc.HistoryManager.enabled = FalsenEOFnn# Set environment variablesnexport auth_code=5xU0litvzSg4Teqt5izfzwnexport instance_id=611eab21-eeda-4b00-b4c7-5122c3647920nexport version=2.1.3nexport workspace_id=cc4d6889-f6ac-4da3-b104-0df52d3fd4cfnn# Start commandnjupyter notebook --port $PAI_CONTAINER_HOST_jupyter_PORT_LIST --ip 0.0.0.0 --no-browser --notebook-dir ~/AFS --NotebookApp.password="" --NotebookApp.token="" --NotebookApp.allow_origin="*" --NotebookApp.trust_xheaders=True --NotebookApp.disable_check_xsrf=True --NotebookApp.tornado_settings="{'headers': {'Content-Security-Policy': 'child-src *'}}" --allow-root' job has finished with exit code 1 [DEBUG] Docker container exit handler: EXIT signal received in docker container, exiting ...

Brief what process you are following: The command is: "command": "\nmkdir ~/AFS\n\n# Set default PyPi url\nmkdir -p ~/.config/pip\ncat << EOF > ~/.config/pip/pip.conf\n[global]\nindex-url = http://10.100.0.8:8080\ntrusted-host = 10.100.0.8\nEOF\n\n# Hide header\nmkdir -p ~/.jupyter/nbconfig\ncat << EOF > ~/.jupyter/nbconfig/notebook.json\n{\n "Notebook": {\n "Header": false,\n "Toolbar": true\n }\n}\nEOF\n\n# Disable SQLite history\nmkdir -p ~/.ipython/profile_default\ncat << EOF > ~/.ipython/profile_default/ipython_kernel_config.py\n\n# Configuration file for ipython-kernel.\nc = get_config()\nc.HistoryManager.enabled = False\nEOF\n\n# Set environment variables\nexport auth_code=5xU0litvzSg4Teqt5izfzw\nexport instance_id=611eab21-eeda-4b00-b4c7-5122c3647920\nexport version=2.1.3\nexport workspace_id=49ab3f68-57af-41ce-81dc-d1c1ecf8a896\n\n# Start command\njupyter notebook --port $PAI_CONTAINER_HOST_jupyter_PORT_LIST --ip 0.0.0.0 --no-browser --notebook-dir ~/AFS --NotebookApp.password="" --NotebookApp.token="" --NotebookApp.allow_origin="*" --NotebookApp.trust_xheaders=True --NotebookApp.disable_check_xsrf=True --NotebookApp.tornado_settings="{'headers': {'Content-Security-Policy': 'child-src *'}}" --allow-root"

How to reproduce it:

OpenPAI Environment: Cluster

  • OpenPAI version: 0.10.1
  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Hardware (e.g. core number, memory size, storage size, GPU type etc.):
  • Others:

Anything else we need to know:

hellocandy avatar Mar 27 '19 02:03 hellocandy

@hao1939 - may you help to confirm whether this is a regression in 0.10.1? thanks.

scarlett2018 avatar Mar 28 '19 01:03 scarlett2018

Would you please tell me when will the issue be fixed?

hellocandy avatar Mar 29 '19 06:03 hellocandy

@hellocandy - triaged, need to investigate.

scarlett2018 avatar Mar 29 '19 09:03 scarlett2018

@hellocandy Multiline command isn't fully supported in OpenPAI

For your need, I suggest you follow this practice:

  1. Use echo -e to write files
  2. Use && or ; to split commands.

i.e. A command to write files and show it:

echo -e '"test1" test2\ntest3\n' > ./test.txt && cat ./test.txt ; sleep 5

The output will be:

[INFO] USER COMMAND START

"test1" test2
test3


[INFO] USER COMMAND END

mzmssg avatar Apr 01 '19 12:04 mzmssg

The command that we used is more than multi-line. The command contains "(" , ")" and other special characters. We have tried to change the multi-line to signal line, how ever, the job still failed. Bellow is the command that we used correctly on v0.8.3.

mkdir ~/AFS

Set default PyPi url

mkdir -p ~/.config/pip cat << EOF > ~/.config/pip/pip.conf [global] index-url = http://10.100.0.8:8080 trusted-host = 10.100.0.8 EOF

Hide header

mkdir -p ~/.jupyter/nbconfig cat << EOF > ~/.jupyter/nbconfig/notebook.json { "Notebook": { "Header": false, "Toolbar": true } } EOF

Disable SQLite history

mkdir -p ~/.ipython/profile_default cat << EOF > ~/.ipython/profile_default/ipython_kernel_config.py

Configuration file for ipython-kernel.

c = get_config() c.HistoryManager.enabled = False EOF

Set environment variables

export auth_code=ehMsXg0-uKgLQaHujMVuyA export instance_id=23c5e479-a35d-4427-adc5-601bd830e32c export version=2.1.3 export workspace_id=6fa60153-3493-4d14-b7e6-3ae7afb60a8d

Start command

jupyter notebook --port $PAI_CONTAINER_HOST_jupyter_PORT_LIST --ip 0.0.0.0 --no-browser --notebook-dir ~/AFS --NotebookApp.password="" --NotebookApp.token="" --NotebookApp.allow_origin="*" --NotebookApp.trust_xheaders=True --NotebookApp.disable_check_xsrf=True --NotebookApp.tornado_settings="{'headers': {'Content-Security-Policy': 'child-src *'}}" --allow-root

hellocandy avatar Apr 02 '19 08:04 hellocandy

@hellocandy This is the practice,

mkdir mkdir ~/AFS && mkdir -p ~/.config/pip && echo -e "[global]\nindex-url = http://10.100.0.8:8080\ntrusted-host = 10.100.0.8" > ~/.config/pip/pip.conf && ...

It could achieve the same result in a line as

mkdir ~/AFS
mkdir -p ~/.config/pip
cat << EOF > ~/.config/pip/pip.conf
[global]
index-url = http://10.100.0.8:8080
trusted-host = 10.100.0.8
EOF

mzmssg avatar Apr 02 '19 09:04 mzmssg

We have tried using the single line, however it failed when execute --NotebookApp.tornado_settings="{'headers': {'Content-Security-Policy': 'child-src *'}}"

hellocandy avatar Apr 03 '19 02:04 hellocandy

@hellocandy Is it convenient to provide changed job description?

mzmssg avatar Apr 03 '19 06:04 mzmssg

We tried to modify the command as the following format, and it seems works --NotebookApp.tornado_settings={"headers":{"Content-Security-Policy":"child-src\s*"}}

However, write command like this is very inconvenient and easy to fail. We still wish you can support multi-line at the future release.

hellocandy avatar Apr 03 '19 09:04 hellocandy

@hellocandy Yep, seems community has contributed it #2406. But we need to evaluate the potential risk.

mzmssg avatar Apr 03 '19 10:04 mzmssg

Closed. Feel free to reopen it if necessary

mzmssg avatar Apr 03 '19 10:04 mzmssg