Charmed Temporal K8s Tutorial - Run Your First Workflow

Run Your First Workflow

This is part of the Charmed Temporal Tutorial. Please refer to this page for more information and the overview of the content.

Now that you have a Temporal Server up and running with a Temporal Worker connected to it, you will trigger a workflow execution and observe its result in the Web UI.

  1. Create a client to trigger the workflow as defined in the worker. For instance, if you are using the Python SDK, this would look like:
from temporallib.client import Client, Options
import asyncio

async def main():
    client_opt = Options(
        host="<temporal-host-name>:7233",
        queue="<your-queue>",
        namespace="<your-namespace>",
    )

    client = await Client.connect(client_opt=client_opt)
    workflow_name = "<workflow-name>"
    workflow_id = "<workflow-id>"

    greeting = await client.execute_workflow(
        workflow_name,
        id=workflow_id,
        task_queue="<your-queue>",
    )


if __name__ == "__main__":
    asyncio.run(main())
  1. Install the necessary packages and run the script above as fas follows:
pip install temporal-lib-py

python workflow.py
  1. Further details on the workflow execution can be viewed on the web UI.

Workflow and activity payloads can be encrypted by setting the same key in the auth-secret-id config of the Temporal worker and the Client configurations provided by the various Temporal SDKs. See auth-secret-id for details.

If TLS termination on ingress is configured, you must also provide the Certificate Authority (CA) to the client. See Temporal SDKs for configuration details.

See next: Cleanup your environment