Executes a workflow that has multiple and different sets of steps at the same time by placing them in parallel branches.

## Explore further


For detailed documentation that includes this code sample, see the following:

- [Execute workflow steps in parallel](https://docs.cloud.google.com/workflows/docs/execute-parallel-steps)

## Code sample

### YAML

    main:
      params: [input]
      steps:
        - init:
            assign:
              - userProfile: {}
              - recentItems: []
        - enrichUserData:
            parallel:
              shared: [userProfile, recentItems]  # userProfile and recentItems are shared to make them writable in the branches
              branches:
                - getUserProfileBranch:
                    steps:
                      - getUserProfile:
                          call: http.get
                          args:
                            url: '${"https://example.com/users/" + input.userId}'
                          result: userProfile
                - getRecentItemsBranch:
                    steps:
                      - getRecentItems:
                          try:
                            call: http.get
                            args:
                              url: '${"https://example.com/items?userId=" + input.userId}'
                            result: recentItems
                          except:
                            as: e
                            steps:
                              - ignoreError:
                                  assign:  # continue with an empty list if this call fails
                                    - recentItems: []

## What's next


To search and filter code samples for other Google Cloud products, see the
[Google Cloud sample browser](https://docs.cloud.google.com/docs/samples?product=workflows).