зеркало из https://github.com/Azure/aztk.git
Fix: AZTK_IS_MASTER not set on worker and failing (#506)
* Fix: AZTK_IS_MASTER_NOT_SET * Update jupyter lab too * update jupyterlab target role * True false doc
This commit is contained in:
Родитель
de7898334c
Коммит
b8a3fccaf0
|
@ -29,9 +29,13 @@ def setup_host(docker_repo: str):
|
|||
master_node = config.batch_client.compute_node.get(config.pool_id, master_node_id)
|
||||
|
||||
if is_master:
|
||||
os.environ["AZTK_IS_MASTER"] = "1"
|
||||
os.environ["AZTK_IS_MASTER"] = "true"
|
||||
else:
|
||||
os.environ["AZTK_IS_MASTER"] = "false"
|
||||
if is_worker:
|
||||
os.environ["AZTK_IS_WORKER"] = "1"
|
||||
os.environ["AZTK_IS_WORKER"] = "true"
|
||||
else:
|
||||
os.environ["AZTK_IS_WORKER"] = "false"
|
||||
|
||||
os.environ["AZTK_MASTER_IP"] = master_node.ip_address
|
||||
|
||||
|
@ -49,8 +53,8 @@ def setup_spark_container():
|
|||
"""
|
||||
Code run in the main spark container
|
||||
"""
|
||||
is_master = os.environ["AZTK_IS_MASTER"]
|
||||
is_worker = os.environ["AZTK_IS_WORKER"]
|
||||
is_master = os.environ.get("AZTK_IS_MASTER") == "true"
|
||||
is_worker = os.environ.get("AZTK_IS_WORKER") == "true"
|
||||
print("Setting spark container. Master: ", is_master, ", Worker: ", is_worker)
|
||||
|
||||
print("Copying spark setup config")
|
||||
|
|
|
@ -59,7 +59,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>
|
|||
</configuration>' > $HADOOP_HOME/etc/hadoop/hdfs-site.xml
|
||||
|
||||
# run HDFS
|
||||
if [ "$AZTK_IS_MASTER" -eq "1" ]; then
|
||||
if [ "$AZTK_IS_MASTER" -eq "true" ]; then
|
||||
echo 'starting namenode and datanode'
|
||||
hdfs namenode -format
|
||||
$HADOOP_HOME/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs start namenode
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
echo "Is master: $AZTK_IS_MASTER"
|
||||
|
||||
if [ "$AZTK_IS_MASTER" = "1" ]; then
|
||||
if [ "$AZTK_IS_MASTER" = "true" ]; then
|
||||
pip install jupyter --upgrade
|
||||
pip install notebook --upgrade
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class JupyterLabPlugin(PluginConfiguration):
|
|||
public=True,
|
||||
),
|
||||
],
|
||||
run_on=PluginTargetRole.All,
|
||||
target_role=PluginTargetRole.All,
|
||||
execute="jupyter_lab.sh",
|
||||
files=[
|
||||
PluginFile("jupyter_lab.sh", os.path.join(dir_path, "jupyter_lab.sh")),
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# - aztk/python:spark2.1.0-python3.6.2-base
|
||||
# - aztk/python:spark2.1.0-python3.6.2-gpu
|
||||
|
||||
if [ "$IS_MASTER" = "1" ]; then
|
||||
if [ "$AZTK_IS_MASTER" = "true" ]; then
|
||||
conda install -c conda-force jupyterlab
|
||||
|
||||
PYSPARK_DRIVER_PYTHON="/.pyenv/versions/${USER_PYTHON_VERSION}/bin/jupyter"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# - jiata/aztk-r:0.1.0-spark2.1.0-r3.4.1
|
||||
# - jiata/aztk-r:0.1.0-spark1.6.3-r3.4.1
|
||||
|
||||
if [ "$AZTK_IS_MASTER" = "1" ]; then
|
||||
if [ "$AZTK_IS_MASTER" = "true" ]; then
|
||||
|
||||
## Download and install Rstudio Server
|
||||
wget https://download2.rstudio.org/rstudio-server-$RSTUDIO_SERVER_VERSION-amd64.deb
|
||||
|
|
|
@ -59,7 +59,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>
|
|||
</configuration>' > $HADOOP_HOME/etc/hadoop/hdfs-site.xml
|
||||
|
||||
# run HDFS
|
||||
if [ "$AZTK_IS_MASTER" -eq "1" ]; then
|
||||
if [ "$AZTK_IS_MASTER" -eq "true" ]; then
|
||||
echo 'starting namenode and datanode'
|
||||
hdfs namenode -format
|
||||
$HADOOP_HOME/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs start namenode
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# - aztk/python:spark2.1.0-python3.6.2-base
|
||||
# - aztk/python:spark2.1.0-python3.6.2-gpu
|
||||
|
||||
if [ "$AZTK_IS_MASTER" = "1" ]; then
|
||||
if [ "$AZTK_IS_MASTER" = "true" ]; then
|
||||
pip install jupyter --upgrade
|
||||
pip install notebook --upgrade
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This custom script only works on images where rstudio server is pre-installed on the Docker image
|
||||
#
|
||||
#
|
||||
# This custom script has been tested to work on the following docker images:
|
||||
# - jiata/aztk-r:0.1.0-spark2.2.0-r3.4.1
|
||||
# - jiata/aztk-r:0.1.0-spark2.1.0-r3.4.1
|
||||
# - jiata/aztk-r:0.1.0-spark1.6.3-r3.4.1
|
||||
|
||||
if [ "$AZTK_IS_MASTER" = "1" ]; then
|
||||
if [ "$AZTK_IS_MASTER" = "true" ]; then
|
||||
|
||||
## Download and install Rstudio Server
|
||||
wget https://download2.rstudio.org/rstudio-server-$RSTUDIO_SERVER_VERSION-amd64.deb
|
||||
|
@ -19,7 +19,7 @@ if [ "$AZTK_IS_MASTER" = "1" ]; then
|
|||
set -e
|
||||
useradd -m -d /home/rstudio rstudio -g staff
|
||||
echo rstudio:rstudio | chpasswd
|
||||
|
||||
|
||||
rstudio-server start
|
||||
|
||||
fi
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
# Demo plugin. Not actually meant to be used.
|
||||
|
||||
if [ "$AZTK_IS_MASTER" = "1" ]; then
|
||||
if [ "$AZTK_IS_MASTER" = "true" ]; then
|
||||
echo "This is a custom script running on just the master!"
|
||||
fi
|
||||
|
||||
if [ "$AZTK_IS_WORKER" = "1" ]; then
|
||||
if [ "$AZTK_IS_WORKER" = "true" ]; then
|
||||
echo "This is a custom script running on just the workers!"
|
||||
fi
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ cluster_config = ClusterConfiguration(
|
|||
|
||||
AZTK provide a few environment variables that can be used in your plugin script
|
||||
|
||||
* `AZTK_IS_MASTER`: Is the plugin running on the master node
|
||||
* `AZTK_IS_WORKER`: Is a worker setup on the current node(This might also be a master if you have `worker_on_master` set to true)
|
||||
* `AZTK_IS_MASTER`: Is the plugin running on the master node. Can be either `true` or `false`
|
||||
* `AZTK_IS_WORKER`: Is a worker setup on the current node(This might also be a master if you have `worker_on_master` set to true) Can be either `true` or `false`
|
||||
* `AZTK_MASTER_IP`: Internal ip of the master
|
||||
|
||||
## Debug your plugin
|
||||
|
|
Загрузка…
Ссылка в новой задаче