@@ -46,7 +46,7 @@ In this example, the production model is uploaded to HDFS in `product_path` fold
...
@@ -46,7 +46,7 @@ In this example, the production model is uploaded to HDFS in `product_path` fold
### Product model
### Product model
Run the following Python code products model in `product_path` folder. Every 60 seconds, the package file of Boston house price prediction model `uci_housing.tar.gz` will be generated and uploaded to the path of HDFS `/`. After uploading, the timestamp file `donefile` will be updated and uploaded to the path of HDFS `/`.
Run the following Python code products model in `product_path` folder(You need to modify Hadoop related parameters before running). Every 60 seconds, the package file of Boston house price prediction model `uci_housing.tar.gz` will be generated and uploaded to the path of HDFS `/`. After uploading, the timestamp file `donefile` will be updated and uploaded to the path of HDFS `/`.
```python
```python
importos
importos
...
@@ -82,9 +82,14 @@ exe = fluid.Executor(place)
...
@@ -82,9 +82,14 @@ exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
exe.run(fluid.default_startup_program())
defpush_to_hdfs(local_file_path,remote_path):
defpush_to_hdfs(local_file_path,remote_path):
hadoop_bin='/hadoop-3.1.2/bin/hadoop'
afs='afs://***.***.***.***:***'# User needs to change
os.system('{} fs -put -f {} {}'.format(
uci='***,***'# User needs to change
hadoop_bin,local_file_path,remote_path))
hadoop_bin='/path/to/haddop/bin'# User needs to change
在`product_path`下运行下面的Python代码生产模型,每隔 60 秒会产出 Boston 房价预测模型的打包文件`uci_housing.tar.gz`并上传至hdfs的`/`路径下,上传完毕后更新时间戳文件`donefile`并上传至hdfs的`/`路径下。
在`product_path`下运行下面的Python代码生产模型(运行前需要修改hadoop相关的参数),每隔 60 秒会产出 Boston 房价预测模型的打包文件`uci_housing.tar.gz`并上传至hdfs的`/`路径下,上传完毕后更新时间戳文件`donefile`并上传至hdfs的`/`路径下。
```python
```python
importos
importos
...
@@ -82,9 +82,14 @@ exe = fluid.Executor(place)
...
@@ -82,9 +82,14 @@ exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
exe.run(fluid.default_startup_program())
defpush_to_hdfs(local_file_path,remote_path):
defpush_to_hdfs(local_file_path,remote_path):
hadoop_bin='/hadoop-3.1.2/bin/hadoop'
afs='afs://***.***.***.***:***'# User needs to change
os.system('{} fs -put -f {} {}'.format(
uci='***,***'# User needs to change
hadoop_bin,local_file_path,remote_path))
hadoop_bin='/path/to/haddop/bin'# User needs to change