Executing a workflow runs the current workflow definition associated with the workflow.
You can pass runtime arguments in a workflow execution request and access those arguments using a workflow variable. For more information, see Pass runtime arguments in an execution request.
After a workflow execution completes, its history and results are retained for a limited time. For more information, see Quotas and limits.
Before you begin
Security constraints defined by your organization might prevent you from completing the following steps. For troubleshooting information, see Develop applications in a constrained Google Cloud environment.
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
- If a workflow accesses other Google Cloud resources, make sure it is
associated with a service account that has the correct permissions to do so.
To learn what service account is associated with an existing workflow, see
Verify a
workflow's associated service account.
Note that to create a resource and attach a service account, you need permissions to create that resource and to impersonate the service account that you will attach to the resource. For more information, see Service account permissions.
- Deploy a workflow using the Google Cloud console or the Google Cloud CLI.
Execute a workflow
You can execute a workflow in the following ways:
- In the Google Cloud console
- By using the Google Cloud CLI in either your terminal or Cloud Shell
- By sending a direct request to the Workflows API
You can also execute a workflow by using the Cloud Client Libraries. For more information, see Execute a workflow using the Cloud Client Libraries.
Console
To execute a workflow, in the Google Cloud console, go to the Workflows page:
On the Workflows page, select a workflow to go to its details page.
On the Workflow details page, click play_arrow Execute.
On the Execute workflow page, in the Input pane, you can enter optional runtime arguments to pass to your workflow before execution. Arguments must be in JSON format; for example,
{"animal":"cat"}. If your workflow doesn't use runtime arguments, leave this blank.Optionally, specify the level of call logging that you want to apply to the execution of the workflow. In the Call log level list, select one of:
- Not specified: no logging level is specified. This is the default. An execution log level takes precedence over any workflow log level, unless the execution log level is not specified (the default); in that case, the workflow log level applies.
- Errors only: log all caught exceptions; or when a call is stopped due to an exception.
- All calls: log all calls to subworkflows or library functions and their results.
- No logs: no call logging.
Optionally, specify the level of execution history that you want to apply to the execution of the workflow. In the Execution history list, select one of:
- Inherit from workflow: apply the execution history setting of the workflow. This is the default.
- Basic: enable basic execution history.
- Detailed: enable detailed execution history including any in-scope variable values and the expected number of iterations.
Click Execute.
On the Execution details page, you can view the results of the execution including any output, the execution ID and state, and the current or final step of the workflow execution. For more information, see Access workflow execution results.
gcloud
Open a terminal.
Find the name of the workflow you want to execute. If you don't know the workflow's name, you can enter the following command to list all your workflows:
gcloud workflows list
You can execute the workflow using either the
gcloud workflows runcommand or thegcloud workflows executecommand:Execute the workflow and wait for the execution to complete:
gcloud workflows run WORKFLOW_NAME \ --call-log-level=CALL_LOGGING_LEVEL \ --execution-history-level="EXECUTION_HISTORY_LEVEL" \ --data=DATA
Execute the workflow without waiting for the execution attempt to finish:
gcloud workflows execute WORKFLOW_NAME \ --call-log-level=CALL_LOGGING_LEVEL \ --execution-history-level="EXECUTION_HISTORY_LEVEL" \ --data=DATA
Replace the following:
WORKFLOW_NAME: the name of the workflow.CALL_LOGGING_LEVEL(optional): level of call logging to apply during execution. Can be one of: