Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
ydf0509 committed Jul 13, 2021
1 parent cc12fbc commit 64a693e
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 13 deletions.
3 changes: 2 additions & 1 deletion MANiFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include README.md
include README.md
recursive-include function_scheduling_distributed_framework/function_result_web *
1 change: 1 addition & 0 deletions function_scheduling_distributed_framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from function_scheduling_distributed_framework.utils import nb_print, patch_print, LogManager, get_logger, LoggerMixin
from function_scheduling_distributed_framework.timing_job import fsdf_background_scheduler, timing_publish_deco


# 有的包默认没加handlers,原始的日志不漂亮且不可跳转不知道哪里发生的。这里把warnning级别以上的日志默认加上handlers。
nb_log.get_logger(name=None, log_level_int=30, log_filename='pywarning.log')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from flask_login import login_user, logout_user, login_required, LoginManager, UserMixin

from function_scheduling_distributed_framework import nb_print
from function_result_web.functions import get_cols, query_result, get_speed, Statistic
from function_scheduling_distributed_framework.function_result_web.functions import get_cols, query_result, get_speed, Statistic

app = Flask(__name__)
app.secret_key = 'mtfy54321'
Expand All @@ -24,27 +24,32 @@
login_manager.login_message = 'Access denied.'
login_manager.init_app(app)


class User(UserMixin):
pass


users = [
{'id':'Tom', 'user_name': 'Tom', 'password': '111111'},
{'id':'Michael', 'user_name': 'Michael', 'password': '123456'},
{'id': 'user', 'user_name': 'user', 'password': 'mtfy123'}
{'id': 'Tom', 'user_name': 'Tom', 'password': '111111'},
{'id': 'user', 'user_name': 'user', 'password': 'mtfy123'},
{'id': 'admin', 'user_name': 'admin', 'password': '123456'}
]


def query_user(user_name):
for user in users:
if user_name == user['user_name']:
return user


@login_manager.user_loader
def load_user(user_id):
if query_user(user_id) is not None:
curr_user = User()
curr_user.id = user_id
return curr_user


class LoginForm(FlaskForm):
user_name = StringField(u'用户名', validators=[DataRequired(), Length(3, 64)])
password = PasswordField(u'密码', validators=[DataRequired(), Length(3, 64)])
Expand All @@ -69,11 +74,11 @@ def login():

# 通过Flask-Login的login_user方法登录用户
nb_print(form.remember_me.data)
login_user(curr_user,remember=form.remember_me.data,duration=datetime.timedelta(days=7))
login_user(curr_user, remember=form.remember_me.data, duration=datetime.timedelta(days=7))

return redirect(url_for('index'))

flash('用户名或密码错误',category='error')
flash('用户名或密码错误', category='error')

# if form.user_name.data == 'user' and form.password.data == 'mtfy123':
# login_user(form.user_name.data, form.remember_me.data)
Expand All @@ -84,17 +89,20 @@ def login():

return render_template('login.html', form=form)


@app.route("/logout")
@login_required
def logout():
logout_user()
return redirect(url_for('login'))


@app.route('/')
@login_required
def index():
return render_template('index.html')


@app.route('/query_cols')
@login_required
def query_cols_view():
Expand All @@ -114,6 +122,7 @@ def query_result_view():
def speed_stats():
return jsonify(get_speed(**request.values.to_dict()))


@app.route('/speed_statistic_for_echarts')
@login_required
def speed_statistic_for_echarts():
Expand All @@ -127,5 +136,16 @@ def speed_statistic_for_echarts():
with app.test_request_context():
print(url_for('query_cols_view'))

app.run(debug=True, threaded=True,host='0.0.0.0',port=27018)
#gunicorn -w 9 -k gevent --bind 0.0.0.0:27018 function_result_web.app:app
app.run(debug=True, threaded=True, host='0.0.0.0', port=27018)

'''
# 第一步 export PYTHONPATH=你的项目根目录 ,这么做是为了这个web可以读取到你项目根目录下的distributed_frame_config.py里面的配置
# 例如 export PYTHONPATH=/home/ydf/codes/ydfhome
或者 export PYTHONPATH=./ (./是相对路径,前提是已近cd到你的项目根目录了,也可以写绝对路径全路径)
第二步
win上这么做 python3 -m function_scheduling_distributed_framework.function_result_web.app
linux上可以这么做性能好一些,也可以按win的做。
gunicorn -w 4 --threads=30 --bind 0.0.0.0:27018 function_scheduling_distributed_framework.function_result_web.app:app
'''
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ rocketmq
zmq
pyzmq
kombu==4.6.11
confluent_kafka
confluent_kafka==1.5.0
paho-mqtt
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='function_scheduling_distributed_framework', #
version=10.2,
version=10.8,
description=(
'function scheduling distributed framework,support threading,gevent,eventlet,asyncio concurrent,support all kinds of message queue,and has manay control way'
),
Expand Down Expand Up @@ -71,7 +71,7 @@
'zmq',
'pyzmq',
'kombu==4.6.11',
'confluent_kafka',
'confluent_kafka==1.5.0',
'paho-mqtt',
]
)
Expand All @@ -84,7 +84,7 @@
打包上传
python setup.py sdist upload -r pypi
python setup.py sdist & twine upload dist/function_scheduling_distributed_framework-10.2.tar.gz
python setup.py sdist & twine upload dist/function_scheduling_distributed_framework-10.8.tar.gz
最快的下载方式,上传立即可安装。阿里云源同步官网pypi间隔要等很久。
./pip install function_scheduling_distributed_framework==3.5 -i https://pypi.org/simple
Expand Down

0 comments on commit 64a693e

Please sign in to comment.