提交 72383c36 编写于 作者: Q qjing666

make examples more easy to follow

上级 781a0b14
...@@ -67,7 +67,8 @@ from paddle_fl.core.scheduler.agent_master import FLScheduler ...@@ -67,7 +67,8 @@ from paddle_fl.core.scheduler.agent_master import FLScheduler
worker_num = 2 worker_num = 2
server_num = 1 server_num = 1
scheduler = FLScheduler(worker_num,server_num) # Define the number of worker/server and the port for scheduler
scheduler = FLScheduler(worker_num,server_num,port=9091)
scheduler.set_sample_worker_num(worker_num) scheduler.set_sample_worker_num(worker_num)
scheduler.init_env() scheduler.init_env()
print("init env done.") print("init env done.")
...@@ -94,6 +95,7 @@ trainer_id = int(sys.argv[1]) # trainer id for each guest ...@@ -94,6 +95,7 @@ trainer_id = int(sys.argv[1]) # trainer id for each guest
job_path = "fl_job_config" job_path = "fl_job_config"
job = FLRunTimeJob() job = FLRunTimeJob()
job.load_trainer_job(job_path, trainer_id) job.load_trainer_job(job_path, trainer_id)
job._scheduler_ep = "127.0.0.1:9091" # Inform the scheduler IP to trainer
trainer = FLTrainerFactory().create_fl_trainer(job) trainer = FLTrainerFactory().create_fl_trainer(job)
trainer.start() trainer.start()
...@@ -122,6 +124,8 @@ server_id = 0 ...@@ -122,6 +124,8 @@ server_id = 0
job_path = "fl_job_config" job_path = "fl_job_config"
job = FLRunTimeJob() job = FLRunTimeJob()
job.load_server_job(job_path, server_id) job.load_server_job(job_path, server_id)
job._scheduler_ep = "127.0.0.1:9091" # IP address for scheduler
server.set_server_job(job) server.set_server_job(job)
server._current_ep = "127.0.0.1:8181" # IP address for server
server.start() server.start()
``` ```
...@@ -3,6 +3,7 @@ task_name=test_fl_job_submit_jingqinghe ...@@ -3,6 +3,7 @@ task_name=test_fl_job_submit_jingqinghe
hdfs_output=/user/feed/mlarch/sequence_generator/dongdaxiang/job_44 hdfs_output=/user/feed/mlarch/sequence_generator/dongdaxiang/job_44
train_cmd=python dist_trainer.py train_cmd=python dist_trainer.py
#monitor_cmd=python system_monitor_app.py 10 100 #monitor_cmd=python system_monitor_app.py 10 100
monitor_cmd=
#train_cmd=python test_hadoop.py #train_cmd=python test_hadoop.py
hdfs_path=afs://xingtian.afs.baidu.com:9902 hdfs_path=afs://xingtian.afs.baidu.com:9902
......
...@@ -18,7 +18,8 @@ print(random_port) ...@@ -18,7 +18,8 @@ print(random_port)
current_ip = socket.gethostbyname(socket.gethostname()) current_ip = socket.gethostbyname(socket.gethostname())
endpoints = "{}:{}".format(current_ip, random_port) endpoints = "{}:{}".format(current_ip, random_port)
#start a web server for remote endpoints to download their config #start a web server for remote endpoints to download their config
os.system("python -m SimpleHTTPServer 8080 &") #os.system("python -m SimpleHTTPServer 8080 &")
os.system("python -m http.server 8080 &")
if os.path.exists("job_config"): if os.path.exists("job_config"):
os.system("rm -rf job_config") os.system("rm -rf job_config")
if os.path.exists("package"): if os.path.exists("package"):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册