小编Dmi*_*nov的帖子

如何在mongodb中查找不使用索引或缓慢的查询

有没有办法在mongodb中查找不使用索引或缓慢的查询?在MySQL中,配置文件中可以使用以下设置:

log-queries-not-using-indexes = 1
log_slow_queries = /tmp/slowmysql.log
Run Code Online (Sandbox Code Playgroud)

performance mongodb mongodb-query

23
推荐指数
4
解决办法
3万
查看次数

pytest 和失败:不允许数据库访问,使用“django_db”标记,或“db”或“transactional_db”装置来启用它

在从 shell调用pytest期间,我得到以下输出,因为我的测试存储在apps.business.metrics.tools.tests.py 中,并且在模块导入期间

apps/business/metrics/widgets/employees/utilization.py

在模块调用期间实时调用 SQL。这是由

get_metric_columns('EmployeeUtilization', shapers=SHAPERS)

和 pytest 投诉:

? pytest
=========================================================================== test session starts ===========================================================================
platform linux -- Python 3.6.8, pytest-4.0.0, py-1.7.0, pluggy-0.8.0
Django settings: config.settings.local (from ini file)
rootdir: /home/dmitry/Projects/analytics/backend, inifile: pytest.ini
plugins: django-3.4.7, pylama-7.6.6, django-test-plus-1.1.1, celery-4.2.1
collected 60 items / 1 errors                                                                                                                                             

================================================================================= ERRORS ==================================================================================
__________________________________________________________ ERROR collecting apps/business/metrics/tools.tests.py __________________________________________________________
../../../.pyenv/versions/3.6.8/envs/cam/lib/python3.6/site-packages/py/_path/local.py:668: in pyimport
    __import__(modname)
apps/business/metrics/__init__.py:3: in <module>
    from .widgets import *  # noqa
apps/business/metrics/widgets/__init__.py:1: in <module>
    from . import help  # …
Run Code Online (Sandbox Code Playgroud)

django-testing pytest python-3.x pytest-django

15
推荐指数
2
解决办法
8669
查看次数

Switch terraform 0.12.6 to 0.13.0 给了我 provider["registry.terraform.io/-/null"] 是必需的,但它已被删除

我在远程 terraform-cloud 中管理状态

我已经下载并安装了最新的 terraform 0.13 CLI

然后我删除了.terraform

然后我跑terraform init了,没有错误

然后我做了

? terraform apply -var-file env.auto.tfvars

Error: Provider configuration not present

To work with
module.kubernetes.module.eks-cluster.data.null_data_source.node_groups[0] its
original provider configuration at provider["registry.terraform.io/-/null"] is
required, but it has been removed. This occurs when a provider configuration
is removed while objects created by that provider still exist in the state.
Re-add the provider configuration to destroy
module.kubernetes.module.eks-cluster.data.null_data_source.node_groups[0],
after which you can remove the provider configuration again.

Releasing state lock. …
Run Code Online (Sandbox Code Playgroud)

terraform terraform-provider-aws amazon-eks

12
推荐指数
3
解决办法
7379
查看次数

vuejs:div元素上的@ keyup.esc不起作用

当我点击"阴影模式"div上的ESC按钮时,我期待"关闭"事件被触发,但它没有发生

vue 2.5.13,任何想法为什么?

<template>
  <div class="shadow-modal"
     @keyup.esc="$emit('close')">
    <transition name="modal">
      <div class="modal-mask">
        <div class="modal-wrapper">
          <div class="modal-container">
            <div class="modal-header">
              <slot name="header">
                default header
              </slot>
            </div>
            <div class="modal-body">
              <slot name="body">
                default body
              </slot>
            </div>
            <div class="modal-footer">
              <slot name="footer">
                <a href="#"
                   class="btn btn--diagonal btn--blue"
                   @click="$emit('close')">Cancel</a>
              </slot>
            </div>
          </div>
        </div>
      </div>
    </transition>
  </div>
</template>
Run Code Online (Sandbox Code Playgroud)

vue.js vuejs2 vue-events

11
推荐指数
4
解决办法
8473
查看次数

sqlalchemy.exc.CircularDependencyError:检测到循环依赖关系

业务逻辑 - 一个类别可能有多个(1:M)属性,如类别"内存"可能具有属性速度,大小,类型等.

同时,一个Category可以按属性值排序(它存储在Category.sortByAttribute中 - 这是LookupCategoryAttributes表的外键.

尝试通过SQLAlchemy构建它,但检测到循环依赖.怎么了?

class Attribute(Base):

    __tablename__ = "LookupCategoryAttributes"

    types = ["date", "float", "integer", "select", "string", "text"]

    # Properties
    ID                       = Column(BigInteger,    primary_key=True)
    categoryID               = Column(BigInteger,    ForeignKey('LookupCategories.ID'), nullable=False )
    attribute                = Column(VARCHAR(255),  nullable=False)
    listValues               = Column(VARCHAR(4000))
    typeID                   = Column(VARCHAR(40),   nullable=False)
    isRequired               = Column(SmallInteger,  nullable=False, default=0)
    displayInMenu            = Column(SmallInteger,  nullable=False, default=0)
    displayInFilter          = Column(SmallInteger,  nullable=False, default=0)


class Category(Base):

    __tablename__ = "LookupCategories"

    # Properties
    ID                       = Column(BigInteger,    primary_key=True)
    category                 = Column(VARCHAR(255),  nullable=False)
    description              = Column(VARCHAR(1000), nullable=False)
    parentCategoryID         = Column(BigInteger, …
Run Code Online (Sandbox Code Playgroud)

python sqlalchemy circular-dependency

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

无法从 minikube 获取 ClusterIP 服务 url

我已经根据下面的配置文件创建了 ClusterIP 服务,但是我似乎无法从 minikube 获取该服务的 URL

\n\n
k create -f service-cluster-definition.yaml\n\xe2\x9e\x9c minikube service myapp-frontend --url                                           \n  service default/myapp-frontend has no node port\n
Run Code Online (Sandbox Code Playgroud)\n\n

如果我尝试将 NodePort 添加到service-cluster-definition.yaml 的ports部分,它会抱怨错误,认为此类密钥已被弃用。

\n\n

我错过了什么或做错了什么?

\n\n

服务集群定义.yaml

\n\n
apiVersion: v1\nkind: Service\nmetadata:\n  name: myapp-frontend\nspec:\n  type: ClusterIP\n  ports:\n    - targetPort: 80\n      port: 80\n  selector:\n    app: myapp\n    type: etl\n\n
Run Code Online (Sandbox Code Playgroud)\n\n

部署定义.yaml

\n\n
apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp-deployment\n  labels:\n    app: myapp\n    env: experiment\n    type: etl\nspec:\n  template:\n    metadata:\n      name: myapp-pod\n      labels:\n        app: myapp\n        env: experiment\n        type: etl\n    spec:\n      containers:\n …
Run Code Online (Sandbox Code Playgroud)

kubernetes minikube

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

Postgres 容器因“数据库文件与服务器不兼容”而崩溃,在容器的镜像已更新到最新镜像后

Postgres容器在启动时崩溃并显示以下错误消息

(project) ?  project git:(feature/62-api-custom-image-categories) ? docker-compose up postgres
Starting project_postgres_1 ... 
Starting project_postgres_1 ... done
Attaching to project_postgres_1
postgres_1        | FATAL:  database files are incompatible with server
postgres_1        | DETAIL:  The data directory was initialized by PostgreSQL version 9.5, which is not compatible with this version 9.6.3.
project_postgres_1 exited with code 1
Run Code Online (Sandbox Code Playgroud)

我有哪些选择?II 已更新图像到最新的

的 docker-compose.yml 的一部分

version: '2'

volumes:
  ipython_history: {}

services:
  postgres:
    image: mdillon/postgis
    ports:
     - "5432:5432"
    environment:
      - POSTGRES_DB=p_dev
      - POSTGRES_USER=p_user
      - …
Run Code Online (Sandbox Code Playgroud)

postgresql docker docker-compose

9
推荐指数
3
解决办法
6875
查看次数

celerybeat - 多个实例和监控

我正在使用芹菜建立应用程序,最近我们要求按计划运行某些任务.

我认为celerybeat是完美的,但我有几个问题:

  1. 是否可以运行多个celerybeat实例,以便不重复任务?
  2. 如何确保celerybeat始终正常运行?

到目前为止,我读到了这个:https: //github.com/celery/celery/issues/251https://github.com/ybrs/single-beat

它似乎应该运行celerybeat的单个实例.

我正在AWS elasticbeanstalk docker容器中运行应用程序,而芹菜工作者也是docker容器(所以它在需要时可以快速扩展).

最好让celerybeat和芹菜工人一起经营supervisord,但似乎这不是正确的方法.

同时拥有celerybeat的单一实例需要手动提供/启动和监控.

python celery python-2.7 celerybeat

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

erlang导出语法/ x理解

-export([consult/1,
         dump/2, 
         first/1, 
         for/3,
         is_prefix/2).
Run Code Online (Sandbox Code Playgroud)

MEGA-Excited关于erlang.我正在阅读文档并与上面的语法混淆.上面列表中/ 1,/ 2,/ 3的含义是什么?

谢谢,德米特里

erlang

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

Amazon RDS MySQL和Master-master复制

我无法从文档中找到它,但目前似乎不支持Master-Master复制.它是否正确?

mysql database-replication amazon-web-services amazon-rds multi-master-replication

6
推荐指数
2
解决办法
2万
查看次数