簡體   English   中英

並行運行 Google Workflows

[英]Running Google Workflows in Parallel

我在 cloud firestore 中有一組文檔,每天晚上我都想在每個文檔上運行 Workflows 以執行一系列轉換。 一個文檔的轉換對另一個文檔沒有影響。 我目前在我的 YAML 文件中有一個 for 循環,它一次對每個文檔進行一個轉換。 我想知道是否可以並行執行對所有文檔的轉換,而不是一次一個。

工作流程步驟可以並行完成:

https://cloud.google.com/workflows/docs/reference/syntax/parallel-steps#example_of_parallel_branches

代碼片段:

main:
  params: [args]
  steps:
    - init:
        assign:
          - user: {}
          - notification: {}
    - parallelStep:
        parallel:
          shared: [user, notification]
          branches:
            - getUser:
                steps:
                  - getUserCall:
                      call: http.get
                      args:
                        url: ${"https://example.com/users/" + args.userId}
                      result: user
            - getNotification:
                steps:
                  - getNotificationCall:
                      call: http.get
                      args:
                        url: ${"https://example.com/notification/" + args.notificationId}
                      result: notification

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM