我面臨類似的情況,這裏我怎麼過來呢。
我將描述我是如何做到這一點與Ec2Resource。如果您在EMRCluster中尋找解決方案,請參閱@franklinsijo answer。
步驟
。將你的python腳本存儲在s3中。
。創建一個shell腳本(hello.sh)(給出波紋管)並將其存儲到s3
。創建一個Ec2Resource節點和ShellCommandActivity節點並提供這些信息。
- 在 「腳本URI」 提供shell腳本S3 URL和
ShellCommandActivity
設置 「舞臺」 爲真。它應該運行在您的DefaultResource
這裏是shell腳本(hello.sh)從S3和商店下載本地你的Python程序,安裝Python和依賴的第三方庫,並最終執行Python文件。
hello.sh
echo 'Download python file to local temp'
aws s3 cp s3://path/to/python_file/hello_world.py /tmp/hello.py
# Install python(on CentOs)
sudo yum -y install python-pip
pip install <dependencies>
python /tmp/hello.py
我很難在與bang line嘗試,所以不要包括他們在這裏。
如果aws cp
命令不起作用(awscli更舊),這裏是這種情況的快速解決方案。
- 按照上面的步驟1-3,創建一個
s3DataNode
。
I.在S3DataNode的「文件路徑」中提供您的python s3 url。
二,將DataNode作爲「輸入」提供給ShellCommandActivity
三。寫在以下ShellCommandActivity
命令的 「命令」 字段命令
echo 'Install Python2'
sudo yum -y install python-pip
pip install <dependencies>
python ${INPUT1_STAGING_DIR}/hello_world.py
使用[ShellCommandActivity](http://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp- object-shellcommandactivity.html) – franklinsijo