Tag: python

Python Elasticsearch超时,docker容器之间的curl工作正常

我有两个使用docker桥networking的docker集装箱。 一个容器运行Elasticsearch 2.6.1。 另一个有一个用一些python代码运行的Ubuntu镜像。 无论我想要执行的弹性search查询,它都可以完美地使用来自Ubuntu容器shell的Curl。 当我尝试使用Python-Elasticsearch库在ubuntu容器中做同样的事情时,我得到一个超时错误: Traceback (most recent call last): File "test_elastics.py", line 11, in <module> res = es.index(index="test-index", doc_type='tweet', id=1, body=doc) File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 69, in _wrapped return func(*args, params=params, **kwargs) File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py", line 279, in index _make_path(index, doc_type, id), params=params, body=body) File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 329, in perform_request status, headers, data = connection.perform_request(method, […]

docker tkinter create_text段错误

我正在创build一个允许用户通过GUI操作graphics的工具。 为了帮助graphics操作, 我通过Docker使用这个库。 问题是当我尝试使用create_text ,通过tkinter版本8.5与Python 3.6,我得到错误Segmentation fault 。 我正在使用X11转发和create_line和其他function一样的工作,所以我不知道如何debugging这个。 我用来复制这个错误的代码: from tkinter import * root = Tk() canvas = Canvas(root, width=800, height=650, bg = '#afeeee') canvas.create_text(0,0) root.mainloop() 即使没有选项提供给create_text,我仍然得到段错误。

两个孤立的docker,铁轨和python,如何从Rails应用程序调用Python

我有两个docker集装箱。 一个是rails应用程序,另一个包含一个python项目。 这是问题。 一旦从rails中点击一个button,如何调用python脚本。

反复使用CyLP – 占用内存?

我有一个反复实例化CyClpSimplex对象的程序(理想情况下可以解决成千上万的LP),但是我的内核在〜6000次迭代之后终止了程序。 我认为这是因为内存使用过多(我在一个docker集装箱,实际上hyperkit目前使用2GB的RAM)。 我对C ++并不擅长,而且我也没有Cython的经验(CyLP编写了多less),但我怀疑这些CyClpSimplex对象没有被解构。 我查看了源代码,发现CyClpSimplex类的__dealloc__函数实际上被注释掉了! 有没有人知道一种方法来释放这个内存从Python内? 我对这个问题的理解完全不符合标准吗?

如何在Docker容器中显示PostgreSQL数据库?

我有Docker容器中的Django项目和PotgreSQL数据库。 我的问题是如何显示我的数据库? 我正在尝试docker exec -ti myproject_django_1 /bin/bash和docker exec -ti myproject_db_1 /bin/bash但是在这两种情况下我都不能使用psql因为psql: FATAL: role "root" does not exist或者bash: psql: command not found 泊坞窗,compose.yml: version: '3' services: redis: image: redis:alpine db: image: postgres django: build: . command: python3 manage.py runserver 0.0.0.0:8000 volumes: – .:/code ports: – "8000:8000" depends_on: – db links: – redis angular: build: frontend ports: […]

使用Docker在Celery中是否有魔力?

我有一个Django和瓶两个服务项目一些请求需要执行繁重的asynchronous任务。 我已经使用Redis早期的Celery + Django作为经纪人。 需要按计划运行任务。 但是..我不明白它是如何工作的内部的Docker容器假设有3个容器: – django_web – redis – celery_worker django_web和celery_worker使用redis作为经纪人。 任务在容器django_web中定义 celery_worker容器中的芹菜工作人员如何执行这项任务? 带有工作人员的容器不能访问function和操作。 这个任务的所有内容是以某种方式通过一个经纪人传递的,而且代码的位置并不重要。 或者只是通过名称和函数签名? 我找不到如何在Docker容器中使用Celery的最佳实践

用Selenium安装Docker(Python 3 – Anaconda)

我正在使用Windows,并希望安装Selenium Decker,因为它可以更改每个浏览器实例的时区。 我的问题是如何安装在与pythonPython的窗户上? 我找不到在Windows中安装这个文件。 https://github.com/SeleniumHQ/docker-selenium 这样我可以运行如下命令: $ docker run -d selenium/hub -e "TZ=US/Pacific"… $ docker run -it selenium/node-chrome-debug -e "TZ=US/Eastern"… 这些命令在Powershell中无法识别 我已经下载了这个文件,只能findLinux的信息。 这是不是能够与Python集成?

Visual Studio代码在将远程debugging附加到docker容器中的瓶颈应用程序期间卡住了

我目前正在从primefaces切换到Visual Studio代码 – 部分原因是debuggingfunction。 不幸的是我不能在以下设置中运行远程debugging : networking/ app.py from flask import Flask app = Flask(__name__) import ptvsd try: ptvsd.enable_attach(secret=None, address = ('0.0.0.0', 3000)) ptvsd.wait_for_attach() ptvsd.break_into_debugger() except: pass @app.route('/') def hello_world(): return 'Flask Dockerized' if __name__ == '__main__': app.run(debug=False,host='0.0.0.0', port=5000) 泊坞窗,compose.yml web: build: ./web ports: – "5000:5000" – "3000:3000" volumes: – .:/code launch.json { "name": "Attach […]

Celery + Docker + Django无法运行asynchronous作业

我是芹菜和docker工人,我有问题。 我有以下结构的Django项目: generic generic celery.py … web tasks.py 通用/ celery.py: from __future__ import absolute_import, unicode_literals import os from celery import Celery import logging logger = logging.getLogger("Celery") os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'generic.settings') app = Celery('generic') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() networking/ tasks.py: from __future__ import absolute_import, unicode_literals from django.conf import settings from generic.celery import app @app.task def foo(): … 泊坞窗,compose.yml: version: […]

Docker – 在代理上运行Flask Web应用程序

我有一个小型的Web应用程序运行在烧瓶服务器上,通常可以在本地主机上运行,​​通过运行app.py。 我想在Docker容器中运行它,所以我不能使用本地主机。 另一种方法是使用0.0.0.0 ,通常工作正常,但是当我在我的工作代理上时,这是行不通的。 我怎么能通过这个问题? app.py from flask import Flask, render_template app = Flask(__name__) @app.route("/") def main(): return render_template('index.html') if __name__ == "__main__": app.run(host='0.0.0.0') Dockerfile FROM python:2.7.13 ADD . /code WORKDIR /code RUN pip install Flask –proxy=[proxy] CMD ["python", "app.py"]