小编Mat*_*age的帖子

Amazon S3:使用 aws s3 cp 而不下载现有文件?

有没有办法使用 AWS CLI 使用--recursive--exclude+下载文件--include,并且不覆盖我已经下载的文件?即使文件没有更改,它也喜欢重写文件,并且在崩溃后不会恢复下载。

amazon-s3 amazon-web-services aws-cli

5
推荐指数
1
解决办法
5033
查看次数

使用2D矩阵作为numpy中3D矩阵的索引?

假设我有一个2x3x3形状的数组,这是一个3D矩阵.我还有一个形状为3x3的2D矩阵,我想用它作为沿第一轴的3D矩阵的索引.示例如下.

示例运行:

>>> np.random.randint(0,2,(3,3)) # index
array([[0, 1, 0],
       [1, 0, 1],
       [1, 0, 0]])

>> np.random.randint(0,9,(2,3,3)) # 3D matrix
array([[[4, 4, 5],
        [2, 6, 7],
        [2, 6, 2]],

       [[4, 0, 0],
        [2, 7, 4],
        [4, 4, 0]]])
>>> np.array([[4,0,5],[2,6,4],[4,6,2]]) # result
array([[4, 0, 5],
       [2, 6, 4],
       [4, 6, 2]])
Run Code Online (Sandbox Code Playgroud)

python numpy matrix

3
推荐指数
1
解决办法
1356
查看次数

Python Gunicorn Worker 由于参数不正确而退出?

我正在设置一台新服务器,作为该过程的一部分,我设置了 Gunicorn 来提供 Web 文件服务。但是,传输数据时,在旧服务器上有效的命令在该服务器上不起作用。

Gunicorn master 进程似乎启动了工作进程,但工作进程由于“无法识别的参数”而立即退出。命令是:/home/postgres/venv/bin/gunicorn [app]:app。这与之前的服务器相同,只是该服务器使用 virtualenv 而不是全局包。我怀疑这可能是问题所在,但我不确定为什么或如何解决它。

相同的Python版本,但gunicorn版本较新(旧版为19.4.5,新版为19.9.0)。

我已将应用程序名称替换为 [app] 以防止混淆,但名称中没有无效字符或任何内容。

日志:

root@ns500738:/home/postgres/[app]# /home/postgres/venv/bin/gunicorn [app]:app
[2018-07-18 13:27:56 -0400] [10080] [INFO] Starting gunicorn 19.9.0
[2018-07-18 13:27:56 -0400] [10080] [INFO] Listening at: http://127.0.0.1:8000 (10080)
[2018-07-18 13:27:56 -0400] [10080] [INFO] Using worker: sync
[2018-07-18 13:27:56 -0400] [10083] [INFO] Booting worker with pid: 10083
usage: gunicorn [-h] [-c]
gunicorn: error: unrecognized arguments: [app]:app
[2018-07-18 13:27:56 -0400] [10083] [INFO] Worker exiting (pid: 10083)
[2018-07-18 13:27:56 -0400] [10085] …
Run Code Online (Sandbox Code Playgroud)

python virtualenv gunicorn

1
推荐指数
1
解决办法
2725
查看次数