更新时间:2022-05-05 GMT+08:00
分享

单一步骤(一个并发)

命令示例

首先以执行单一命令为例。以 gcs sub job 为例,我们使用:

gcs sub job --cpu 0.5 --memory 1g --tool bwa:0.7.12 --shell sh bwa_help.sh

生成GCS流程示例

该命令将会生成以下模板,并提交基因容器语法解析器:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
version: genecontainer_0_1
inputs:
  memory:
    default: 1g
    type: string
  cpu:
    default: 0.5c
    type: string
  tool:
    default: bwa:0.7.12
    type: string
  job-script:
    default: bwa_help.sh
    type: string
  jobid:
    default: bwa-help-2018-0830-171114-00d34
    type: string
  shell:
    default: sh
    type: string
workflow:
  bwa-help-2018-0830-171114-00d34:
    tool: bwa:0.7.12
    type: GCS.Job
    resources:
      memory: ${memory}
      cpu: ${cpu}
    commands:
      - sh /obs/gcscli/bwa-help-2018-0830-171114-00d34/bwa_help.sh
volumes:
  sample-data:
    mount_path: /obs
    mount_from:
      pvc: ${GCS_DATA_PVC}
  temp-data:
    mount_path: /sfs
    mount_from:
      pvc: ${GCS_SFS_PVC}
  ref-data:
    mount_path: /ref
    mount_from:
      pvc: ${GCS_REF_PVC}
outputs:
  bwa-help-2018-0830-171114-00d34:
    path:
      - /obs/output/bwa-help-2018-0830-171114-00d34

生成 Kubernetes示例

该模板将进一步解析成以下 Kubernetes 模板 ,并提交云容器引擎:

kind: Job
apiVersion: batch/v1
metadata:
  name: bwa-help-2018-0830-171114-00d34-0-81419ff7ad0d11e8
  namespace: default
  selfLink: >-
    /apis/batch/v1/namespaces/default/jobs/bwa-help-2018-0830-171114-00d34-0-81419ff7ad0d11e8
  uid: 815b643b-ad0d-11e8-aba9-fa163ed435e0
  resourceVersion: '706141'
  labels:
    gcs.execution.id: 81419ff7-ad0d-11e8-bebc-0255ac1066a1
    gcs.execution.name: gcs-2018-0830-171114-1-0-2018-0830-171114-35d77
    gcs.source.name: bwa-help-2018-0830-171114-00d34
    source: gcs
    stack-name: gcs-2018-0830-171114-1-0-2018-0830-171114-35d77
spec:
  parallelism: 1
  completions: 1
  backoffLimit: 6
  selector:
    matchLabels:
      controller-uid: 815b643b-ad0d-11e8-aba9-fa163ed435e0
  template:
    metadata:
      creationTimestamp: null
      labels:
        controller-uid: 815b643b-ad0d-11e8-aba9-fa163ed435e0
        gcs.execution.id: 81419ff7-ad0d-11e8-bebc-0255ac1066a1
        gcs.execution.name: gcs-2018-0830-171114-1-0-2018-0830-171114-35d77
        gcs.source.name: bwa-help-2018-0830-171114-00d34
        job-name: bwa-help-2018-0830-171114-00d34-0-81419ff7ad0d11e8
        source: gcs
    spec:
      volumes:
        - name: sample-data
          persistentVolumeClaim:
            claimName: XXXXXXXXX
        - name: temp-data
          persistentVolumeClaim:
            claimName: XXXXXXXXX
        - name: ref-data
          persistentVolumeClaim:
            claimName: XXXXXXXXX
      containers:
        - name: bwa-help-2018-0830-171114-00d34-0-81419ff7ad0d11e8
          image: '100.125.5.235:20202/genecontainer/bwa:0.7.12-r1039-sam18-sbb67'
          command:
            - sh
            - '-c'
            - sh /obs/gcscli/bwa-help-2018-0830-171114-00d34/bwa_help.sh
          resources:
            requests:
              cpu: '0.5'
              memory: 1G
          volumeMounts:
            - name: sample-data
              mountPath: /obs
            - name: temp-data
              mountPath: /sfs
            - name: ref-data
              mountPath: /ref
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: OnFailure
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      affinity:
        podAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 1
              podAffinityTerm:
                labelSelector:
                  matchLabels:
                    source: gcs
                topologyKey: kubernetes.io/hostname
      schedulerName: default-scheduler

相关文档