搭建请参考上一篇文章。
1.广播环境变量,指定Python的路径
export PYTHON_ROOT=/data/Python
export PYSPARK_PYTHON=${PYTHON_ROOT}/bin/python
export SPARK_YARN_USER_ENV=”PYSPARK_PYTHON=Python/bin/python”
2.提交具体任务
遇到权限问题是普遍现象,层层排查
hdfs dfs -chmod 777 /user/hdfs
hdfs dfs -ls chmod 766 /user/hdfs
hdfs dfs -mkdir /user/hdfs/mnist_model
chmod hdfs:hdfs -R /data/TensorflowOnSpark
因为输出目录为yarn创建,所以确保路径的执行以及读写权限
spark-submit –master yarn –deploy-mode cluster –num-executors 3 –executor-memory 2g \
–queue default \
–py-files TensorFlowOnSpark/tfspark.zip,TensorFlowOnSpark/examples/mnist/tf/mnist_dist.py \
–conf spark.dynamicAllocation.enabled=false –conf spark.yar

该博客介绍了如何在Spark上部署和使用TensorFlowOnSpark进行分布式训练和推理。文章详细阐述了设置环境变量、解决权限问题以及提交Spark任务的步骤,包括指定Python路径、处理HDFS权限和配置Spark参数。同时,提到了在执行过程中可能遇到的平台错误及解决方案。
订阅专栏 解锁全文
485

被折叠的 条评论
为什么被折叠?



