Last active
September 5, 2024 22:15
-
-
Save nownabe/06396c5512a4ca822ceb1ba1d1af4e12 to your computer and use it in GitHub Desktop.
Python Sample for executing Cloud Workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from google.cloud.workflows_v1 import WorkflowsClient | |
from google.cloud.workflows.executions_v1 import ExecutionsClient | |
from google.cloud.workflows.executions_v1.types.executions import Execution | |
project = 'PROJECT ID' | |
location = 'REGION' | |
workflow = 'WORKFLOW NAME' | |
argument = { | |
"key1": "val1", | |
"key2": "val2" | |
} | |
parent = WorkflowsClient().workflow_path(project, location, workflow) | |
client = ExecutionsClient() | |
execution = Execution(argument=json.dumps(argument)) | |
response = client.create_execution(parent=parent, execution=execution) | |
print(f"Created execution: {response.name}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment