使用下面的代码,可以在 azure aks 中创建一个 dask kubernetes 集群。
它使用远程调度程序 ( dask.config.set({"kubernetes.scheduler-service-type": "LoadBalancer"})
) 并且运行良好。
要使用虚拟节点,请取消注释该行extra_pod_config=virtual_config
(遵循此官方示例)。
它不起作用,出现以下错误:
ACI does not support providing args without specifying the command. Please supply both command and args to the pod spec.
这与传球有关containers: args: [dask-scheduler]
我应该提供哪个containers: command:
来解决这个问题?
谢谢
import dask
from dask.distributed import Client
from dask_kubernetes import KubeCluster, KubeConfig, make_pod_spec
image = "daskdev/dask"
cluster = "aks-cluster1"
dask.config.set({"kubernetes.scheduler-service-type": "LoadBalancer"})
dask.config.set({"distributed.comm.timeouts.connect": 180})
virtual_config = {
"nodeSelector": {
"kubernetes.io/role": "agent",
"beta.kubernetes.io/os": "linux",
"type": "virtual-kubelet",
},
"tolerations": [
{"key": "virtual-kubelet.io/provider", "operator": "Exists"},
],
}
pod_spec = make_pod_spec(
image=image,
# extra_pod_config=virtual_config,
memory_limit="2G",
memory_request="2G",
cpu_limit=1,
cpu_request=1,
threads_per_worker=1, # same as cpu
)
# az aks get-credentials --name aks-cluster1 --resource-group resource_group1
# cp ~/.kube/config ./aksconfig.yaml
auth = KubeConfig(config_file="./aksconfig.yaml", context=cluster,)
cluster = KubeCluster(
pod_spec, auth=auth, deploy_mode="remote", scheduler_service_wait_timeout=180
)
client = Client(cluster)