杂乱的技术文档
数据库的使用
远程桌面中的PGadmins,又称PG库
选择服务器组,然后GFACE(数据库名称),再选择数据库,gface,架构,public,数据表。
选中任意一个数据表,单机右键选择脚本,select脚本,或者工具栏中选择sql语句。
输入语句:
select * from where news_title like '%表格' limit 10
gitlab 上传文件
需要下载git工具,在任意想进行操作的文件夹中右键选中 git bash 进入 git 界面
1. git init # 初始化仓库
2. git add (./-A/文件名) # 添加文件到本地仓库
3. git commit -m 'descriptions for this add operation' # 添加文件描述信息
4. git remote add orgin http://15.20.12.39/repository_name/branch.git # 此链接为http而不是ssh,http作为地址不需要输入密码,而ssh需要密码
5. git push -u origin master # 把本地仓库add更新的文件推送到远程仓库
若出现 Update were rejected because the remote contains work,则需要在4,5之间使用 git pull origin master 即可。
git pull origin master # 把本地仓库的变化连接到远程仓库主分支,即把 gitlab 中 master 的所有内容拉取到了本地
git remote add 出现 remote origin already exists 错误时
git remote rm origin # 先删除远程Git仓库再重新添加新的 git remote add
代码打包
首先要在需要打包的文件夹的同一层目录中创建 setup.py 文件,即:
- PycharmProject
- Pdf2Abstract(包含所有的代码)
- setup.py
setup.py 中的内容,根据网上大多数的教程来写就行,唯一需要注意的是 ‘packages’ 这一变量,如果在使用 findpackages(), 没有找到目录tree,则需要手动加入你的代码中目录tree的结构。如:
packages = ['Pdf2Abstract/RawData/Pdf'] # eg.
# 然后在 command 或者 terminal 中setup这一级目录下运行:
python setup.py bdis_wheel
服务器后台执行命令
服务器后台运行有两种方式:
- nohup
在所需要执行的py文件前加上nohup,如:
nohup python run.py &
- supervisor (监控管理进程工具)
mkdir /etc/supervisor
echo_supervisored_conf > /etc/supervisor/supervisord.conf
上面为建立config到supervisor的默认路径,下面为建立到所需要执行代码的路径中:
echo_supervisored_conf > /data/charlie/BERT/paimai.conf
# /data/.. 到自己所有的路径中生成supervisor
下面是配置PaiMai进程的一个例子(paimai.config中):
directory = /data/charlie/others/PaiMai
command = /bin/bash -c "/data/anaconda3/envs/charlie_env/bin/python /data/charlie/others/PaiMai/run.py"
autostart=true
autorestart=flase
stderr_logfile=/data/charlie/others/PaiMai/log/run_error.log
stdout_logfile=/data/charlie/others/PaiMai/log/run_out.log
启动Supervisor服务,supervisord -c /etc/supervisor/supervisord.conf
在supervisord启动后,则可以通过supervisorctrl命令来控制进程,启动、停止、重启、查看
supervisorctrl start PaiMai 开始运行
supervisorctrl status 查看状态