๋‹ค๋ฅธ ์›Œํฌํ”Œ๋กœ๋ฅผ ๋™์‹œ์— ์‹คํ–‰ํ•˜๋Š” ์›Œํฌํ”Œ๋กœ ์‹คํ–‰


์ด ํŠœํ† ๋ฆฌ์–ผ์—์„œ๋Š” ์—ฌ๋Ÿฌ ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ ๋™์‹œ์— ์‹คํ–‰ํ•˜๋Š” ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ ๋งŒ๋“ค๊ณ  ์‹คํ–‰ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

๋‹ค์Œ ๋‹ค์ด์–ด๊ทธ๋žจ์—์„œ๋Š” ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๊ฐ€ ๋™์‹œ์— 4๋ฒˆ ์‹คํ–‰๋˜๋„๋ก ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ๊ฐ€ ๋ณ‘๋ ฌ ๋ถ„๊ธฐ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๊ณ  ์ „์ฒด ์‹คํ–‰ ์‹œ๊ฐ„์ด ์ค„์–ด๋“ญ๋‹ˆ๋‹ค. ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ๋Š” ์„ฑ๊ณต ๋ฐ ์‹คํŒจํ•œ ์‹คํ–‰์— ๋Œ€ํ•œ ์š”์•ฝ์„ ๋ฐ˜ํ™˜ํ•˜๊ธฐ ์ „์— ๋ชจ๋“  ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ ์‹คํ–‰์ด ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ ค์„œ ์˜ค๋ฅ˜ ๊ฐ์ง€๋ฅผ ๊ฐ„์†Œํ™”ํ•ฉ๋‹ˆ๋‹ค.

ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ์˜ ๋™์‹œ ๋ฐ˜๋ณต์„ ํ˜ธ์ถœํ•˜๋Š” ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ

๋ชฉํ‘œ

์ด ํŠœํ† ๋ฆฌ์–ผ์—์„œ๋Š” ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

  1. ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์‹ ํ•˜๋Š” ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ ๋งŒ๋“ค๊ณ  ๋ฐฐํฌํ•ฉ๋‹ˆ๋‹ค.
  2. ๋ณ‘๋ ฌ for ๋ฃจํ”„๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์—ฌ๋Ÿฌ ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ ๋งŒ๋“ค๊ณ  ๋ฐฐํฌํ•ฉ๋‹ˆ๋‹ค.
  3. ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ์˜ ๋ณ‘๋ ฌ ์‹คํ–‰์„ ํ˜ธ์ถœํ•˜๋Š” ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
  4. ์„ฑ๊ณต ๋ฐ ์‹คํŒจํ•œ ๋ชจ๋“  ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ ์‹คํ–‰์˜ ๊ฒฐ๊ณผ๊ฐ€ ์ €์žฅ๋˜๊ณ  ๋งต์— ๋ฐ˜ํ™˜๋ฉ๋‹ˆ๋‹ค.

Google Cloud ์ฝ˜์†”์—์„œ ๋˜๋Š” ํ„ฐ๋ฏธ๋„์ด๋‚˜ Cloud Shell์—์„œ Google Cloud CLI๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋น„์šฉ

์ด ๋ฌธ์„œ์—์„œ๋Š” ๋น„์šฉ์ด ์ฒญ๊ตฌ๋  ์ˆ˜ ์žˆ๋Š” Google Cloud๊ตฌ์„ฑ์š”์†Œ( )๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

ํ”„๋กœ์ ํŠธ ์‚ฌ์šฉ๋Ÿ‰์„ ๊ธฐ์ค€์œผ๋กœ ์˜ˆ์ƒ ๋น„์šฉ์„ ์‚ฐ์ถœํ•˜๋ ค๋ฉด ๊ฐ€๊ฒฉ ๊ณ„์‚ฐ๊ธฐ๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”.

Google Cloud ์‹ ๊ทœ ์‚ฌ์šฉ์ž๋Š” ๋ฌด๋ฃŒ ์ฒดํ—˜ํŒ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์‹œ์ž‘ํ•˜๊ธฐ ์ „์—

์กฐ์ง์—์„œ ์ •์˜ํ•œ ๋ณด์•ˆ ์ œ์•ฝ์กฐ๊ฑด์œผ๋กœ ์ธํ•ด ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ์™„๋ฃŒํ•˜์ง€ ๋ชปํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฌธ์ œ ํ•ด๊ฒฐ ์ •๋ณด๋Š” ์ œํ•œ๋œ Google Cloud ํ™˜๊ฒฝ์—์„œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ์„ ์ฐธ์กฐํ•˜์„ธ์š”.

์ฝ˜์†”

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Workflow Executions and Workflows APIs.

    Enable the APIs

  5. Create a service account:

    1. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    2. Select your project.
    3. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    4. Click Create and continue.
    5. Grant the Workflows > Workflows Invoker role to the service account.

      To grant the role, find the Select a role list, then select Workflows > Workflows Invoker.

    6. Click Continue.
    7. Click Done to finish creating the service account.

  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Verify that billing is enabled for your Google Cloud project.

  8. Enable the Workflow Executions and Workflows APIs.

    Enable the APIs

  9. Create a service account:

    1. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    2. Select your project.
    3. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    4. Click Create and continue.
    5. Grant the Workflows > Workflows Invoker role to the service account.

      To grant the role, find the Select a role list, then select Workflows > Workflows Invoker.

    6. Click Continue.
    7. Click Done to finish creating the service account.

gcloud

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Workflow Executions and Workflows APIs.

    Enable the APIs

  5. Create a service account:

    1. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    2. Select your project.
    3. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    4. Click Create and continue.
    5. Grant the roles/workflows.invoker role to the service account.

      To grant the role, find the Select a role list, then select roles/workflows.invoker.

    6. Click Continue.
    7. Click Done to finish creating the service account.

  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Verify that billing is enabled for your Google Cloud project.

  8. Enable the Workflow Executions and Workflows APIs.

    Enable the APIs

  9. Create a service account:

    1. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    2. Select your project.
    3. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    4. Click Create and continue.
    5. Grant the roles/workflows.invoker role to the service account.

      To grant the role, find the Select a role list, then select roles/workflows.invoker.

    6. Click Continue.
    7. Click Done to finish creating the service account.

ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ ๋งŒ๋“ค๊ธฐ ๋ฐ ๋ฐฐํฌ

ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๋Š” ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์‹ ํ•˜๊ณ  ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๋Š” ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•˜์—ฌ ์ด๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

  • ์ •์ˆ˜๋ฅผ ์ธ์ˆ˜๋กœ ์ˆ˜์‹ ํ•ฉ๋‹ˆ๋‹ค.
  • 10์ดˆ ๋™์•ˆ ์ ˆ์ „ ๋ชจ๋“œ๋กœ ์ „ํ™˜ํ•ด์„œ ์ผ๋ถ€ ์ฒ˜๋ฆฌ๋ฅผ ์‹œ๋ฎฌ๋ ˆ์ด์…˜ํ•ฉ๋‹ˆ๋‹ค.
  • ์ •์ˆ˜๊ฐ€ ํ™€์ˆ˜ ๋˜๋Š” ์ง์ˆ˜์ธ์ง€ ์—ฌ๋ถ€์— ๋”ฐ๋ผ ํ‘œ์‹œ๊ธฐ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์„œ ์›Œํฌํ”Œ๋กœ ์‹คํ–‰์˜ ์„ฑ๊ณต ๋˜๋Š” ์‹คํŒจ๋ฅผ ์‹œ๋ฎฌ๋ ˆ์ด์…˜ํ•ฉ๋‹ˆ๋‹ค.

์ฝ˜์†”

  1. Google Cloud ์ฝ˜์†”์—์„œ Workflows ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

    Workflows๋กœ ์ด๋™

  2. ๋งŒ๋“ค๊ธฐ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  3. ์ƒˆ ์›Œํฌํ”Œ๋กœ์— ๋Œ€ํ•ด workflow-child ์ด๋ฆ„์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

  4. ๋ฆฌ์ „ ๋ชฉ๋ก์—์„œ us-central1์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  5. ์ด์ „์— ๋งŒ๋“  ์„œ๋น„์Šค ๊ณ„์ •์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  6. ๋‹ค์Œ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  7. ์›Œํฌํ”Œ๋กœ ํŽธ์ง‘๊ธฐ์—์„œ ๋‹ค์Œ ์›Œํฌํ”Œ๋กœ ์ •์˜๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

    main:
      params: [args]
      steps:
        - init:
            assign:
              - iteration : ${args.iteration}
        - wait:
            call: sys.sleep
            args:
                seconds: 10
        - check_iteration_even_or_odd:
            switch:
              - condition: ${iteration % 2 == 0}
                next: raise_error
        - return_message:
            return: ${"Hello world"+iteration}
        - raise_error:
            raise: ${"Error with iteration "+iteration}
  8. ๋ฐฐํฌ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

gcloud

  1. ์›Œํฌํ”Œ๋กœ์˜ ์†Œ์Šค ์ฝ”๋“œ ํŒŒ์ผ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

    touch workflow-child.yaml
  2. ํ…์ŠคํŠธ ํŽธ์ง‘๊ธฐ์—์„œ ์†Œ์Šค ์ฝ”๋“œ ํŒŒ์ผ์„ ์—ด๊ณ  ๋‹ค์Œ ์›Œํฌํ”Œ๋กœ๋ฅผ ํŒŒ์ผ์— ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.

    main:
      params: [args]
      steps:
        - init:
            assign:
              - iteration : ${args.iteration}
        - wait:
            call: sys.sleep
            args:
                seconds: 10
        - check_iteration_even_or_odd:
            switch:
              - condition: ${iteration % 2 == 0}
                next: raise_error
        - return_message:
            return: ${"Hello world"+iteration}
        - raise_error:
            raise: ${"Error with iteration "+iteration}
  3. ์›Œํฌํ”Œ๋กœ ๋ฐฐํฌ:

    gcloud workflows deploy workflow-child \
        --source=workflow-child.yaml \
        --location=us-central1 \
        --service-account=SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com

    SERVICE_ACCOUNT_NAME์„ ์ด์ „์— ๋งŒ๋“  ์„œ๋น„์Šค ๊ณ„์ •์˜ ์ด๋ฆ„์œผ๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

์ƒ์œ„ ์›Œํฌํ”Œ๋กœ ๋งŒ๋“ค๊ธฐ ๋ฐ ๋ฐฐํฌ

์ƒ์œ„ ์›Œํฌํ”Œ๋กœ๋Š” ๋ณ‘๋ ฌ for ๋ฃจํ”„๋ฅผ ์‚ฌ์šฉํ•ด์„œ ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ์˜ ์—ฌ๋Ÿฌ ๋ถ„๊ธฐ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

  1. ์›Œํฌํ”Œ๋กœ ์ •์˜์— ๋Œ€ํ•œ ์†Œ์Šค ์ฝ”๋“œ๋ฅผ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ ๋ถ€๋ถ„์œผ๋กœ ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค.

    1. ๋งต์€ ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ ์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ์ €์žฅํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋งต์„ ์ฐธ์กฐํ•˜์„ธ์š”.

      main:
        steps:
          - init:
              assign:
                - execution_results: {} # results from each execution
                - execution_results.success: {} # successful executions saved under 'success' key
                - execution_results.failure: {} # failed executions saved under 'failure' key
    2. for ๋ฃจํ”„๊ฐ€ ๋ณ‘๋ ฌ๋กœ ์‹คํ–‰๋˜์–ด ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋ณ‘๋ ฌ ๋‹จ๊ณ„ ๋ฐ ๋ฐ˜๋ณต์„ ์ฐธ์กฐํ•˜์„ธ์š”.

      - execute_child_workflows:
          parallel:
            shared: [execution_results]
            for:
              value: iteration
              in: [1, 2, 3, 4]
              steps:
                  - iterate:
    3. ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๋Š” ์ปค๋„ฅํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค. ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ์˜ ๊ฐ ๋ฐ˜๋ณต์— iteration ์ธ์ˆ˜๊ฐ€ ์ „๋‹ฌ๋ฉ๋‹ˆ๋‹ค. ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ๊ฐ€ ๊ฐ ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ ์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Workflows Executions API ์ปค๋„ฅํ„ฐ ๋ฐ ๋Ÿฐํƒ€์ž„ ์ธ์ˆ˜๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

      try:
        steps:
          - execute_child_workflow:
              call: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.run
              args:
                workflow_id: workflow-child
                #location: ...
                #project_id: ...
                argument:
                  iteration: ${iteration}
              result: execution_result
          - save_successful_execution:
              assign:
                - execution_results.success[string(iteration)]: ${execution_result}
      except:
          as: e
          steps:
            - save_failed_execution:
                assign:
                  - execution_results.failure[string(iteration)]: ${e}
    4. ์‹คํ–‰ ๊ฒฐ๊ณผ๊ฐ€ ๋ฐ˜ํ™˜๋ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ์›Œํฌํ”Œ๋กœ ์‹คํ–‰ ์™„๋ฃŒ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

      - return_execution_results:
          return: ${execution_results}
  2. ์›Œํฌํ”Œ๋กœ ๋ฐฐํฌ:

    ์ฝ˜์†”

    1. Google Cloud ์ฝ˜์†”์—์„œ Workflows ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

      Workflows๋กœ ์ด๋™

    2. ๋งŒ๋“ค๊ธฐ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

    3. ์ƒˆ ์›Œํฌํ”Œ๋กœ์— ๋Œ€ํ•ด workflow-parent ์ด๋ฆ„์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

    4. ๋ฆฌ์ „ ๋ชฉ๋ก์—์„œ us-central1์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

    5. ์ด์ „์— ๋งŒ๋“  ์„œ๋น„์Šค ๊ณ„์ •์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

    6. ๋‹ค์Œ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

    7. ์›Œํฌํ”Œ๋กœ ํŽธ์ง‘๊ธฐ์—์„œ ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ์˜ ์ •์˜๋ฅผ ๋ถ™์—ฌ๋„ฃ์Šต๋‹ˆ๋‹ค.

    8. ๋ฐฐํฌ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

    gcloud

    1. ์›Œํฌํ”Œ๋กœ์˜ ์†Œ์Šค ์ฝ”๋“œ ํŒŒ์ผ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

      touch workflow-parent.yaml
    2. ํ…์ŠคํŠธ ํŽธ์ง‘๊ธฐ์—์„œ ์†Œ์Šค ์ฝ”๋“œ ํŒŒ์ผ์„ ์—ด๊ณ  ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ์— ๋Œ€ํ•œ ์ •์˜๋ฅผ ๋ถ™์—ฌ๋„ฃ์Šต๋‹ˆ๋‹ค.

    3. ์›Œํฌํ”Œ๋กœ ๋ฐฐํฌ:

      gcloud workflows deploy workflow-parent \
          --source=workflow-parent.yaml \
          --location=us-central1 \
          --service-account=SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com

      SERVICE_ACCOUNT_NAME์„ ์ด์ „์— ๋งŒ๋“  ์„œ๋น„์Šค ๊ณ„์ •์˜ ์ด๋ฆ„์œผ๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

์ƒ์œ„ ์›Œํฌํ”Œ๋กœ ์‹คํ–‰

ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ ํ˜ธ์ถœ์ด ๋™์‹œ์— ์‹คํ–‰๋˜๋„๋ก ์ƒ์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์‹คํ–‰์„ ์™„๋ฃŒํ•˜๋Š” ๋ฐ ์•ฝ 10์ดˆ ์ •๋„ ๊ฑธ๋ฆฝ๋‹ˆ๋‹ค.

์ฝ˜์†”

  1. Google Cloud ์ฝ˜์†”์—์„œ Workflows ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

    Workflows๋กœ ์ด๋™

  2. Workflows ํŽ˜์ด์ง€์—์„œ workflow-parent ์›Œํฌํ”Œ๋กœ๋ฅผ ํด๋ฆญํ•˜์—ฌ ์„ธ๋ถ€์ •๋ณด ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

  3. Workflows ์„ธ๋ถ€์ •๋ณด ํŽ˜์ด์ง€์—์„œ ์‹คํ–‰์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  4. ์‹คํ–‰์„ ๋‹ค์‹œ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  5. ์ถœ๋ ฅ ์ฐฝ์—์„œ ์›Œํฌํ”Œ๋กœ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

    ๊ฒฐ๊ณผ๋Š” ๋‹ค์Œ๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค. ๋ฐ˜๋ณต 2์™€ 4๋Š” ์˜ค๋ฅ˜๋ฅผ ๋‚˜ํƒ€๋‚ด๊ณ  ๋ฐ˜๋ณต 1๊ณผ 3์€ ์„ฑ๊ณต์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.

    "failure": {
      "2": {
        "message": "Execution failed or cancelled.",
        "operation": {
          "argument": "{\"iteration\":2}",
          "duration": "10.157992541s",
          "endTime": "2023-07-11T13:13:13.028424329Z",
          "error": {
            "context": "RuntimeError: \"Error with iteration 2\"\nin step \"raise_error\", routine \"main\", line: 18",
            "payload": "\"Error with iteration 2\"",
    ...
      "4": {
        "message": "Execution failed or cancelled.",
        "operation": {
          "argument": "{\"iteration\":4}",
          "duration": "10.157929734s",
          "endTime": "2023-07-11T13:13:13.061289142Z",
          "error": {
            "context": "RuntimeError: \"Error with iteration 4\"\nin step \"raise_error\", routine \"main\", line: 18",
            "payload": "\"Error with iteration 4\"",
    ...
    "success": {
      "1": "Hello world1",
      "3": "Hello world3"

gcloud

์›Œํฌํ”Œ๋กœ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

gcloud workflows run workflow-parent \
    --location=us-central1

๊ฒฐ๊ณผ๋Š” ๋‹ค์Œ๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค. ๋ฐ˜๋ณต 2์™€ 4๋Š” ์˜ค๋ฅ˜๋ฅผ ๋‚˜ํƒ€๋‚ด๊ณ  ๋ฐ˜๋ณต 1๊ณผ 3์€ ์„ฑ๊ณต์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.

Waiting for execution [06c753e4-6947-4c62-ac0b-2a9d53fb1b8f] to complete...done.
argument: 'null'
duration: 14.065415004s
endTime: '2023-07-11T12:50:43.929023883Z'
name: projects/386837416586/locations/us-central1/workflows/workflow-parent/executions/06c753e4-6947-4c62-ac0b-2a9d53fb1b8f
result: '{"failure":{"2":{"message":"Execution failed or cancelled.","operation":{"argument":"{\"iteration\":2}","duration":"10.143718070s","endTime":"2023-07-11T12:50:40.673209821Z","error":{"context":"RuntimeError:
...
"Error with iteration 2\"\nin step \"raise_error\", routine \"main\", line: 18","payload":"\"Error
...
"Error with iteration 4\"\nin step \"raise_error\", routine \"main\", line: 18","payload":"\"Error
...
"success":{"1":"Hello world1","3":"Hello world3"}}'
startTime: '2023-07-11T12:50:29.863608879Z'
state: SUCCEEDED

์ง€๊ธˆ๊นŒ์ง€ ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ ์‹คํ–‰ํ•˜๊ณ , ๋ณ‘๋ ฌ ๋ถ„๊ธฐ๋กœ ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ๋ฅผ 4๋ฒˆ ๋ฐ˜๋ณต ์‹คํ–‰ํ•˜๊ณ , ๊ฐ ํ•˜์œ„ ์›Œํฌํ”Œ๋กœ ์‹คํ–‰์— ๋Œ€ํ•ด ์„ฑ๊ณต ๋˜๋Š” ์‹คํŒจ ํ‘œ์‹œ๊ธฐ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ์›Œํฌํ”Œ๋กœ๋ฅผ ๋งŒ๋“ค๊ณ  ๋ฐฐํฌํ–ˆ์Šต๋‹ˆ๋‹ค.

์‚ญ์ œ

์ด ํŠœํ† ๋ฆฌ์–ผ์šฉ์œผ๋กœ ์ƒˆ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“  ๊ฒฝ์šฐ ์ด ํ”„๋กœ์ ํŠธ๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ์กด ํ”„๋กœ์ ํŠธ๋ฅผ ์‚ฌ์šฉํ•œ ๊ฒฝ์šฐ ์ด ํŠœํ† ๋ฆฌ์–ผ์— ์ถ”๊ฐ€๋œ ๋ณ€๊ฒฝ์‚ฌํ•ญ์€ ์ œ์™ธํ•˜๊ณ  ๋ณด์กดํ•˜๋ ค๋ฉด ํŠœํ† ๋ฆฌ์–ผ์šฉ์œผ๋กœ ๋งŒ๋“  ๋ฆฌ์†Œ์Šค๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.

ํ”„๋กœ์ ํŠธ ์‚ญ์ œ

๋น„์šฉ์ด ์ฒญ๊ตฌ๋˜์ง€ ์•Š๋„๋ก ํ•˜๋Š” ๊ฐ€์žฅ ์‰ฌ์šด ๋ฐฉ๋ฒ•์€ ํŠœํ† ๋ฆฌ์–ผ์—์„œ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ๋ฅผ ์‚ญ์ œํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

ํ”„๋กœ์ ํŠธ๋ฅผ ์‚ญ์ œํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  1. In the Google Cloud console, go to the Manage resources page.

    Go to Manage resources

  2. In the project list, select the project that you want to delete, and then click Delete.
  3. In the dialog, type the project ID, and then click Shut down to delete the project.

ํŠœํ† ๋ฆฌ์–ผ ๋ฆฌ์†Œ์Šค ์‚ญ์ œ

์ด ํŠœํ† ๋ฆฌ์–ผ์—์„œ ๋งŒ๋“  ์›Œํฌํ”Œ๋กœ๋ฅผ ์‚ญ์ œํ•˜์„ธ์š”.

gcloud workflows delete workflow-child
gcloud workflows delete workflow-parent

๋‹ค์Œ ๋‹จ๊ณ„