RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-228926

Stvlpotapov's questions

Martin Hope
Stvlpotapov
Asked: 2020-12-11 16:24:18 +0000 UTC

轻量级线程的定义是什么意思?

  • 2

协程,顾名思义,是轻量级线程,“不像普通线程那样使用那么多资源”。你能解释一下轻量级线程的定义是什么意思吗?

kotlin
  • 1 个回答
  • 10 Views
Martin Hope
Stvlpotapov
Asked: 2020-03-01 20:58:15 +0000 UTC

神秘的 Sanic Redis

  • 0

连接我自己 sanic-redis

app = Sanic()
redis = SanicRedis(app)   

app.config.update(
    {
        'REDIS': {
            'address': ('0.0.0.0', 6379),
            # 'db': 0,
            # 'password': 'password',
            # 'ssl': None,
            # 'encoding': None,
            'minsize': 1,
            'maxsize': 10
        }
    }
)

我增加了每个请求的错误或成功计数器,但是对于每个请求,我都会捕获以下错误:

Connection <RedisConnection [db:0]> has pending commands, closing it.
Future exception was never retrieved
future: <Future finished exception=ConnectionForcedCloseError()>
aioredis.errors.ConnectionForcedCloseError
Future exception was never retrieved
future: <Future finished exception=ConnectionForcedCloseError()>
aioredis.errors.ConnectionForcedCloseError

同时,一切正常,没有磨损,总的来说,一切都很好。

问题:如何用萝卜打开非关闭连接?

async def count_statistic():
    await redis_client.incr_success_and_all_count_in_redis()
    now = time.time()
    last_timestamp = await redis_client.get_timestamp_from_redis()
    redis_client.time_to_response = now - redis_client.time_start_request
    await redis_client.incr_sum_time_response_in_redis(redis_client.time_to_response)
    await redis_client.put_timestamp_to_redis(now)
    ttl = await redis.conn.pttl('average_stats')
    if (now - last_timestamp < 60):
        try:
            all_count, sum_time_response = await redis_client.get_for_statistic()

            first_average = sum_time_response / all_count
        except TypeError:
            return 0

        with await redis.conn as r:
            r.hset(redis_client.key, 'first_average', first_average)
            r.hset('average_stats', 'average_per_minute', first_average)
        await redis.conn.expire('average_stats', 120)
    else:
        await redis_client.drop_data()
redis
  • 1 个回答
  • 10 Views
Martin Hope
Stvlpotapov
Asked: 2020-02-22 15:49:13 +0000 UTC

无服务器错误

  • 0

再会!

我正在尝试运行命令:

serverless create --template "aws-kotlin-jvm-gradle" --path my-service

但我不断收到错误:

 Serverless Error ---------------------------------------

 Template "true" is not supported. Supported templates are:..
..... "aws-kotlin-jvm-gradle"....

有人可以建议这里有什么问题吗?

谢谢!

kotlin
  • 1 个回答
  • 10 Views
Martin Hope
Stvlpotapov
Asked: 2020-08-25 19:08:29 +0000 UTC

gunicorn+flask+docker 日志记录

  • 0

我正在尝试找到有关如何记录用 gunicorn 中的烧瓶编写的 rest api 的明确信息。我在我的机器上举起烧瓶 - 在项目中启动了一个日志文件,详细的日志被倒入其中,我启动 gunicorn - 没有任何东西倒在任何地方

我想问 - 如何正确格式化,使用 gunicorn 运行应用程序的日志

python
  • 1 个回答
  • 10 Views
Martin Hope
Stvlpotapov
Asked: 2020-07-25 16:15:55 +0000 UTC

ImportError:没有名为 src 的模块,或者为什么 Pycharm 可以工作,但终端不能?

  • 0

假设有两个脚本:-wsgi.py 和它旁边的第二个脚本,称为 controller.py。

wsgi 很简单,它说:

'from src.dev.controller import app
 'if __name__ == "__main__":
  app.run(threaded=True)'

我从 Pycharm 启动 - 好的,一切正常。我在与 PyCharm-a 设置相同的虚拟环境 (virtualenv) 下进入终端 - 我得到 Traceback: $python wsgi.py

'Traceback (most recent call last):
 File "wsgi.py", line 4, in <module>
from src.dev.controller import app
ImportError: No module named 'src' '

我爬上去明白了——我重复了这个(关于添加 PYTHONPATH)http://forum.ubuntu.ru/index.php?topic=197830.0——它没有用。所有init .py 在所有文件夹中都已写入并为空。

我尝试将 sys.path.insert(0,r'/home/spotapov/testbuild/image-processor/src/dev' 添加到 wsgi.py - 也没有用。

希望对您有所帮助,谢谢!

python
  • 1 个回答
  • 10 Views
Martin Hope
Stvlpotapov
Asked: 2020-06-28 21:54:54 +0000 UTC

ModuleNotFoundError:没有名为“gdbm”的模块

  • 1

我正在尝试开始在 docker 中工作(在 Ubuntu 上安装)。

挂在这个命令上
Ubuntu Xenial 16.04 (LTS)

deb https://apt.dockerproject.org/repo ubuntu-xenial main 

返回

ModuleNotFound 'gdbm'

尽管我已经通过sudo apt-get.

同时,尝试写:

python-gdbm -V 

或者

python3-gdbm -V

或者

python-gdbm --version 

返回相同的ModuleNotFound。

提前感谢您的回复。

python
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5