<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Toil验证记录]]></title><description><![CDATA[<p dir="auto">目标：验证Toil+CWL+k8s环境的运行  Toil采用Server模式<br />
1.环境安装<br />
1.1 安装k8s minikube</p>
<pre><code>googleapis无法访问 用浏览器代理下载
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
注意要使用cn镜像 新版本下载有问题 选择稍微低的版本
minikube start --image-mirror-country='cn' --kubernetes-version=v1.23.8 --extra-config=kubelet.housekeeping-interval=10s
--extra-config=kubelet.housekeeping-interval=10s  用来使metrics-server可用
</code></pre>
<p dir="auto">1.2 minikube的简单使用</p>
<pre><code>查看状态
minikube status
获取集群所有节点(机器)：

minikube kubectl get nodes
获取集群所有命名空间：

minikube kubectl get namespaces
查看集群所有 Pod：

minikube kubectl -- get pods -A
进入节点服务器：

minikube ssh
执行节点服务器命令，例如查看节点 docker info：

minikube ssh -- docker info
删除集群, 删除 ~/.minikube 目录缓存的文件：

minikube delete
关闭集群：

minikube stop
销毁集群：

minikube stop &amp;&amp; minikube delete
</code></pre>
<pre><code>minikube dashboard
有个错误
libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
重新安装驱动：
sudo apt-get install --reinstall intel-media-va-driver:amd64(没有解决错误)
先忽略
</code></pre>
<p dir="auto">运行一个服务</p>
<pre><code>  minikube kubectl -- create deployment hello-minikube --image=kicbase/echo-server:1.0
  minikube kubectl -- expose deployment hello-minikube --type=NodePort --port=8080
  minikube service hello-minikube
</code></pre>
<p dir="auto">Toil需要 metrics-server<br />
<a href="https://www.mls-tech.info/microservice/k8s/minikube-use-metrics-server/" rel="nofollow ugc">https://www.mls-tech.info/microservice/k8s/minikube-use-metrics-server/</a><br />
minikube addons enable metrics-server  //这个命令总是从k8s下载镜像<br />
sudo docker pull <a href="http://registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server:v0.6.2" rel="nofollow ugc">registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server:v0.6.2</a><br />
sudo docker tag <a href="http://registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server:v0.6.2" rel="nofollow ugc">registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server:v0.6.2</a> <a href="http://registry.k8s.io/metrics-server/metrics-server:v0.6.2" rel="nofollow ugc">registry.k8s.io/metrics-server/metrics-server:v0.6.2</a></p>
<p dir="auto">启动 metrics-server 注意要设置国内镜像<br />
minikube addons enable  metrics-server --images="MetricsServer=metrics-server:v0.6.2" --registries="<a href="http://MetricsServer=registry.cn-hangzhou.aliyuncs.com/google_containers" rel="nofollow ugc">MetricsServer=registry.cn-hangzhou.aliyuncs.com/google_containers</a>"</p>
<p dir="auto">2.安装Toil</p>
<pre><code>sudo pip install virtualenv
virtualenv ~/venv
source ~/venv/bin/activate
pip install toil
pip install toil[cwl,wdl,kubernetes,server]   //安装额外的插件
</code></pre>
<p dir="auto">Toil的架构：<br />
<img src="/assets/uploads/files/1677824115171-80ac31e0-5f34-4528-9535-f25369a7a164-image.png" alt="80ac31e0-5f34-4528-9535-f25369a7a164-image.png" class=" img-responsive img-markdown" /><br />
the leader:<br />
The leader is responsible for deciding which jobs should be run. To do this it traverses the job graph. Currently this is a single threaded process, but we make aggressive steps to prevent it becoming a bottleneck</p>
<p dir="auto">There are two main ways to run Toil workflows on Kubernetes. You can either run the Toil leader on a machine outside the cluster, with jobs submitted to and run on the cluster, or you can submit the Toil leader itself as a job and have it run inside the cluster.</p>
<p dir="auto">the job-store:<br />
Handles all files shared between the components. Files in the job-store are the means by which the state of the workflow is maintained. Each job is backed by a file in the job store, and atomic updates to this state are used to ensure the workflow can always be resumed upon failure. The job-store can also store all user files, allowing them to be shared between jobs. The job-store is defined by the AbstractJobStore class. Multiple implementations of this class allow Toil to support different back-end file stores, e.g.: S3, network file systems, Google file store, etc.</p>
<p dir="auto">workers:<br />
The workers are temporary processes responsible for running jobs, one at a time per worker. Each worker process is invoked with a job argument that it is responsible for running. The worker monitors this job and reports back success or failure to the leader by editing the job’s state in the file-store. If the job defines successor jobs the worker may choose to immediately run them</p>
<p dir="auto">the batch-system:<br />
Responsible for scheduling the jobs given to it by the leader, creating a worker command for each job. The batch-system is defined by the AbstractBatchSystem class. Toil uses multiple existing batch systems to schedule jobs, including Apache Mesos, GridEngine and a multi-process single node implementation that allows workflows to be run without any of these frameworks. Toil can therefore fairly easily be made to run a workflow using an existing cluster.<br />
the node provisioner:<br />
Creates worker nodes in which the batch system schedules workers. It is defined by the AbstractProvisioner class.<br />
the statistics and logging monitor:<br />
Monitors logging and statistics produced by the workers and reports them. Uses the job-store to gather this information.</p>
<p dir="auto">3.测试用例<br />
3.1 Toil原生的hello world 流程</p>
<pre><code>//helloWorld.py  Toil原生的流程就是python脚本编写的
from toil.common import Toil
from toil.job import Job
def helloWorld(message, memory="1G", cores=1, disk="1G"):
    return f"Hello, world!, here's a message: {message}"
if __name__ == "__main__":
    parser = Job.Runner.getDefaultArgumentParser()
    options = parser.parse_args()
    options.clean = "always"
    with Toil(options) as toil:
        output = toil.start(Job.wrapFn(helloWorld, "You did it!"))
    print(output)
</code></pre>
<pre><code>(venv) $ python helloWorld.py file:my-job-store
</code></pre>
<p dir="auto">3.2 测试CWL流程</p>
<pre><code>cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
stdout: output.txt
inputs:
  message:
    type: string
    inputBinding:
      position: 1
outputs:
  output:
    type: stdout
</code></pre>
<pre><code>运行一个cwl文件
toil-cwl-runner example.cwl example-job.yaml
cat output.txt
</code></pre>
<p dir="auto">3.3 测试WDL</p>
<pre><code>    workflow write_simple_file {
      call write_file
    }
    task write_file {
      String message
      command { echo ${message} &gt; wdl-helloworld-output.txt }
      output { File test = "wdl-helloworld-output.txt" }
    }

and this code into ``wdl-helloworld.json``::

    {
      "write_simple_file.write_file.message": "Hello world!"
    }
</code></pre>
<pre><code>toil-wdl-runner wdl-helloworld.wdl wdl-helloworld.json
</code></pre>
<p dir="auto">3.4 测试CWL k8s<br />
<strong><img src="http://an.forum.genostack.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f620.png?v=5opkpnl53ss" class="not-responsive emoji emoji-android emoji--angry" title=":angry:" alt="😠" /> Toil  要求k8s 对接时 只能用AWS的存储作为job-store</strong></p>
]]></description><link>http://an.forum.genostack.com/topic/824/toil验证记录</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 12:33:43 GMT</lastBuildDate><atom:link href="http://an.forum.genostack.com/topic/824.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 03 Mar 2023 03:48:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Toil验证记录 on Thu, 09 Mar 2023 10:49:34 GMT]]></title><description><![CDATA[<p dir="auto">Toil Server模式</p>
<p dir="auto">docker run -d --name wes-rabbitmq -p 5672:5672 rabbitmq:3.9.5<br />
celery -A toil.server.celery_app worker --loglevel=INFO<br />
toil server</p>
<p dir="auto">curl --location --request POST '<a href="http://localhost:8000/ga4gh/wes/v1/runs" rel="nofollow ugc">http://localhost:8000/ga4gh/wes/v1/runs</a>' --user test:test --form 'workflow_url="example.cwl"' --form 'workflow_type="cwl"' --form 'workflow_type_version="v1.0"' --form 'workflow_params="{"message": "Hello world!"}"' --form<br />
'workflow_attachment=@"./example.cwl"'</p>
<p dir="auto">===========需要metrics-server==============================<br />
kubectl apply -f <a href="https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml" rel="nofollow ugc">https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml</a><br />
卸载 metrics-server<br />
kubectl delete -f components.yaml</p>
<p dir="auto">根据 <a href="https://stackoverflow.com/questions/71843068/metrics-server-is-currently-unable-to-handle-the-request" rel="nofollow ugc">https://stackoverflow.com/questions/71843068/metrics-server-is-currently-unable-to-handle-the-request</a></p>
<pre><code>labels:
    k8s-app: metrics-server
spec:
  containers:
  - args:
    - --cert-dir=/tmp
    - --secure-port=443
    - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
    - --kubelet-use-node-status-port
    - --metric-resolution=15s
    - --kubelet-insecure-tls **# add this line**
</code></pre>
<p dir="auto">kubectl apply -f components.yaml<br />
否则会产生下面的错误<br />
kubectl get deployment/metrics-server -n kube-system<br />
<a href="http://v1beta1.metrics.k8s.io" rel="nofollow ugc">v1beta1.metrics.k8s.io</a>                 kube-system/metrics-server   False (MissingEndpoints)   44m<br />
测试：<br />
kubectl top nodes<br />
NAME    CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%<br />
node1   1076m        13%    17670Mi         75%<br />
node2   1295m        16%    10048Mi         65%<br />
node3   1168m        14%    14871Mi         63%</p>
<p dir="auto">============apparmor可能有影响 删除这个服务（产品环境按照https://github.com/adamnovak/gi-kubernetes-autoscaling-config/blob/e1350ac9ad17d94b5073b20db3c75620957926e3/kubenode.ubuntu.cloud-config.yaml#L27-L67设置）=====<br />
sudo systemctl stop apparmor.service<br />
sudo systemctl disable apparmor.service</p>
<p dir="auto">Toil server在启动 toil-cwl-runner的时候 可能是没有把全局变量传递过去 会报错 但是 直接使用下面的提交 就成功了<br />
export TOIL_WORKDIR=/cephfs_data/toil<br />
export TOIL_KUBERNETES_HOST_PATH=/cephfs_data/toil<br />
toil-cwl-runner --writeMessages=/cephfs_data/toil/run-6aef556521e1460e94b0557ce848f49e/bus_messages --batchSystem=kubernetes --workDir=/cephfs_data/toil --clean=always --outdir=/cephfs_data/toil/run-6aef556521e1460e94b0557ce848f49e/outputs --jobStore=/cephfs_data/toil/run-6aef556521e1460e94b0557ce848f49e/toil_job_store /cephfs_data/toil/run-6aef556521e1460e94b0557ce848f49e/execution/example.cwl /cephfs_data/toil/run-6aef556521e1460e94b0557ce848f49e/execution/wes_inputs.json</p>
<p dir="auto">cat /cephfs_data/toil/run-6aef556521e1460e94b0557ce848f49e/outputs/output.txt<br />
Hello world!</p>
<p dir="auto">后面产品环境看看是用hostpath 还是pv</p>
]]></description><link>http://an.forum.genostack.com/post/1991</link><guid isPermaLink="true">http://an.forum.genostack.com/post/1991</guid><dc:creator><![CDATA[anneng]]></dc:creator><pubDate>Thu, 09 Mar 2023 10:49:34 GMT</pubDate></item><item><title><![CDATA[Reply to Toil验证记录 on Thu, 09 Mar 2023 08:06:33 GMT]]></title><description><![CDATA[<p dir="auto">AWS对toil的支持<br />
<a href="https://aws.github.io/amazon-genomics-cli/docs/workflow-engines/toil/" rel="nofollow ugc">https://aws.github.io/amazon-genomics-cli/docs/workflow-engines/toil/</a><br />
<img src="/assets/uploads/files/1678348495885-2bf9b649-e0e7-4f57-a154-c7903e51aa8d-image.png" alt="2bf9b649-e0e7-4f57-a154-c7903e51aa8d-image.png" class=" img-responsive img-markdown" /></p>
]]></description><link>http://an.forum.genostack.com/post/1990</link><guid isPermaLink="true">http://an.forum.genostack.com/post/1990</guid><dc:creator><![CDATA[anneng]]></dc:creator><pubDate>Thu, 09 Mar 2023 08:06:33 GMT</pubDate></item><item><title><![CDATA[Reply to Toil验证记录 on Tue, 07 Mar 2023 03:12:23 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://www.researchgate.net/publication/345904527_Rapid_and_efficient_analysis_of_20000_RNA-seq_samples_with_Toil" rel="nofollow ugc">https://www.researchgate.net/publication/345904527_Rapid_and_efficient_analysis_of_20000_RNA-seq_samples_with_Toil</a><br />
一个案例：<br />
Rapid and efficient analysis of 20,000 RNA-seq samples with Toil</p>
]]></description><link>http://an.forum.genostack.com/post/1985</link><guid isPermaLink="true">http://an.forum.genostack.com/post/1985</guid><dc:creator><![CDATA[anneng]]></dc:creator><pubDate>Tue, 07 Mar 2023 03:12:23 GMT</pubDate></item><item><title><![CDATA[Reply to Toil验证记录 on Wed, 08 Mar 2023 09:04:16 GMT]]></title><description><![CDATA[<p dir="auto">Toil k8s 部署方式二 将toil leader部署到k8s 外部<br />
主要用于开发测试 而且当前要求本地能访问 aws<br />
实时日志将无法使用 除非本地有外网<br />
Real time logging will not work unless your local machine is able to listen for incoming UDP packets on arbitrary ports on the address it uses to contact the IPv4 Internet; Toil does no NAT traversal or detection.</p>
<pre><code>$ export TOIL_KUBERNETES_OWNER=demo-user  # This defaults to your local username if not set
$ export TOIL_AWS_SECRET_NAME=aws-credentials
$ export TOIL_KUBERNETES_HOST_PATH=/data/scratch
$ virtualenv --python python3 --system-site-packages venv
$ . venv/bin/activate
$ wget https://raw.githubusercontent.com/DataBiosphere/toil/releases/4.1.0/src/toil/test/docs/scripts/tutorial_helloworld.py
$ python3 tutorial_helloworld.py \
      aws:us-west-2:demouser-toil-test-jobstore \
      --batchSystem kubernetes \
      --realTimeLogging \
      --logInfo
</code></pre>
<p dir="auto"><img src="http://an.forum.genostack.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f612.png?v=5opkpnl53ss" class="not-responsive emoji emoji-android emoji--unamused" title=":unamused:" alt="😒" /> ModuleNotFoundError: No module named 'boto'<br />
pip install boto botocore boto3 mypy_boto3_s3</p>
<p dir="auto">尝试将任务在k8s上启动 使用file模式 任务可以下发到minikube  但是无法正常启动  toil默认会挂载aws的pv<br />
python3 tutorial_helloworld.py file:job-store  --batchSystem kubernetes --realTimeLogging --logInfo<br />
MountVolume.SetUp failed for volume "s3-credentials" : secret "aws-credentials" not found<br />
不要设置 export TOIL_AWS_SECRET_NAME=aws-credentials</p>
<p dir="auto">验证结果:</p>
<pre><code>export TOIL_KUBERNETES_HOST_PATH=/home/jynlix/Downloads/src/toil/data
export TOIL_WORKDIR=/home/jynlix/Downloads/src/toil/data
minikube mount /home/jynlix/Downloads/src/toil/data:/home/jynlix/Downloads/src/toil/data
python3 -m pdb tutorial_helloworld.py file:job-store  --batchSystem kubernetes --realTimeLogging --logInfo
</code></pre>
]]></description><link>http://an.forum.genostack.com/post/1984</link><guid isPermaLink="true">http://an.forum.genostack.com/post/1984</guid><dc:creator><![CDATA[anneng]]></dc:creator><pubDate>Wed, 08 Mar 2023 09:04:16 GMT</pubDate></item><item><title><![CDATA[Reply to Toil验证记录 on Thu, 09 Mar 2023 08:25:36 GMT]]></title><description><![CDATA[<p dir="auto">Toil k8s 部署方式一 将toil leader部署到k8s 内部</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  # It is good practice to include your username in your job name.
  # Also specify it in TOIL_KUBERNETES_OWNER
  name: demo-user-toil-test
# Do not try and rerun the leader job if it fails

spec:
 backoffLimit: 0
 template:
   spec:
     # Do not restart the pod when the job fails, but keep it around so the
     # log can be retrieved
     restartPolicy: Never
     volumes:
     - name: aws-credentials-vol
       secret:
         # Make sure the AWS credentials are available as a volume.
         # This should match TOIL_AWS_SECRET_NAME
         secretName: aws-credentials
     # You may need to replace this with a different service account name as
     # appropriate for your cluster.
     serviceAccountName: default
     containers:
     - name: main
       image: quay.io/ucsc_cgl/toil:5.5.0
       env:
       # Specify your username for inclusion in job names
       - name: TOIL_KUBERNETES_OWNER
         value: demo-user
       # Specify where to find the AWS credentials to access the job store with
       - name: TOIL_AWS_SECRET_NAME
         value: aws-credentials
       # Specify where per-host caches should be stored, on the Kubernetes hosts.
       # Needs to be set for Toil's caching to be efficient.
       - name: TOIL_KUBERNETES_HOST_PATH
         value: /data/scratch
       volumeMounts:
       # Mount the AWS credentials volume
       - mountPath: /root/.aws
         name: aws-credentials-vol
       resources:
         # Make sure to set these resource limits to values large enough
         # to accommodate the work your workflow does in the leader
         # process, but small enough to fit on your cluster.
         #
         # Since no request values are specified, the limits are also used
         # for the requests.
         limits:
           cpu: 2
           memory: "4Gi"
           ephemeral-storage: "10Gi"
       command:
       - /bin/bash
       - -c
       - |
         # This Bash script will set up Toil and the workflow to run, and run them.
         set -e
         # We make sure to create a work directory; Toil can't hot-deploy a
         # script from the root of the filesystem, which is where we start.
         mkdir /tmp/work
         cd /tmp/work
         # We make a virtual environment to allow workflow dependencies to be
         # hot-deployed.
         #
         # We don't really make use of it in this example, but for workflows
         # that depend on PyPI packages we will need this.
         #
         # We use --system-site-packages so that the Toil installed in the
         # appliance image is still available.
         virtualenv --python python3 --system-site-packages venv
         . venv/bin/activate
         # Now we install the workflow. Here we're using a demo workflow
         # script from Toil itself.
         wget https://raw.githubusercontent.com/DataBiosphere/toil/releases/4.1.0/src/toil/test/docs/scripts/tutorial_helloworld.py
         # Now we run the workflow. We make sure to use the Kubernetes batch
         # system and an AWS job store, and we set some generally useful
         # logging options. We also make sure to enable caching.
         python3 tutorial_helloworld.py \
             aws:us-west-2:demouser-toil-test-jobstore \
             --batchSystem kubernetes \
             --realTimeLogging \
             --logInfo
</code></pre>
<p dir="auto">kubectl apply -f leader.yaml</p>
<p dir="auto">注意：<br />
Note that the leader pod will need your workflow script, its other dependencies, and Toil all installed. An easy way to get Toil installed is to start with the Toil appliance image for the version of Toil you want to use. In this example, we use <a href="http://quay.io/ucsc_cgl/toil:5.5.0" rel="nofollow ugc">quay.io/ucsc_cgl/toil:5.5.0</a>.<br />
Toil要求这种模式 把脚本、Toil都打包到镜像里面</p>
]]></description><link>http://an.forum.genostack.com/post/1983</link><guid isPermaLink="true">http://an.forum.genostack.com/post/1983</guid><dc:creator><![CDATA[anneng]]></dc:creator><pubDate>Thu, 09 Mar 2023 08:25:36 GMT</pubDate></item><item><title><![CDATA[Reply to Toil验证记录 on Fri, 03 Mar 2023 03:49:16 GMT]]></title><description><![CDATA[<p dir="auto">minikube的其他参考<br />
<a href="https://www.zhaowenyu.com/minikube-doc/ops/minikube.html" rel="nofollow ugc">https://www.zhaowenyu.com/minikube-doc/ops/minikube.html</a></p>
]]></description><link>http://an.forum.genostack.com/post/1978</link><guid isPermaLink="true">http://an.forum.genostack.com/post/1978</guid><dc:creator><![CDATA[anneng]]></dc:creator><pubDate>Fri, 03 Mar 2023 03:49:16 GMT</pubDate></item></channel></rss>