我在AWS EC2上运行了一些docker容器,/ var/lib/docker/overlay2文件夹的磁盘大小增长得非常快.
我想知道删除其内容是否安全?或者如果docker有某种命令来释放一些磁盘使用量.
谢谢!
更新:
我实际上docker system prune -a
已经尝试了,它回收了0Kb.
我的/ docker/overlay2磁盘大小也远大于输出 docker system df
在阅读了docker文档和BMitch的回答之后,我认为触摸这个文件夹是一个愚蠢的想法,我会尝试其他方法来回收我的磁盘空间.
所以我们一直在使用Apache Superset,它是一个很棒的工具。
唯一令人沮丧的是,我们希望与公司外部的用户共享一些仪表板。
我相信现在的方法是从 Gamma 用户那里创建一个只读角色(如果我错了,请纠正我)
这有一些缺点:
我想知道是否有任何方法(甚至黑客)可以简单地将图形和表格共享为仪表板,而无需授予任何数据库访问权限。
就像仪表板的冻结或快照一样,就像 Redash 的方式一样:https ://redash.io/help/user-guide/dashboards/sharing-dashboards
所以,我对 Pandas 包很陌生。我正在对 ETF 策略进行一些回溯测试,我需要对 Pandas Dataframe 进行大量查询。
假设我是这两个 DataFrame,df 和 df1,唯一的区别是:df 有日期时间索引,而 df1 有时间戳作为列和整数索引
In[104]: df.head()
Out[104]:
high low open close volume openInterest
2007-04-24 09:31:00 148.28 148.12 148.23 148.15 2304400 341400
2007-04-24 09:32:00 148.21 148.14 148.14 148.19 2753500 449100
2007-04-24 09:33:00 148.24 148.13 148.18 148.14 2863400 109900
2007-04-24 09:34:00 148.18 148.12 148.13 148.16 3118287 254887
2007-04-24 09:35:00 148.17 148.14 148.16 148.16 3202112 83825
In[105]: df1.head()
Out[105]:
dates high low open close volume openInterest
0 2007-04-24 09:31:00 148.28 148.12 148.23 …
Run Code Online (Sandbox Code Playgroud) 我对python 3.6的asyncio相当陌生
所以事情是我有一堂课,我想在那儿初始化一些属性。属性之一是异步函数的返回值。
最佳做法是什么?
在init函数中一次调用event_loop以获得返回值?
使__init__函数异步?并在事件循环中运行它?
干杯!
再次更新:以下是我的代码:
import asyncio
import aioredis
from datetime import datetime
class C:
def __init__(self):
self.a = 1
self.b = 2
self.r = None
asyncio.get_event_loop().run_until_complete(self._async_init())
async def _async_init(self):
# this is the property I want, which returns from an async function
self.r = await aioredis.create_redis('redis://localhost:6379')
async def heart_beat(self):
while True:
await self.r.publish('test_channel', datetime.now().__str__())
await asyncio.sleep(10)
def run(self):
asyncio.get_event_loop().run_until_complete(self.heart_beat())
c=C()
c.run()
Run Code Online (Sandbox Code Playgroud) 我们已经使用 Airflow 一段时间了,它很棒。
现在我们正在考虑将一些非常频繁的任务也移到我们的气流服务器中。
假设我每秒运行一个脚本。
使用气流安排它的最佳做法是什么:
在每秒调度的 DAG 中运行此脚本。我非常怀疑这将是解决方案,DAGRUN 的开销很大
在 6 小时后停止的 while 循环中运行此脚本,然后在 Airflow 上安排它每 6 小时运行一次?
创建一个没有计划的 DAG,将任务置于具有适当睡眠时间的 while True 循环中,因此除非出现错误,否则任务永远不会终止。
还有其他建议吗?
或者这种任务不适合Airflow?应该用 lambda 函数和 AWS 调度程序来做吗?
干杯!
我有以下代码,基本上将参数化的执行时间乘以:
require 'active_support'
require 'active_support/core_ext'
for x in 0..10
ss = Array.new(1000, "Book Author Title")
st = Time.now
ss = ss.map {|s| s.parameterize}
et = Time.now
p "parameterize 1000 simple strings takes #{'%.4f' % ((et - st)*1000)} milliseconds"
end
# p ss
Run Code Online (Sandbox Code Playgroud)
但是我得到了输出,例如:
"parameterize 1000 simple strings takes 219.5780 milliseconds"
"parameterize 1000 simple strings takes 74.3870 milliseconds"
"parameterize 1000 simple strings takes 73.9830 milliseconds"
"parameterize 1000 simple strings takes 76.3160 milliseconds"
"parameterize 1000 simple strings takes 65.7620 milliseconds"
"parameterize 1000 …
Run Code Online (Sandbox Code Playgroud) 最近在用python接触多线程领域。以下示例将更好地说明我的问题:所以我有两个 .py 文件,一个是 test.py,另一个是 test2.py
在 test.py 中:
import time
from datetime import datetime
from threading import Thread, Lock
lock = Lock()
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(threadName)s %(name)s.%(funcName)s [%(levelname)s]: %(message)s')
def foo1():
while True:
with lock:
logging.info(datetime.now())
time.sleep(0.2)
if __name__ == '__main__':
from test2 import foo2
Thread(target=foo1).start()
Thread(target=foo2).start()
Run Code Online (Sandbox Code Playgroud)
在 test2.py 中:
import time
from datetime import datetime
from test import logging, lock
def foo2():
while True:
with lock:
logging.info( datetime.now() )
time.sleep(5)
Run Code Online (Sandbox Code Playgroud)
输出:
2017-03-17 17:11:06,210 Thread-1 root.foo1 [INFO]: 2017-03-17 17:11:06.210000 …
Run Code Online (Sandbox Code Playgroud) python ×5
python-3.x ×2
airflow ×1
asynchronous ×1
dataframe ×1
datetime ×1
docker ×1
pandas ×1
ruby ×1