我想在运行后立即运行脚本
`docker-compose up -d`
Run Code Online (Sandbox Code Playgroud)
这是我的片段docker-compose.yml.其他设置是mysql服务器,redis ...等....但它们不会导致任何问题
web:
image: nginx
container_name: web-project
volumes:
- ./code:/srv
working_dir: /srv/myweb
extra_hosts:
- "myweb.local:127.0.0.1"
ports:
- 8081:80
# tty: true
command: sh /srv/scripts/post-run-web.sh
Run Code Online (Sandbox Code Playgroud)
所以每当我跑步 docker-compose up -d或者 docker-compose up一切都停止.(容器不能继续运行).虽然我的shell脚本很简单(运行echos ...或phpunit).这是我的剧本.
#!/bin/bash
echo running post install scripts for web..;
cd /srv/myweb
npm install
composer self-update
composer update
Run Code Online (Sandbox Code Playgroud)
这就是我得到的错误.就像服务器(nginx)还没有运行一样.此外,如果我使用exec bash连接到服务器,并检查进程.我没有看到nginx正在运行(还).
web_1 | You are already using composer version 7a9eb02190d334513e99a479510f87eed18cf958.
web_1 | Loading composer repositories with package information
web_1 | Updating dependencies (including require-dev) …Run Code Online (Sandbox Code Playgroud) 我正在GCP使用特斯拉 GPU运行虚拟机。并尝试部署PyTorch基于 的应用程序以使用 GPU 对其进行加速。
我想让 docker 使用这个 GPU,可以从容器访问它。
我设法在主机上安装了所有驱动程序,并且该应用程序在那里运行良好,但是当我尝试在 docker(基于 nvidia/cuda 容器)中运行它时,pytorch 失败了:
File "/usr/local/lib/python3.6/dist-packages/torch/cuda/__init__.py", line 82,
in _check_driver http://www.nvidia.com/Download/index.aspx""")
AssertionError:
Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from
Run Code Online (Sandbox Code Playgroud)
要获取有关容器可见的 nvidia 驱动程序的一些信息,我运行以下命令:
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
但它抱怨: docker: Error response from daemon: Unknown runtime specified nvidia.
在主机上nvidia-smi输出如下所示:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01 Driver Version: 440.33.01 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+ …Run Code Online (Sandbox Code Playgroud) 我正在使用来自弹性云的小型弹性搜索集群。
我需要:
在 Kibana UI 部分中,Snapshot and Restore我可以看到我的快照和此提示:
使用存储库来存储和恢复 Elasticsearch 索引和集群的备份。
但是我如何将实际数据从elasticsearch索引下载到我的机器(作为一堆json)并将其导入到本地运行的elasticsearch中?
我正在尝试为 Databricks设置GitHub 集成。
我们那里有数百个笔记本,手动将每个笔记本添加到存储库中会很累。
有没有办法自动提交所有笔记本并将其从数据块推送到存储库?
我正在尝试在Python中运行gRPC服务器。我找到了这样的方法:
import grpc
from concurrent import futures
server = grpc.server(futures.ThreadPoolExecutor(max_workers=100))
... # add my grpc servicer to server
server.add_insecure_port('[::]:50051')
server.start()
Run Code Online (Sandbox Code Playgroud)
我需要向服务器添加一些选项,例如max_send_message_length,max_receive_message_length等等。中有一个options参数grpc.server(...),但是我不知道如何使用它。
server = grpc.server(futures.ThreadPoolExecutor(max_workers=100), options=[???])
Run Code Online (Sandbox Code Playgroud)
从gRPC文档中:
options –用于配置通道的键/值对(gRPC运行时中的通道args)的可选列表。
如何创建这些选项?它们是字符串对吗?
我是Python和gRPC的新手。
我正在尝试使用Spark 2.3.1和Java.
我按照文档中的示例进行操作,但在调用时继续得到描述不当的异常.fit(trainingData).
Exception in thread "main" java.lang.IllegalArgumentException
at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
at org.apache.spark.util.ClosureCleaner$.getClassReader(ClosureCleaner.scala:46)
at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:449)
at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:432)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:103)
at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:103)
at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:230)
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
at scala.collection.mutable.HashMap$$anon$1.foreach(HashMap.scala:103)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
at org.apache.spark.util.FieldAccessFinder$$anon$3.visitMethodInsn(ClosureCleaner.scala:432)
at org.apache.xbean.asm5.ClassReader.a(Unknown Source)
at org.apache.xbean.asm5.ClassReader.b(Unknown Source)
at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
at org.apache.spark.util.ClosureCleaner$$anonfun$org$apache$spark$util$ClosureCleaner$$clean$14.apply(ClosureCleaner.scala:262)
at org.apache.spark.util.ClosureCleaner$$anonfun$org$apache$spark$util$ClosureCleaner$$clean$14.apply(ClosureCleaner.scala:261)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.util.ClosureCleaner$.org$apache$spark$util$ClosureCleaner$$clean(ClosureCleaner.scala:261)
at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:159)
at org.apache.spark.SparkContext.clean(SparkContext.scala:2299)
at org.apache.spark.SparkContext.runJob(SparkContext.scala:2073)
at org.apache.spark.rdd.RDD$$anonfun$take$1.apply(RDD.scala:1358)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
at org.apache.spark.rdd.RDD.withScope(RDD.scala:363)
at …Run Code Online (Sandbox Code Playgroud) 我正在尝试向数据框添加一列,该数据框将包含另一列的哈希。
我找到了以下文档:https :
//spark.apache.org/docs/2.3.0/api/sql/index.html#hash
并尝试了以下操作:
import org.apache.spark.sql.functions._
val df = spark.read.parquet(...)
val withHashedColumn = df.withColumn("hashed", hash($"my_column"))
Run Code Online (Sandbox Code Playgroud)
但是,那使用的哈希函数是hash()什么?那是murmur,sha,md5,别的东西吗?
我在此列中获得的值是整数,因此此处的值范围可能是[-2^(31) ... +2^(31-1)]。
我可以在这里获得长期价值吗?我可以代替字符串哈希吗?
如何为此指定一种具体的哈希算法?
我可以使用自定义哈希函数吗?
你能帮我解决特定语言分析器和弹性搜索中的问题吗?
我需要通过查询字符串搜索文档并突出显示匹配的字符串.这是我的映射:
{
"usr": {
"properties": {
"text0": {
"type": "string",
"analyzer": "english"
},
"text1": {
"type": "string"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
注意,对于"text0"字段,设置"english"分析器,对于"text1"字段,默认使用标准分析器.
在我的索引中,现在有一个文档:
hits": [{
"_index": "tt",
"_type": "usr",
"_id": "AUxvIPAv84ayQMZV-3Ll",
"_score": 1,
"_source": {
"text0": "highlighted. need to be highlighted.",
"text1": "highlighted. need to be highlighted."
}
}]
Run Code Online (Sandbox Code Playgroud)
考虑以下查询:
{
"query": {
"query_string" : {
"query" : "highlighted"
}
},
"highlight" : {
"fields" : {
"*" : {}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我希望文档中的每个字段都能突出显示,但突出显示只出现在"text1"字段中(其中没有设置分析器):
"hits": [{
"_type": "usr",
"_source": …Run Code Online (Sandbox Code Playgroud) 应用说明:
根据以上各节,这是我的光纤http客户端的调谐(当然,我正在使用的单个实例):
PoolingNHttpClientConnectionManager connectionManager =
new PoolingNHttpClientConnectionManager(
new DefaultConnectingIOReactor(
IOReactorConfig.
custom().
setIoThreadCount(16).
setSoKeepAlive(false).
setSoLinger(0).
setSoReuseAddress(false).
setSelectInterval(10).
build()
)
);
connectionManager.setDefaultMaxPerRoute(32768);
connectionManager.setMaxTotal(131072);
FiberHttpClientBuilder fiberClientBuilder = FiberHttpClientBuilder.
create().
setDefaultRequestConfig(
RequestConfig.
custom().
setSocketTimeout(1500).
setConnectTimeout(1000).
build()
).
setConnectionReuseStrategy(NoConnectionReuseStrategy.INSTANCE).
setConnectionManager(connectionManager).
build();
Run Code Online (Sandbox Code Playgroud)将打开文件的ulimit设置为超高(软值和硬值都为131072)
kernel.printk = 8 4 1 7 kernel.printk_ratelimit_burst = 10 kernel.printk_ratelimit = 5 net.ipv4.ip_local_port_range = 8192 65535 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.core.rmem_default = 16777216 net.core .wmem_default = 16777216 net.core.optmem_max = 40960 net.ipv4.tcp_rmem …
我正在用python实现gRPC客户端和服务器。服务器成功从客户端接收数据,但是客户端接收回“ RST_STREAM,错误代码为2 ”。
它实际上是什么意思,我该如何解决?
这是我的原始文件:
service MyApi {
rpc SelectModelForDataset (Dataset) returns (SelectedModel) {
}
}
message Dataset {
// ...
}
message SelectedModel {
// ...
}
Run Code Online (Sandbox Code Playgroud)
我的服务实现如下所示:
class MyApiServicer(my_api_pb2_grpc.MyApiServicer):
def SelectModelForDataset(self, request, context):
print("Processing started.")
selectedModel = ModelSelectionModule.run(request, context)
print("Processing Completed.")
return selectedModel
Run Code Online (Sandbox Code Playgroud)
我用以下代码启动服务器:
import grpc
from concurrent import futures
#...
server = grpc.server(futures.ThreadPoolExecutor(max_workers=100))
my_api_pb2_grpc.add_MyApiServicer_to_server(MyApiServicer(), server)
server.add_insecure_port('[::]:50051')
server.start()
Run Code Online (Sandbox Code Playgroud)
我的客户看起来像这样:
channel = grpc.insecure_channel(target='localhost:50051')
stub = my_api_pb2_grpc.MyApiStub(channel)
dataset = my_api_pb2.Dataset()
# fill the object ...
model = stub.SelectModelForDataset(dataset) # call …Run Code Online (Sandbox Code Playgroud) apache-spark ×2
docker ×2
grpc ×2
java ×2
python ×2
automation ×1
backup ×1
bash ×1
cuda ×1
databricks ×1
git ×1
github ×1
gpu ×1
hash ×1
json ×1
nginx ×1
nio ×1
python-3.x ×1
quasar ×1
scala ×1