Google Cloud Life Sciences 運算子

Google Cloud Life Sciences 是一項服務,可在 Google Cloud 上執行一系列運算引擎容器。它用於大規模處理、分析和註解基因體學和生物醫學數據。

先決條件任務

要使用這些運算子,您必須完成以下幾件事

管線配置

為了執行管線,必須配置請求主體。以下是一個包含單一動作的管線配置範例。

tests/system/google/cloud/life_sciences/example_life_sciences.py[原始碼]

SIMPLE_ACTION_PIPELINE = {
    "pipeline": {
        "actions": [
            {"imageUri": "bash", "commands": ["-c", "echo Hello, world"]},
        ],
        "resources": {
            "regions": [f"{LOCATION}"],
            "virtualMachine": {
                "machineType": "n1-standard-1",
            },
        },
    },
}

管線也可以配置多個動作。

tests/system/google/cloud/life_sciences/example_life_sciences.py[原始碼]

MULTI_ACTION_PIPELINE = {
    "pipeline": {
        "actions": [
            {
                "imageUri": "google/cloud-sdk",
                "commands": ["gsutil", "cp", f"gs://{BUCKET_NAME}/{FILE_NAME}", "/tmp"],
            },
            {"imageUri": "bash", "commands": ["-c", "echo Hello, world"]},
            {
                "imageUri": "google/cloud-sdk",
                "commands": [
                    "gsutil",
                    "cp",
                    f"gs://{BUCKET_NAME}/{FILE_NAME}",
                    f"gs://{BUCKET_NAME}/output.in",
                ],
            },
        ],
        "resources": {
            "regions": [f"{LOCATION}"],
            "virtualMachine": {
                "machineType": "n1-standard-1",
            },
        },
    }
}

請閱讀請求主體參數,以了解您可以包含在配置中的所有欄位

執行管線

使用 LifeSciencesRunPipelineOperator 來執行管線。

tests/system/google/cloud/life_sciences/example_life_sciences.py[原始碼]

    simple_life_science_action_pipeline = LifeSciencesRunPipelineOperator(
        task_id="simple-action-pipeline",
        body=SIMPLE_ACTION_PIPELINE,
        project_id=PROJECT_ID,
        location=LOCATION,
    )

參考資料

如需更多資訊,請參閱

這篇文章對您有幫助嗎?