From e3fe85d326a9bddc99c6ff19402fd15103b3ea8c Mon Sep 17 00:00:00 2001 From: rachfop Date: Wed, 8 May 2024 10:51:08 -0700 Subject: [PATCH 01/26] Python Table of Contents --- docs/dev-guide/hi.py | 51 + .../asynchronous-activity-completion.mdx | 40 + docs/dev-guide/python/cancellation.mdx | 71 + docs/dev-guide/python/child-workflows.mdx | 104 + docs/dev-guide/python/continue-as-new.mdx | 40 + docs/dev-guide/python/core-application.mdx | 485 ++++ .../{converters.mdx => data-encryption.mdx} | 31 +- docs/dev-guide/python/debugging.mdx | 11 +- docs/dev-guide/python/failure-detection.mdx | 210 ++ docs/dev-guide/python/features.mdx | 1292 ----------- docs/dev-guide/python/foundations.mdx | 725 ------ docs/dev-guide/python/interrupt-workflow.mdx | 73 + docs/dev-guide/python/messages.mdx | 432 ++++ docs/dev-guide/python/observability.mdx | 33 +- docs/dev-guide/python/schedules.mdx | 306 +++ docs/dev-guide/python/temporal-clients.mdx | 267 +++ .../python/{testing.mdx => test-suites.mdx} | 11 +- docs/dev-guide/python/timers.mdx | 38 + docs/dev-guide/python/versioning.mdx | 4 +- docusaurus.config.js | 3 +- sidebars.js | 22 +- vercel.json | 2002 ----------------- 22 files changed, 2162 insertions(+), 4089 deletions(-) create mode 100644 docs/dev-guide/hi.py create mode 100644 docs/dev-guide/python/asynchronous-activity-completion.mdx create mode 100644 docs/dev-guide/python/cancellation.mdx create mode 100644 docs/dev-guide/python/child-workflows.mdx create mode 100644 docs/dev-guide/python/continue-as-new.mdx create mode 100644 docs/dev-guide/python/core-application.mdx rename docs/dev-guide/python/{converters.mdx => data-encryption.mdx} (94%) create mode 100644 docs/dev-guide/python/failure-detection.mdx delete mode 100644 docs/dev-guide/python/features.mdx create mode 100644 docs/dev-guide/python/interrupt-workflow.mdx create mode 100644 docs/dev-guide/python/messages.mdx create mode 100644 docs/dev-guide/python/schedules.mdx create mode 100644 docs/dev-guide/python/temporal-clients.mdx rename docs/dev-guide/python/{testing.mdx => test-suites.mdx} (98%) create mode 100644 docs/dev-guide/python/timers.mdx delete mode 100644 vercel.json diff --git a/docs/dev-guide/hi.py b/docs/dev-guide/hi.py new file mode 100644 index 0000000000..5d26527676 --- /dev/null +++ b/docs/dev-guide/hi.py @@ -0,0 +1,51 @@ +import os + +titles = [ + "Core application", + "Temporal Clients", + "Test suites", + "Failure detection", + "Messages", + "Runtime safeguards", + "Cancellation", + "Asynchronous Activity Completion", + "Versioning", + "Observability", + "Debugging", + "Schedules", + "Data encryption", + "Side Effects", + "Child Workflows", + "Continue-As-New", + "Timers", + "Interrupt a Workflow Execution" +] + +# Create a directory to store the .mdx files +os.makedirs("mdx", exist_ok=True) + +for index, title in enumerate(titles, start=1): + file_name = title.lower().replace(" ", "_") + ".mdx" + file_path = os.path.join("mdx", file_name) + + with open(file_path, "w") as file: + # Write metadata + file.write("---\n") + file.write(f"id: {title.lower().replace(' ', '-')}\n") + file.write(f"title: {title}\n") + file.write(f"sidebar_label: {title}\n") + file.write(f"sidebar_position: {index}\n") + file.write("description: \n") + file.write(f"slug: /dev-guide/python/{file_name[:-4]}\n") + file.write("toc_max_heading_level: 2\n") + file.write("keywords:\n") + file.write(f" - {title.lower().replace(' ', '-')}\n") + file.write("tags:\n") + file.write(f" - {title.lower().replace(' ', '-')}\n") + file.write("---\n\n") + + # Write title and content placeholder + file.write(f"# {title}\n\n") + file.write("{/* Content goes here */}\n") + +print("MDX files created successfully.") \ No newline at end of file diff --git a/docs/dev-guide/python/asynchronous-activity-completion.mdx b/docs/dev-guide/python/asynchronous-activity-completion.mdx new file mode 100644 index 0000000000..6889800f09 --- /dev/null +++ b/docs/dev-guide/python/asynchronous-activity-completion.mdx @@ -0,0 +1,40 @@ +--- +id: asynchronous-activity-completion +title: Asynchronous Activity Completion +sidebar_label: Asynchronous Activity Completion +sidebar_position: 8 +description: Complete an Activity without waiting for execution to finish, using Temporal Client and Activity Function. +slug: /dev-guide/python/asynchronous_activity_completion +toc_max_heading_level: 2 +--- + +## How to asynchronously complete an Activity + +[Asynchronous Activity Completion](/activities#asynchronous-activity-completion) enables the Activity Function to return without the Activity Execution completing. + +There are three steps to follow: + +1. The Activity provides the external system with identifying information needed to complete the Activity Execution. + Identifying information can be a [Task Token](/activities#task-token), or a combination of Namespace, Workflow Id, and Activity Id. +2. The Activity Function completes in a way that identifies it as waiting to be completed by an external system. +3. The Temporal Client is used to Heartbeat and complete the Activity. + +To mark an Activity as completing asynchronously, do the following inside the Activity. + +```python +# Capture token for later completion +captured_token = activity.info().task_token +activity.raise_complete_async() +``` + +To update an Activity outside the Activity, use the [get_async_activity_handle()](https://python.temporal.io/temporalio.client.Client.html#get_async_activity_handle) method to get the handle of the Activity. + +```python +handle = my_client.get_async_activity_handle(task_token=captured_token) +``` + +Then, on that handle, you can call the results of the Activity, `heartbeat`, `complete`, `fail`, or `report_cancellation` method to update the Activity. + +```python +await handle.complete("Completion value.") +``` diff --git a/docs/dev-guide/python/cancellation.mdx b/docs/dev-guide/python/cancellation.mdx new file mode 100644 index 0000000000..5973817e7f --- /dev/null +++ b/docs/dev-guide/python/cancellation.mdx @@ -0,0 +1,71 @@ +--- +id: cancellation +title: Cancellation +sidebar_label: Cancellation +sidebar_position: 7 +description: Cancel an Activity from a Workflow, sending Heartbeats and setting a Heartbeat Timeout, and handling cancellation errors. +slug: /dev-guide/python/cancellation +toc_max_heading_level: 2 +keywords: + - cancellation +tags: + - cancellation +--- +## Cancel an Activity from a Workflow {#cancel-an-activity} + +Canceling an Activity from within a Workflow requires that the Activity Execution sends Heartbeats and sets a Heartbeat Timeout. +If the Heartbeat is not invoked, the Activity cannot receive a cancellation request. +When any non-immediate Activity is executed, the Activity Execution should send Heartbeats and set a [Heartbeat Timeout](/activities#heartbeat-timeout) to ensure that the server knows it is still working. + +When an Activity is canceled, an error is raised in the Activity at the next available opportunity. +If cleanup logic needs to be performed, it can be done in a `finally` clause or inside a caught cancel error. +However, for the Activity to appear canceled the exception needs to be re-raised. + +:::note + +Unlike regular Activities, [Local Activities](/activities#local-activity) can be canceled if they don't send Heartbeats. +Local Activities are handled locally, and all the information needed to handle the cancellation logic is available in the same Worker process. + +::: + +To cancel an Activity from a Workflow Execution, call the [cancel()](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.cancel) method on the Activity handle that is returned from [start_activity()](https://python.temporal.io/temporalio.workflow.html#start_activity). + +```python +@activity.defn +async def cancellable_activity(input: ComposeArgsInput) -> NoReturn: + try: + while True: + print("Heartbeating cancel activity") + await asyncio.sleep(0.5) + activity.heartbeat("some details") + except asyncio.CancelledError: + print("Activity cancelled") + raise + + +@activity.defn +async def run_activity(input: ComposeArgsInput): + print("Executing activity") + return input.arg1 + input.arg2 + +@workflow.defn + class GreetingWorkflow: + @workflow.run + async def run(self, input: ComposeArgsInput) -> None: + activity_handle = workflow.start_activity( + cancellable_activity, + ComposeArgsInput(input.arg1, input.arg2), + start_to_close_timeout=timedelta(minutes=5), + heartbeat_timeout=timedelta(seconds=30), + ) + + await asyncio.sleep(3) + activity_handle.cancel() +``` + +:::note + +The Activity handle is a Python task. +By calling `cancel()`, you're essentially requesting the task to be canceled. + +::: diff --git a/docs/dev-guide/python/child-workflows.mdx b/docs/dev-guide/python/child-workflows.mdx new file mode 100644 index 0000000000..89a9fe23db --- /dev/null +++ b/docs/dev-guide/python/child-workflows.mdx @@ -0,0 +1,104 @@ +--- +id: child-workflows +title: Child Workflows +sidebar_label: Child Workflows +sidebar_position: 15 +description: Spawn a new Workflow from within another Workflow, with options for Parent Close Policy and handling Child Workflow Events. +slug: /dev-guide/python/child_workflows +toc_max_heading_level: 2 +keywords: + - child-workflows +tags: + - child-workflows +--- + +## How to start a Child Workflow Execution {#child-workflows} + +A [Child Workflow Execution](/encyclopedia/child-workflows) is a Workflow Execution that is scheduled from within another Workflow using a Child Workflow API. + +When using a Child Workflow API, Child Workflow related Events ([StartChildWorkflowExecutionInitiated](/references/events#startchildworkflowexecutioninitiated), [ChildWorkflowExecutionStarted](/references/events#childworkflowexecutionstarted), [ChildWorkflowExecutionCompleted](/references/events#childworkflowexecutioncompleted), etc...) are logged in the Workflow Execution Event History. + +Always block progress until the [ChildWorkflowExecutionStarted](/references/events#childworkflowexecutionstarted) Event is logged to the Event History to ensure the Child Workflow Execution has started. +After that, Child Workflow Executions may be abandoned using the default _Abandon_ [Parent Close Policy](/encyclopedia/child-workflows#parent-close-policy) set in the Child Workflow Options. + +To be sure that the Child Workflow Execution has started, first call the Child Workflow Execution method on the instance of Child Workflow future, which returns a different future. + +Then get the value of an object that acts as a proxy for a result that is initially unknown, which is what waits until the Child Workflow Execution has spawned. + +To spawn a Child Workflow Execution in Python, use the [`execute_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#execute_child_workflow) function which starts the Child Workflow and waits for completion or +use the [`start_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#start_child_workflow) function to start a Child Workflow and return its handle. +This is useful if you want to do something after it has only started, or to get the Workflow/Run ID, or to be able to signal it while running. + +:::note + +`execute_child_workflow()` is a helper function for `start_child_workflow()` plus `await handle`. + +::: + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +@workflow.defn +class ComposeGreetingWorkflow: + @workflow.run + async def run(self, input: ComposeGreetingInput) -> str: + return f"{input.greeting}, {input.name}!" + + +@workflow.defn +class GreetingWorkflow: + @workflow.run + async def run(self, name: str) -> str: + return await workflow.execute_child_workflow( + ComposeGreetingWorkflow.run, + ComposeGreetingInput("Hello", name), + id="hello-child-workflow-workflow-child-id", +# ... + ) +``` + +#### How to set a Parent Close Policy {#parent-close-policy} + +A [Parent Close Policy](/encyclopedia/child-workflows#parent-close-policy) determines what happens to a Child Workflow Execution if its Parent changes to a Closed status (Completed, Failed, or Timed Out). + +The default Parent Close Policy option is set to terminate the Child Workflow Execution. + +Set the `parent_close_policy` parameter inside the [`start_child_workflow`](https://python.temporal.io/temporalio.workflow.html#start_child_workflow) function or the [`execute_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#execute_child_workflow) function to specify the behavior of the Child Workflow when the Parent Workflow closes. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio.workflow import ParentClosePolicy +# ... +# ... +@workflow.defn +class ComposeGreetingWorkflow: + @workflow.run + async def run(self, input: ComposeGreetingInput) -> str: + return f"{input.greeting}, {input.name}!" + + +@workflow.defn +class GreetingWorkflow: + @workflow.run + async def run(self, name: str) -> str: + return await workflow.execute_child_workflow( + ComposeGreetingWorkflow.run, + ComposeGreetingInput("Hello", name), + id="hello-child-workflow-workflow-child-id", + parent_close_policy=ParentClosePolicy.ABANDON, + ) +``` diff --git a/docs/dev-guide/python/continue-as-new.mdx b/docs/dev-guide/python/continue-as-new.mdx new file mode 100644 index 0000000000..fd5e06ee61 --- /dev/null +++ b/docs/dev-guide/python/continue-as-new.mdx @@ -0,0 +1,40 @@ +--- +id: continue-as-new +title: Continue-As-New +sidebar_label: Continue-As-New +sidebar_position: 16 +description: Close a Workflow Execution and create a new one with the same Workflow ID, new Run ID, and fresh Event History. +slug: /dev-guide/python/continue-as-new +toc_max_heading_level: 2 +keywords: + - continue-as-new +tags: + - continue-as-new +--- + +## How to Continue-As-New {#continue-as-new} + +[Continue-As-New](/workflows#continue-as-new) enables a Workflow Execution to close successfully and create a new Workflow Execution in a single atomic operation if the number of Events in the Event History is becoming too large. +The Workflow Execution spawned from the use of Continue-As-New has the same Workflow Id, a new Run Id, and a fresh Event History and is passed all the appropriate parameters. + +To Continue-As-New in Python, call the [`continue_as_new()`](https://python.temporal.io/temporalio.workflow.html#continue_as_new) function from inside your Workflow, which will stop the Workflow immediately and Continue-As-New. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +@workflow.defn +class LoopingWorkflow: + @workflow.run + async def run(self, iteration: int) -> None: + if iteration == 5: + return + await asyncio.sleep(10) + workflow.continue_as_new(iteration + 1) +``` diff --git a/docs/dev-guide/python/core-application.mdx b/docs/dev-guide/python/core-application.mdx new file mode 100644 index 0000000000..7fd1cb34c6 --- /dev/null +++ b/docs/dev-guide/python/core-application.mdx @@ -0,0 +1,485 @@ +--- +id: core-application +title: Core application +sidebar_label: Core application +sidebar_position: 1 +description: Develop basic Temporal application with workflows & activities in Python using Temporal SDK. +slug: /dev-guide/python/core_application +toc_max_heading_level: 2 +keywords: + - core-application +tags: + - core-application +--- + +## How to develop a basic Workflow {#develop-workflows} + +Workflows are the fundamental unit of a Temporal Application, and it all starts with the development of a [Workflow Definition](/workflows#workflow-definition). + +In the Temporal Python SDK programming model, Workflows are defined as classes. + +Specify the `@workflow.defn` decorator on the Workflow class to identify a Workflow. + +Use the `@workflow.run` to mark the entry point method to be invoked. This must be set on one asynchronous method defined on the same class as `@workflow.defn`. Run methods have positional parameters. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio import workflow +# ... +# ... +@workflow.defn(name="YourWorkflow") +class YourWorkflow: + @workflow.run + async def run(self, name: str) -> str: + return await workflow.execute_activity( + your_activity, + YourParams("Hello", name), + start_to_close_timeout=timedelta(seconds=10), + ) +``` + +### How to define Workflow parameters {#workflow-parameters} + +Temporal Workflows may have any number of custom parameters. +However, we strongly recommend that objects are used as parameters, so that the object's individual fields may be altered without breaking the signature of the Workflow. +All Workflow Definition parameters must be serializable. + +Workflow parameters are the method parameters of the singular method decorated with `@workflow.run`. +These can be any data type Temporal can convert, including [`dataclasses`](https://docs.python.org/3/library/dataclasses.html) when properly type-annotated. +Technically this can be multiple parameters, but Temporal strongly encourages a single `dataclass` parameter containing all input fields. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from dataclasses import dataclass +# ... +# ... +@dataclass +class YourParams: + greeting: str + name: str +``` + +### How to define Workflow return parameters {#workflow-return-values} + +Workflow return values must also be serializable. +Returning results, returning errors, or throwing exceptions is fairly idiomatic in each language that is supported. +However, Temporal APIs that must be used to get the result of a Workflow Execution will only ever receive one of either the result or the error. + +To return a value of the Workflow, use `return` to return an object. + +To return the results of a Workflow Execution, use either `start_workflow()` or `execute_workflow()` asynchronous methods. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio import workflow +# ... +# ... +@workflow.defn(name="YourWorkflow") +class YourWorkflow: + @workflow.run + async def run(self, name: str) -> str: + return await workflow.execute_activity( + your_activity, + YourParams("Hello", name), + start_to_close_timeout=timedelta(seconds=10), + ) +``` + +### How to customize your Workflow Type {#workflow-type} + +Workflows have a Type that are referred to as the Workflow name. + +The following examples demonstrate how to set a custom name for your Workflow Type. + +You can customize the Workflow name with a custom name in the decorator argument. For example, `@workflow.defn(name="your-workflow-name")`. If the name parameter is not specified, the Workflow name defaults to the function name. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio import workflow +# ... +# ... +@workflow.defn(name="YourWorkflow") +class YourWorkflow: + @workflow.run + async def run(self, name: str) -> str: + return await workflow.execute_activity( + your_activity, + YourParams("Hello", name), + start_to_close_timeout=timedelta(seconds=10), + ) +``` + +### How develop Workflow logic {#workflow-logic-requirements} + +Workflow logic is constrained by [deterministic execution requirements](/workflows#deterministic-constraints). +Therefore, each language is limited to the use of certain idiomatic techniques. +However, each Temporal SDK provides a set of APIs that can be used inside your Workflow to interact with external (to the Workflow) application code. + +Workflow code must be deterministic. This means: + +- no threading +- no randomness +- no external calls to processes +- no network I/O +- no global state mutation +- no system date or time + +All API safe for Workflows used in the [`temporalio.workflow`](https://python.temporal.io/temporalio.workflow.html) must run in the implicit [`asyncio` event loop](https://docs.python.org/3/library/asyncio-eventloop.html) and be _deterministic_. + +## How to develop a basic Activity {#develop-activities} + +One of the primary things that Workflows do is orchestrate the execution of Activities. +An Activity is a normal function or method execution that's intended to execute a single, well-defined action (either short or long-running), such as querying a database, calling a third-party API, or transcoding a media file. +An Activity can interact with world outside the Temporal Platform or use a Temporal Client to interact with a Cluster. +For the Workflow to be able to execute the Activity, we must define the [Activity Definition](/activities#activity-definition). + +You can develop an Activity Definition by using the `@activity.defn` decorator. +Register the function as an Activity with a custom name through a decorator argument, for example `@activity.defn(name="your_activity")`. + +:::note + +The Temporal Python SDK supports multiple ways of implementing an Activity: + +- Asynchronously using [`asyncio`](https://docs.python.org/3/library/asyncio.html) +- Synchronously multithreaded using [`concurrent.futures.ThreadPoolExecutor`](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) +- Synchronously multiprocess using [`concurrent.futures.ProcessPoolExecutor`](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and [`multiprocessing.managers.SyncManager`](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.managers.SyncManager) + +Blocking the async event loop in Python would turn your asynchronous program into a synchronous program that executes serially, defeating the entire purpose of using `asyncio`. +This can also lead to potential deadlock, and unpredictable behavior that causes tasks to be unable to execute. +Debugging these issues can be difficult and time consuming, as locating the source of the blocking call might not always be immediately obvious. + +Due to this, consider not make blocking calls from within an asynchronous Activity, or use an async safe library to perform +these actions. +If you must use a blocking library, consider using a synchronous Activity instead. + +::: + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio import activity +# ... +# ... +@activity.defn(name="your_activity") +async def your_activity(input: YourParams) -> str: + return f"{input.greeting}, {input.name}!" +``` + +### How to develop Activity Parameters {#activity-parameters} + +There is no explicit limit to the total number of parameters that an [Activity Definition](/activities#activity-definition) may support. +However, there is a limit to the total size of the data that ends up encoded into a gRPC message Payload. + +A single argument is limited to a maximum size of 2 MB. +And the total size of a gRPC message, which includes all the arguments, is limited to a maximum of 4 MB. + +Also, keep in mind that all Payload data is recorded in the [Workflow Execution Event History](/workflows#event-history) and large Event Histories can affect Worker performance. +This is because the entire Event History could be transferred to a Worker Process with a [Workflow Task](/workers#workflow-task). + + + +Some SDKs require that you pass context objects, others do not. +When it comes to your application data—that is, data that is serialized and encoded into a Payload—we recommend that you use a single object as an argument that wraps the application data passed to Activities. +This is so that you can change what data is passed to the Activity without breaking a function or method signature. + +Activity parameters are the function parameters of the function decorated with `@activity.defn`. +These can be any data type Temporal can convert, including dataclasses when properly type-annotated. +Technically this can be multiple parameters, but Temporal strongly encourages a single dataclass parameter containing all input fields. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio import activity +from your_dataobject_dacx import YourParams + +# ... +# ... +@activity.defn(name="your_activity") +async def your_activity(input: YourParams) -> str: + return f"{input.greeting}, {input.name}!" +``` + +### How to define Activity return values {#activity-return-values} + +All data returned from an Activity must be serializable. + +There is no explicit limit to the amount of data that can be returned by an Activity, but keep in mind that all return values are recorded in a [Workflow Execution Event History](/workflows#event-history). + +An Activity Execution can return inputs and other Activity values. + +The following example defines an Activity that takes a string as input and returns a string. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +@activity.defn(name="your_activity") +async def your_activity(input: YourParams) -> str: + return f"{input.greeting}, {input.name}!" +``` + +### How to customize your Activity Type {#activity-type} + +Activities have a Type that are referred to as the Activity name. +The following examples demonstrate how to set a custom name for your Activity Type. + +You can customize the Activity name with a custom name in the decorator argument. For example, `@activity.defn(name="your-activity")`. +If the name parameter is not specified, the Activity name defaults to the function name. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +@activity.defn(name="your_activity") +async def your_activity(input: YourParams) -> str: + return f"{input.greeting}, {input.name}!" +``` + +## How to start an Activity Execution {#activity-execution} + +Calls to spawn [Activity Executions](/activities#activity-execution) are written within a [Workflow Definition](/workflows#workflow-definition). +The call to spawn an Activity Execution generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command. +This results in the set of three [Activity Task](/workers#activity-task) related Events ([ActivityTaskScheduled](/references/events#activitytaskscheduled), [ActivityTaskStarted](/references/events#activitytaskstarted), and ActivityTask[Closed])in your Workflow Execution Event History. + +A single instance of the Activities implementation is shared across multiple simultaneous Activity invocations. +Activity implementation code should be _idempotent_. + +The values passed to Activities through invocation parameters or returned through a result value are recorded in the Execution history. +The entire Execution history is transferred from the Temporal service to Workflow Workers when a Workflow state needs to recover. +A large Execution history can thus adversely impact the performance of your Workflow. + +Therefore, be mindful of the amount of data you transfer through Activity invocation parameters or Return Values. +Otherwise, no additional limitations exist on Activity implementations. + +To spawn an Activity Execution, use the [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) operation from within your Workflow Definition. + +`execute_activity()` is a shortcut for [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) that waits on its result. + +To get just the handle to wait and cancel separately, use `start_activity()`. +In most cases, use `execute_activity()` unless advanced task capabilities are needed. + +A single argument to the Activity is positional. Multiple arguments are not supported in the type-safe form of `start_activity()` or `execute_activity()` and must be supplied by the `args` keyword argument. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio import workflow +# ... +# ... +@workflow.defn(name="YourWorkflow") +class YourWorkflow: + @workflow.run + async def run(self, name: str) -> str: + return await workflow.execute_activity( + your_activity, + YourParams("Hello", name), + start_to_close_timeout=timedelta(seconds=10), + ) +``` + +### How to set the required Activity Timeouts {#required-timeout} + +Activity Execution semantics rely on several parameters. +The only required value that needs to be set is either a [Schedule-To-Close Timeout](/activities#start-to-close-timeout) or a [Start-To-Close Timeout](/activities#start-to-close-timeout). +These values are set in the Activity Options. + +Activity options are set as keyword arguments after the Activity arguments. + +Available timeouts are: + +- schedule_to_close_timeout +- schedule_to_start_timeout +- start_to_close_timeout + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + activity_timeout_result = await workflow.execute_activity( + your_activity, + YourParams(greeting, "Activity Timeout option"), + # Activity Execution Timeout + start_to_close_timeout=timedelta(seconds=10), + # schedule_to_start_timeout=timedelta(seconds=10), + # schedule_to_close_timeout=timedelta(seconds=10), + ) +``` + +### How to get the results of an Activity Execution {#get-activity-results} + +The call to spawn an [Activity Execution](/activities#activity-execution) generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command and provides the Workflow with an Awaitable. +Workflow Executions can either block progress until the result is available through the Awaitable or continue progressing, making use of the result when it becomes available. + +Use [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) to start an Activity and return its handle, [`ActivityHandle`](https://python.temporal.io/temporalio.workflow.ActivityHandle.html). Use [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) to return the results. + +You must provide either `schedule_to_close_timeout` or `start_to_close_timeout`. + +`execute_activity()` is a shortcut for `await start_activity()`. An asynchronous `execute_activity()` helper is provided which takes the same arguments as `start_activity()` and `await`s on the result. `execute_activity()` should be used in most cases unless advanced task capabilities are needed. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio import workflow +# ... +# ... +@workflow.defn(name="YourWorkflow") +class YourWorkflow: + @workflow.run + async def run(self, name: str) -> str: + return await workflow.execute_activity( + your_activity, + YourParams("Hello", name), + start_to_close_timeout=timedelta(seconds=10), + ) +``` + +## How to run Worker Processes {#run-a-dev-worker} + +The [Worker Process](/workers#worker-process) is where Workflow Functions and Activity Functions are executed. + +- Each [Worker Entity](/workers#worker-entity) in the Worker Process must register the exact Workflow Types and Activity Types it may execute. +- Each Worker Entity must also associate itself with exactly one [Task Queue](/workers#task-queue). +- Each Worker Entity polling the same Task Queue must be registered with the same Workflow Types and Activity Types. + +A [Worker Entity](/workers#worker-entity) is the component within a Worker Process that listens to a specific Task Queue. + +Although multiple Worker Entities can be in a single Worker Process, a single Worker Entity Worker Process may be perfectly sufficient. +For more information, see the [Worker tuning guide](/dev-guide/worker-performance). + +A Worker Entity contains a Workflow Worker and/or an Activity Worker, which makes progress on Workflow Executions and Activity Executions, respectively. + +To develop a Worker, use the `Worker()` constructor and add your Client, Task Queue, Workflows, and Activities as arguments. +The following code example creates a Worker that polls for tasks from the Task Queue and executes the Workflow. +When a Worker is created, it accepts a list of Workflows in the workflows parameter, a list of Activities in the activities parameter, or both. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio.client import Client +from temporalio.worker import Worker +# ... +# ... +async def main(): + client = await Client.connect("localhost:7233") + worker = Worker( + client, + task_queue="your-task-queue", + workflows=[YourWorkflow], + activities=[your_activity], + ) + await worker.run() + + +if __name__ == "__main__": + asyncio.run(main()) +``` + +### How to register types {#register-types} + +All Workers listening to the same Task Queue name must be registered to handle the exact same Workflows Types and Activity Types. + +If a Worker polls a Task for a Workflow Type or Activity Type it does not know about, it fails that Task. +However, the failure of the Task does not cause the associated Workflow Execution to fail. + +When a `Worker` is created, it accepts a list of Workflows in the `workflows` parameter, a list of Activities in the `activities` parameter, or both. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + worker = Worker( + client, + task_queue="your-task-queue", + workflows=[YourWorkflow], + activities=[your_activity], + ) + await worker.run() + + +if __name__ == "__main__": + asyncio.run(main()) +``` diff --git a/docs/dev-guide/python/converters.mdx b/docs/dev-guide/python/data-encryption.mdx similarity index 94% rename from docs/dev-guide/python/converters.mdx rename to docs/dev-guide/python/data-encryption.mdx index 6bc86a5e76..6b3b3813c8 100644 --- a/docs/dev-guide/python/converters.mdx +++ b/docs/dev-guide/python/data-encryption.mdx @@ -1,31 +1,18 @@ --- -id: converters -title: Converters and Codecs - Python SDK feature guide -sidebar_label: Converters and Codecs -sidebar_position: 10 +id: data-encryption +title: Data encryption +sidebar_label: Data encryption +sidebar_position: 13 description: The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. -slug: /dev-guide/python/converters -toc_max_heading_level: 4 +slug: /dev-guide/python/data_encryption +toc_max_heading_level: 2 keywords: - - data converter - - developer-guide - - developer-guide-doc-type - - how-to-doc-type - - payload conversion - - payload converter - - python - - python sdk + - data-encryption tags: - - data-converter - - developer-guide - - developer-guide-doc-type - - how-to-doc-type - - payload-conversion - - payload-converter - - python - - python-sdk + - data-encryption --- + This page shows the following: - How to use a custom Payload Codec diff --git a/docs/dev-guide/python/debugging.mdx b/docs/dev-guide/python/debugging.mdx index c027429a49..b4c3bde7bb 100644 --- a/docs/dev-guide/python/debugging.mdx +++ b/docs/dev-guide/python/debugging.mdx @@ -1,14 +1,15 @@ --- id: debugging -title: Debugging - Python SDK feature guide +title: Debugging sidebar_label: Debugging -sidebar_position: 6 +sidebar_position: 11 description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. -toc_max_heading_level: 4 +slug: /dev-guide/python/debugging +toc_max_heading_level: 2 keywords: -- guide-context + - debugging tags: -- guide-context + - debugging --- diff --git a/docs/dev-guide/python/failure-detection.mdx b/docs/dev-guide/python/failure-detection.mdx new file mode 100644 index 0000000000..925288dd63 --- /dev/null +++ b/docs/dev-guide/python/failure-detection.mdx @@ -0,0 +1,210 @@ +--- +id: failure-detection +title: Failure detection +sidebar_label: Failure detection +sidebar_position: 4 +Description: Guidance on setting timeouts, retries, and heartbeat functionality for Workflows and Activities in Python with Temporal. +slug: /dev-guide/python/failure_detection +toc_max_heading_level: 2 +keywords: + - failure-detection +tags: + - failure-detection +--- + +## Workflow timeouts {#workflow-timeouts} + +Each Workflow timeout controls the maximum duration of a different aspect of a Workflow Execution. + +Workflow timeouts are set when [starting the Workflow Execution](#workflow-timeouts). + +- **[Workflow Execution Timeout](/workflows#workflow-execution-timeout)** - restricts the maximum amount of time that a single Workflow Execution can be executed. +- **[Workflow Run Timeout](/workflows#workflow-run-timeout):** restricts the maximum amount of time that a single Workflow Run can last. +- **[Workflow Task Timeout](/workflows#workflow-task-timeout):** restricts the maximum amount of time that a Worker can execute a Workflow Task. + +Set the timeout to either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. + +Available timeouts are: + +- `execution_timeout` +- `run_timeout` +- `task_timeout` + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + result = await client.execute_workflow( + YourWorkflow.run, + "your timeout argument", + id="your-workflow-id", + task_queue="your-task-queue", + # Set Workflow Timeout duration + execution_timeout=timedelta(seconds=2), + # run_timeout=timedelta(seconds=2), + # task_timeout=timedelta(seconds=2), + ) +``` + +### Workflow retries {#workflow-retries} + +A Retry Policy can work in cooperation with the timeouts to provide fine controls to optimize the execution experience. + +Use a [Retry Policy](/retry-policies) to retry a Workflow Execution in the event of a failure. + +Workflow Executions do not retry by default, and Retry Policies should be used with Workflow Executions only in certain situations. + +Set the Retry Policy to either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + handle = await client.execute_workflow( + YourWorkflow.run, + "your retry policy argument", + id="your-workflow-id", + task_queue="your-task-queue", + retry_policy=RetryPolicy(maximum_interval=timedelta(seconds=2)), + ) +``` + +## How to set Activity timeouts {#activity-timeouts} + +Each Activity timeout controls the maximum duration of a different aspect of an Activity Execution. + +The following timeouts are available in the Activity Options. + +- **[Schedule-To-Close Timeout](/activities#schedule-to-close-timeout):** is the maximum amount of time allowed for the overall [Activity Execution](/activities#activity-execution). +- **[Start-To-Close Timeout](/activities#start-to-close-timeout):** is the maximum time allowed for a single [Activity Task Execution](/workers#activity-task-execution). +- **[Schedule-To-Start Timeout](/activities#schedule-to-start-timeout):** is the maximum amount of time that is allowed from when an [Activity Task](/workers#activity-task) is scheduled to when a [Worker](/workers#worker) starts that Activity Task. + +An Activity Execution must have either the Start-To-Close or the Schedule-To-Close Timeout set. + +Activity options are set as keyword arguments after the Activity arguments. + +Available timeouts are: + +- schedule_to_close_timeout +- schedule_to_start_timeout +- start_to_close_timeout + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + activity_timeout_result = await workflow.execute_activity( + your_activity, + YourParams(greeting, "Activity Timeout option"), + # Activity Execution Timeout + start_to_close_timeout=timedelta(seconds=10), + # schedule_to_start_timeout=timedelta(seconds=10), + # schedule_to_close_timeout=timedelta(seconds=10), + ) +``` + +### How to set an Activity Retry Policy {#activity-retries} + +A Retry Policy works in cooperation with the timeouts to provide fine controls to optimize the execution experience. + +Activity Executions are automatically associated with a default [Retry Policy](/retry-policies) if a custom one is not provided. + +To create an Activity Retry Policy in Python, set the [RetryPolicy](https://python.temporal.io/temporalio.common.RetryPolicy.html) class within the [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) or [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) function. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio.common import RetryPolicy +# ... + activity_result = await workflow.execute_activity( + your_activity, + YourParams(greeting, "Retry Policy options"), + start_to_close_timeout=timedelta(seconds=10), + # Retry Policy + retry_policy=RetryPolicy( + backoff_coefficient=2.0, + maximum_attempts=5, + initial_interval=timedelta(seconds=1), + maximum_interval=timedelta(seconds=2), + # non_retryable_error_types=["ValueError"], + ), + ) +``` + + + +## How to Heartbeat an Activity {#activity-heartbeats} + +An [Activity Heartbeat](/activities#activity-heartbeat) is a ping from the [Worker Process](/workers#worker-process) that is executing the Activity to the [Temporal Cluster](/clusters). +Each Heartbeat informs the Temporal Cluster that the [Activity Execution](/activities#activity-execution) is making progress and the Worker has not crashed. +If the Cluster does not receive a Heartbeat within a [Heartbeat Timeout](/activities#heartbeat-timeout) time period, the Activity will be considered failed and another [Activity Task Execution](/workers#activity-task-execution) may be scheduled according to the Retry Policy. + +Heartbeats may not always be sent to the Cluster—they may be [throttled](/activities#throttling) by the Worker. + +Activity Cancellations are delivered to Activities from the Cluster when they Heartbeat. Activities that don't Heartbeat can't receive a Cancellation. +Heartbeat throttling may lead to Cancellation getting delivered later than expected. + +Heartbeats can contain a `details` field describing the Activity's current progress. +If an Activity gets retried, the Activity can access the `details` from the last Heartbeat that was sent to the Cluster. + +To Heartbeat an Activity Execution in Python, use the [`heartbeat()`](https://python.temporal.io/temporalio.activity.html#heartbeat) API. + +```python +@activity.defn +async def your_activity_definition() -> str: + activity.heartbeat("heartbeat details!") +``` + +In addition to obtaining cancellation information, Heartbeats also support detail data that persists on the server for retrieval during Activity retry. +If an Activity calls `heartbeat(123, 456)` and then fails and is retried, `heartbeat_details` returns an iterable containing `123` and `456` on the next Run. + +#### How to set a Heartbeat Timeout {#heartbeat-timeout} + +A [Heartbeat Timeout](/activities#heartbeat-timeout) works in conjunction with [Activity Heartbeats](/activities#activity-heartbeat). + +[`heartbeat_timeout`](https://python.temporal.io/temporalio.worker.StartActivityInput.html#heartbeat_timeout) is a class variable for the [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) function used to set the maximum time between Activity Heartbeats. + +```python +workflow.start_activity( + activity="your-activity", + schedule_to_close_timeout=timedelta(seconds=5), + heartbeat_timeout=timedelta(seconds=1), +) +``` + +`execute_activity()` is a shortcut for [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) that waits on its result. + +To get just the handle to wait and cancel separately, use `start_activity()`. `execute_activity()` should be used in most cases unless advanced task capabilities are needed. + +```python +workflow.execute_activity( + activity="your-activity", + name, + schedule_to_close_timeout=timedelta(seconds=5), + heartbeat_timeout=timedelta(seconds=1), +) +``` diff --git a/docs/dev-guide/python/features.mdx b/docs/dev-guide/python/features.mdx deleted file mode 100644 index d4aef15d43..0000000000 --- a/docs/dev-guide/python/features.mdx +++ /dev/null @@ -1,1292 +0,0 @@ ---- -id: features -title: Features - Python SDK feature guide -sidebar_label: Features -sidebar_position: 5 -description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. -toc_max_heading_level: 5 -keywords: - - activity - - child workflow - - client - - code sample - - continue-as-new - - cron - - developer-guide - - developer-guide-doc-type - - dynamic activity - - dynamic query - - dynamic signal - - dynamic workflow - - explanation - - guide-context - - how-to - - parent close policy - - python - - python sdk - - query - - retry policy - - schedule - - scheduled workflow execution - - schedules - - sdk - - signal - - signal with start - - sleep - - timeout - - timer - - timers - - update - - workflow - - workflow-execution -tags: - - activity - - child-workflow - - client - - code-sample - - continue-as-new - - cron - - developer-guide - - developer-guide-doc-type - - dynamic-activity - - dynamic-query - - dynamic-signal - - dynamic-workflow - - explanation - - guide-context - - how-to - - parent-close-policy - - python - - python-sdk - - query - - retry-policy - - schedule - - scheduled-workflow-execution - - schedules - - sdk - - signal - - signal-with-start - - sleep - - timeout - - timer - - timers - - update - - workflow - - workflow-execution ---- - -The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. - -In this section you can find the following: - -- [How to develop Signals](#signals) -- [How to develop Queries](#queries) -- [How to start a Child Workflow Execution](#child-workflows) -- [How to start a Temporal Cron Job](#temporal-cron-jobs) -- [How to use Continue-As-New](#continue-as-new) -- [How to set Workflow timeouts & retries](#workflow-timeouts) -- [How to set Activity timeouts & retries](#activity-timeouts) -- [How to Heartbeat an Activity](#activity-heartbeats) -- [How to Asynchronously complete an Activity](#asynchronous-activity-completion) -- [How to Schedule a Workflow](#schedule-a-workflow) -- [How to use a Temporal Cron Job](#temporal-cron-jobs) -- [How to use Start Delay](#start-delay) - -## How to develop with Signals {#signals} - -A [Signal](/workflows#signal) is a message sent to a running Workflow Execution. - -Signals are defined in your code and handled in your Workflow Definition. -Signals can be sent to Workflow Executions from a Temporal Client or from another Workflow Execution. - -A Signal has a name and can have arguments. - -- The name, also called a Signal type, is a string. -- The arguments must be serializable. - To define a Signal, set the Signal decorator [`@workflow.signal`](https://python.temporal.io/temporalio.workflow.html#signal) on the Signal function inside your Workflow. - -Non-dynamic methods can only have positional arguments. -Temporal suggests taking a single argument that is an object or data class of fields that can be added to as needed. - -Return values from Signal methods are ignored. - -**Customize names** - -You can have a name parameter to customize the Signal's name, otherwise it defaults to the name of the Signal method. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... - @workflow.signal - async def submit_greeting(self, name: str) -> None: - await self._pending_greetings.put(name) - - @workflow.signal - def exit(self) -> None: -# ... - @workflow.signal(name="Custom Signal Name") - async def custom_signal(self, name: str) -> None: - await self._pending_greetings.put(name) -``` - -Workflows listen for Signals by the Signal's name. - -To send a Signal to the Workflow, use the [signal](https://python.temporal.io/temporalio.client.WorkflowHandle.html#signal) method from the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -# ... -# ... - await handle.signal(GreetingWorkflow.submit_greeting, "User 1") -``` - -### How to send a Signal from a Temporal Client {#send-signal-from-client} - -When a Signal is sent successfully from the Temporal Client, the [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the Event History of the Workflow that receives the Signal. - -To send a Signal from the Client, use the [signal()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#signal) function on the Workflow handle. - -To get the Workflow handle, you can use any of the following options. - -- Use the [get_workflow_handle()](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle) method. -- Use the [get_workflow_handle_for()](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle_for) method to get a type-safe Workflow handle by its Workflow Id. -- Use the [start_workflow()](https://python.temporal.io/temporalio.client.Client.html#start_workflow) to start a Workflow and return its handle. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -# ... -# ... - client = await Client.connect("localhost:7233") - handle = await client.start_workflow( - GreetingWorkflow.run, - id="your-greeting-workflow", - task_queue="signal-tq", - ) - await handle.signal(GreetingWorkflow.submit_greeting, "User 1") -``` - -### How to send a Signal from a Workflow {#send-signal-from-workflow} - -A Workflow can send a Signal to another Workflow, in which case it's called an _External Signal_. - -When an External Signal is sent: - -- A [SignalExternalWorkflowExecutionInitiated](/references/events#signalexternalworkflowexecutioninitiated) Event appears in the sender's Event History. -- A [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the recipient's Event History. - -Use [`get_external_workflow_handle_for`](https://python.temporal.io/temporalio.workflow.html#get_external_workflow_handle_for) to get a typed Workflow handle to an existing Workflow by its identifier. -Use [`get_external_workflow_handle`](https://python.temporal.io/temporalio.workflow.html#get_external_workflow_handle) when you don't know the type of the other Workflow. - -:::note - -The Workflow Type passed is only for type annotations and not for validation. - -::: - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn -class WorkflowB: - @workflow.run - async def run(self) -> None: - handle = workflow.get_external_workflow_handle_for(WorkflowA.run, "workflow-a") - await handle.signal(WorkflowA.your_signal, "signal argument") -``` - -### How to Signal-With-Start {#signal-with-start} - -Signal-With-Start is used from the Client. -It takes a Workflow Id, Workflow arguments, a Signal name, and Signal arguments. - -If there's a Workflow running with the given Workflow Id, it will be signaled. If there isn't, a new Workflow will be started and immediately signaled. - -To send a Signal-With-Start in Python, use the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) method and pass the `start_signal` argument with the name of your Signal. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -# ... -# ... -async def main(): - client = await Client.connect("localhost:7233") - await client.start_workflow( - GreetingWorkflow.run, - id="your-signal-with-start-workflow", - task_queue="signal-tq", - start_signal="submit_greeting", - start_signal_args=["User Signal with Start"], - ) -``` - -## How to develop with Queries {#queries} - -A [Query](/workflows#query) is a synchronous operation that is used to get the state of a Workflow Execution. - -### How to define a Query {#define-query} - -A Query has a name and can have arguments. - -- The name, also called a Query type, is a string. -- The arguments must be [serializable](/dataconversion). - -To define a Query, set the Query decorator [`@workflow.query`](https://python.temporal.io/temporalio.workflow.html#query) on the Query function inside your Workflow. - -**Customize names** - -You can have a name parameter to customize the Query's name, otherwise it defaults to the name of the Query method. - -:::note - -You can either set the `name` or the `dynamic` parameter in a Query's decorator, but not both. - -::: - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.query - def greeting(self) -> str: - return self._greeting -``` - -### How to handle a Query {#handle-query} - -Queries are handled by your Workflow. - -Don’t include any logic that causes [Command](/workflows#command) generation within a Query handler (such as executing Activities). -Including such logic causes unexpected behavior. - -To send a Query to the Workflow, use the [`query`](https://python.temporal.io/temporalio.client.WorkflowHandle.html#query) method from the [`WorkflowHandle`](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - - -# ... - result = await handle.query(GreetingWorkflow.greeting) -``` - -### How to send a Query {#send-query} - -Queries are sent from a Temporal Client. - -To send a Query to a Workflow Execution from Client code, use the `query()` method on the Workflow handle. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - result = await handle.query(GreetingWorkflow.greeting) -``` - -## How to develop with Updates {#updates} - -An [Update](/workflows#update) is an operation that can mutate the state of a Workflow Execution and return a response. - -### How to define an Update {#define-update} - -Workflow Updates handlers are methods in your Workflow Definition designed to handle updates. -These updates can be triggered during the lifecycle of a Workflow Execution. - -**Define an Update Handler** - -To define an update handler, use the [@workflow.update](https://python.temporal.io/temporalio.workflow.html#update) decorator on a method within your Workflow. This decorator can be applied to both asynchronous and synchronous methods. - -- **Decorator Usage:** Apply `@workflow.update` to the method intended to handle updates. -- **Overriding:** If a method with this decorator is overridden, the overriding method should also be decorated with `@workflow.update`. -- **Validator Method:** Optionally, you can define a validator method for the update handler. This validator is specified using `@update_handler_method_name.validator` and is invoked before the update handler. -- **Method Parameters:** Update handlers should only use positional parameters. For non-dynamic methods, it's recommended to use a single parameter that is an object or data class, which allows for future expansion of fields. -- **Return Values:** The update handler can return a serializable value. This value is sent back to the caller of the update. - -```python -# ... - @workflow.update - async def update_workflow_status(self) -> str: - self.is_complete = True - return "Workflow status updated" -``` - -### How to send an Update from a Temporal Client {#send-update-from-client} - -To send a Workflow Update from a Temporal Client, call the [execute_update](https://python.temporal.io/temporalio.client.WorkflowHandle.html#execute_update) method on the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. - -```python -# ... - update_result = await handle.execute_update( - HelloWorldWorkflow.update_workflow_status - ) - print(f"Update Result: {update_result}") -``` - -## What is a Dynamic Handler {#dynamic-handler} - -Temporal supports Dynamic Workflows, Activities, Signals, and Queries. -These are unnamed handlers that are invoked if no other statically defined handler with the given name exists. - -Dynamic Handlers provide flexibility to handle cases where the names of Workflows, Activities, Signals, or Queries aren't known at run time. - -:::caution - -Dynamic Handlers should be used judiciously as a fallback mechanism rather than the primary approach. -Overusing them can lead to maintainability and debugging issues down the line. - -Instead, Workflows, Activities, Signals, and Queries should be defined statically whenever possible, with clear names that indicate their purpose. -Use static definitions as the primary way of structuring your Workflows. - -Reserve Dynamic Handlers for cases where the handler names are not known at compile time and need to be looked up dynamically at runtime. -They are meant to handle edge cases and act as a catch-all, not as the main way of invoking logic. - -::: - -### How to set a Dynamic Workflow {#set-a-dynamic-workflow} - -A Dynamic Workflow in Temporal is a Workflow that is invoked dynamically at runtime if no other Workflow with the same name is registered. -A Workflow can be made dynamic by adding `dynamic=True` to the `@workflow.defn` decorator. -You must register the Workflow with the [Worker](https://python.temporal.io/temporalio.worker.html) before it can be invoked. - -The Workflow Definition must then accept a single argument of type `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn(dynamic=True) -class DynamicWorkflow: - @workflow.run - async def run(self, args: Sequence[RawValue]) -> str: - name = workflow.payload_converter().from_payload(args[0].payload, str) - return await workflow.execute_activity( - default_greeting, - YourDataClass("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set a Dynamic Activity {#set-a-dynamic-activity} - -A Dynamic Activity in Temporal is an Activity that is invoked dynamically at runtime if no other Activity with the same name is registered. -An Activity can be made dynamic by adding `dynamic=True` to the `@activity.defn` decorator. -You must register the Activity with the [Worker](https://python.temporal.io/temporalio.worker.html) before it can be invoked. - -The Activity Definition must then accept a single argument of type `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.activity.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -@activity.defn(dynamic=True) -async def dynamic_greeting(args: Sequence[RawValue]) -> str: - arg1 = activity.payload_converter().from_payload(args[0].payload, YourDataClass) - return ( - f"{arg1.greeting}, {arg1.name}!\nActivity Type: {activity.info().activity_type}" - ) -# ... -@workflow.defn -class GreetingWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - "unregistered_activity", - YourDataClass("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set a Dynamic Signal {#set-a-dynamic-signal} - -A Dynamic Signal in Temporal is a Signal that is invoked dynamically at runtime if no other Signal with the same input is registered. -A Signal can be made dynamic by adding `dynamic=True` to the `@signal.defn` decorator. - -The Signal Handler should accept `self`, a string input, and a `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.signal(dynamic=True) - async def dynamic_signal(self, name: str, args: Sequence[RawValue]) -> None: - await self._pending_greetings.put(name) -``` - -### How to set a Dynamic Query {#set-a-dynamic-query} - -A Dynamic Query in Temporal is a Query that is invoked dynamically at runtime if no other Query with the same name is registered. -A Query can be made dynamic by adding `dynamic=True` to the `@query.defn` decorator. - -The Query Handler should accept `self`, a string name, and a `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.query(dynamic=True) - def dynamic_query(self, input: str, args: Sequence[RawValue]) -> str: - return self._greeting -``` - -## Workflow timeouts {#workflow-timeouts} - -Each Workflow timeout controls the maximum duration of a different aspect of a Workflow Execution. - -Workflow timeouts are set when [starting the Workflow Execution](#workflow-timeouts). - -- **[Workflow Execution Timeout](/workflows#workflow-execution-timeout)** - restricts the maximum amount of time that a single Workflow Execution can be executed. -- **[Workflow Run Timeout](/workflows#workflow-run-timeout):** restricts the maximum amount of time that a single Workflow Run can last. -- **[Workflow Task Timeout](/workflows#workflow-task-timeout):** restricts the maximum amount of time that a Worker can execute a Workflow Task. - -Set the timeout to either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. - -Available timeouts are: - -- `execution_timeout` -- `run_timeout` -- `task_timeout` - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - result = await client.execute_workflow( - YourWorkflow.run, - "your timeout argument", - id="your-workflow-id", - task_queue="your-task-queue", - # Set Workflow Timeout duration - execution_timeout=timedelta(seconds=2), - # run_timeout=timedelta(seconds=2), - # task_timeout=timedelta(seconds=2), - ) -``` - -### Workflow retries {#workflow-retries} - -A Retry Policy can work in cooperation with the timeouts to provide fine controls to optimize the execution experience. - -Use a [Retry Policy](/retry-policies) to retry a Workflow Execution in the event of a failure. - -Workflow Executions do not retry by default, and Retry Policies should be used with Workflow Executions only in certain situations. - -Set the Retry Policy to either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - handle = await client.execute_workflow( - YourWorkflow.run, - "your retry policy argument", - id="your-workflow-id", - task_queue="your-task-queue", - retry_policy=RetryPolicy(maximum_interval=timedelta(seconds=2)), - ) -``` - -## How to set Activity timeouts {#activity-timeouts} - -Each Activity timeout controls the maximum duration of a different aspect of an Activity Execution. - -The following timeouts are available in the Activity Options. - -- **[Schedule-To-Close Timeout](/activities#schedule-to-close-timeout):** is the maximum amount of time allowed for the overall [Activity Execution](/activities#activity-execution). -- **[Start-To-Close Timeout](/activities#start-to-close-timeout):** is the maximum time allowed for a single [Activity Task Execution](/workers#activity-task-execution). -- **[Schedule-To-Start Timeout](/activities#schedule-to-start-timeout):** is the maximum amount of time that is allowed from when an [Activity Task](/workers#activity-task) is scheduled to when a [Worker](/workers#worker) starts that Activity Task. - -An Activity Execution must have either the Start-To-Close or the Schedule-To-Close Timeout set. - -Activity options are set as keyword arguments after the Activity arguments. - -Available timeouts are: - -- schedule_to_close_timeout -- schedule_to_start_timeout -- start_to_close_timeout - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - activity_timeout_result = await workflow.execute_activity( - your_activity, - YourParams(greeting, "Activity Timeout option"), - # Activity Execution Timeout - start_to_close_timeout=timedelta(seconds=10), - # schedule_to_start_timeout=timedelta(seconds=10), - # schedule_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set an Activity Retry Policy {#activity-retries} - -A Retry Policy works in cooperation with the timeouts to provide fine controls to optimize the execution experience. - -Activity Executions are automatically associated with a default [Retry Policy](/retry-policies) if a custom one is not provided. - -To create an Activity Retry Policy in Python, set the [RetryPolicy](https://python.temporal.io/temporalio.common.RetryPolicy.html) class within the [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) or [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) function. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio.common import RetryPolicy -# ... - activity_result = await workflow.execute_activity( - your_activity, - YourParams(greeting, "Retry Policy options"), - start_to_close_timeout=timedelta(seconds=10), - # Retry Policy - retry_policy=RetryPolicy( - backoff_coefficient=2.0, - maximum_attempts=5, - initial_interval=timedelta(seconds=1), - maximum_interval=timedelta(seconds=2), - # non_retryable_error_types=["ValueError"], - ), - ) -``` - -## How to Heartbeat an Activity {#activity-heartbeats} - -An [Activity Heartbeat](/activities#activity-heartbeat) is a ping from the [Worker Process](/workers#worker-process) that is executing the Activity to the [Temporal Cluster](/clusters). -Each Heartbeat informs the Temporal Cluster that the [Activity Execution](/activities#activity-execution) is making progress and the Worker has not crashed. -If the Cluster does not receive a Heartbeat within a [Heartbeat Timeout](/activities#heartbeat-timeout) time period, the Activity will be considered failed and another [Activity Task Execution](/workers#activity-task-execution) may be scheduled according to the Retry Policy. - -Heartbeats may not always be sent to the Cluster—they may be [throttled](/activities#throttling) by the Worker. - -Activity Cancellations are delivered to Activities from the Cluster when they Heartbeat. Activities that don't Heartbeat can't receive a Cancellation. -Heartbeat throttling may lead to Cancellation getting delivered later than expected. - -Heartbeats can contain a `details` field describing the Activity's current progress. -If an Activity gets retried, the Activity can access the `details` from the last Heartbeat that was sent to the Cluster. - -To Heartbeat an Activity Execution in Python, use the [`heartbeat()`](https://python.temporal.io/temporalio.activity.html#heartbeat) API. - -```python -@activity.defn -async def your_activity_definition() -> str: - activity.heartbeat("heartbeat details!") -``` - -In addition to obtaining cancellation information, Heartbeats also support detail data that persists on the server for retrieval during Activity retry. -If an Activity calls `heartbeat(123, 456)` and then fails and is retried, `heartbeat_details` returns an iterable containing `123` and `456` on the next Run. - -#### How to set a Heartbeat Timeout {#heartbeat-timeout} - -A [Heartbeat Timeout](/activities#heartbeat-timeout) works in conjunction with [Activity Heartbeats](/activities#activity-heartbeat). - -[`heartbeat_timeout`](https://python.temporal.io/temporalio.worker.StartActivityInput.html#heartbeat_timeout) is a class variable for the [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) function used to set the maximum time between Activity Heartbeats. - -```python -workflow.start_activity( - activity="your-activity", - schedule_to_close_timeout=timedelta(seconds=5), - heartbeat_timeout=timedelta(seconds=1), -) -``` - -`execute_activity()` is a shortcut for [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) that waits on its result. - -To get just the handle to wait and cancel separately, use `start_activity()`. `execute_activity()` should be used in most cases unless advanced task capabilities are needed. - -```python -workflow.execute_activity( - activity="your-activity", - name, - schedule_to_close_timeout=timedelta(seconds=5), - heartbeat_timeout=timedelta(seconds=1), -) -``` - -## How to asynchronously complete an Activity {#asynchronous-activity-completion} - -[Asynchronous Activity Completion](/activities#asynchronous-activity-completion) enables the Activity Function to return without the Activity Execution completing. - -There are three steps to follow: - -1. The Activity provides the external system with identifying information needed to complete the Activity Execution. - Identifying information can be a [Task Token](/activities#task-token), or a combination of Namespace, Workflow Id, and Activity Id. -2. The Activity Function completes in a way that identifies it as waiting to be completed by an external system. -3. The Temporal Client is used to Heartbeat and complete the Activity. - -To mark an Activity as completing asynchronously, do the following inside the Activity. - -```python -# Capture token for later completion -captured_token = activity.info().task_token -activity.raise_complete_async() -``` - -To update an Activity outside the Activity, use the [get_async_activity_handle()](https://python.temporal.io/temporalio.client.Client.html#get_async_activity_handle) method to get the handle of the Activity. - -```python -handle = my_client.get_async_activity_handle(task_token=captured_token) -``` - -Then, on that handle, you can call the results of the Activity, `heartbeat`, `complete`, `fail`, or `report_cancellation` method to update the Activity. - -```python -await handle.complete("Completion value.") -``` - -## Cancel an Activity from a Workflow {#cancel-an-activity} - -Canceling an Activity from within a Workflow requires that the Activity Execution sends Heartbeats and sets a Heartbeat Timeout. -If the Heartbeat is not invoked, the Activity cannot receive a cancellation request. -When any non-immediate Activity is executed, the Activity Execution should send Heartbeats and set a [Heartbeat Timeout](/activities#heartbeat-timeout) to ensure that the server knows it is still working. - -When an Activity is canceled, an error is raised in the Activity at the next available opportunity. -If cleanup logic needs to be performed, it can be done in a `finally` clause or inside a caught cancel error. -However, for the Activity to appear canceled the exception needs to be re-raised. - -:::note - -Unlike regular Activities, [Local Activities](/activities#local-activity) can be canceled if they don't send Heartbeats. -Local Activities are handled locally, and all the information needed to handle the cancellation logic is available in the same Worker process. - -::: - -To cancel an Activity from a Workflow Execution, call the [cancel()](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.cancel) method on the Activity handle that is returned from [start_activity()](https://python.temporal.io/temporalio.workflow.html#start_activity). - -```python -@activity.defn -async def cancellable_activity(input: ComposeArgsInput) -> NoReturn: - try: - while True: - print("Heartbeating cancel activity") - await asyncio.sleep(0.5) - activity.heartbeat("some details") - except asyncio.CancelledError: - print("Activity cancelled") - raise - - -@activity.defn -async def run_activity(input: ComposeArgsInput): - print("Executing activity") - return input.arg1 + input.arg2 - -@workflow.defn - class GreetingWorkflow: - @workflow.run - async def run(self, input: ComposeArgsInput) -> None: - activity_handle = workflow.start_activity( - cancellable_activity, - ComposeArgsInput(input.arg1, input.arg2), - start_to_close_timeout=timedelta(minutes=5), - heartbeat_timeout=timedelta(seconds=30), - ) - - await asyncio.sleep(3) - activity_handle.cancel() -``` - -:::note - -The Activity handle is a Python task. -By calling `cancel()`, you're essentially requesting the task to be canceled. - -::: - -## How to interrupt a Workflow Execution {#interrupt-a-workflow-execution} - -You can interrupt a Workflow Execution in one of the following ways: - -- [Cancel](#cancel) -- [Terminate](#terminate) - -The following are the main differences between canceling and terminating a Workflow in Temporal: - -##### Cancel - -Canceling a Workflow provides a graceful way to stop Workflow Execution. -This action resembles sending a `SIGTERM` to a process. - -- The system records a `WorkflowExecutionCancelRequested` event in the Workflow History. -- A Workflow Task gets scheduled to process the cancelation. -- The Workflow code can handle the cancelation and execute any cleanup logic. -- The system doesn't forcefully stop the Workflow. - -For more information, see [How to cancel a Workflow Execution](#cancel-a-workflow-execution). - -##### Terminate - -Terminating a Workflow forcefully stops Workflow Execution. -This action resembles killing a process. - -- The system records a `WorkflowExecutionTerminated` event in the Workflow History. -- The termination forcefully and immediately stops the Workflow Execution. -- The Workflow code gets no chance to handle termination. -- A Workflow Task doesn't get scheduled. - -For more information, see [How to terminate a Workflow Execution](#terminate-a-workflow-execution). - -##### Summary - -In summary: - -- Canceling provides a graceful way to stop the Workflow and allows it to handle cancelation logic. -- Termination forcefully stops the Workflow and prevents any further events. - -In most cases, canceling is preferable because it allows the Workflow to finish gracefully. -Terminate only if the Workflow is stuck and cannot be canceled normally. - -### How to cancel a Workflow Execution in Python {#cancel-a-workflow-execution} - -To cancel a Workflow Execution in Python, use the [cancel()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#cancel) function on the Workflow handle. - -```python -await client.get_workflow_handle("your_workflow_id").cancel() -``` - -### How to terminate a Workflow Execution in Python {#terminate-a-workflow-execution} - -To terminate a Workflow Execution in Python, use the [terminate()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#terminate) function on the Workflow handle. - -```python -await client.get_workflow_handle("your_workflow_id").terminate() -``` - -## How to start a Child Workflow Execution {#child-workflows} - -A [Child Workflow Execution](/encyclopedia/child-workflows) is a Workflow Execution that is scheduled from within another Workflow using a Child Workflow API. - -When using a Child Workflow API, Child Workflow related Events ([StartChildWorkflowExecutionInitiated](/references/events#startchildworkflowexecutioninitiated), [ChildWorkflowExecutionStarted](/references/events#childworkflowexecutionstarted), [ChildWorkflowExecutionCompleted](/references/events#childworkflowexecutioncompleted), etc...) are logged in the Workflow Execution Event History. - -Always block progress until the [ChildWorkflowExecutionStarted](/references/events#childworkflowexecutionstarted) Event is logged to the Event History to ensure the Child Workflow Execution has started. -After that, Child Workflow Executions may be abandoned using the default _Abandon_ [Parent Close Policy](/encyclopedia/child-workflows#parent-close-policy) set in the Child Workflow Options. - -To be sure that the Child Workflow Execution has started, first call the Child Workflow Execution method on the instance of Child Workflow future, which returns a different future. - -Then get the value of an object that acts as a proxy for a result that is initially unknown, which is what waits until the Child Workflow Execution has spawned. - -To spawn a Child Workflow Execution in Python, use the [`execute_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#execute_child_workflow) function which starts the Child Workflow and waits for completion or -use the [`start_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#start_child_workflow) function to start a Child Workflow and return its handle. -This is useful if you want to do something after it has only started, or to get the Workflow/Run ID, or to be able to signal it while running. - -:::note - -`execute_child_workflow()` is a helper function for `start_child_workflow()` plus `await handle`. - -::: - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn -class ComposeGreetingWorkflow: - @workflow.run - async def run(self, input: ComposeGreetingInput) -> str: - return f"{input.greeting}, {input.name}!" - - -@workflow.defn -class GreetingWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_child_workflow( - ComposeGreetingWorkflow.run, - ComposeGreetingInput("Hello", name), - id="hello-child-workflow-workflow-child-id", -# ... - ) -``` - -#### How to set a Parent Close Policy {#parent-close-policy} - -A [Parent Close Policy](/encyclopedia/child-workflows#parent-close-policy) determines what happens to a Child Workflow Execution if its Parent changes to a Closed status (Completed, Failed, or Timed Out). - -The default Parent Close Policy option is set to terminate the Child Workflow Execution. - -Set the `parent_close_policy` parameter inside the [`start_child_workflow`](https://python.temporal.io/temporalio.workflow.html#start_child_workflow) function or the [`execute_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#execute_child_workflow) function to specify the behavior of the Child Workflow when the Parent Workflow closes. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio.workflow import ParentClosePolicy -# ... -# ... -@workflow.defn -class ComposeGreetingWorkflow: - @workflow.run - async def run(self, input: ComposeGreetingInput) -> str: - return f"{input.greeting}, {input.name}!" - - -@workflow.defn -class GreetingWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_child_workflow( - ComposeGreetingWorkflow.run, - ComposeGreetingInput("Hello", name), - id="hello-child-workflow-workflow-child-id", - parent_close_policy=ParentClosePolicy.ABANDON, - ) -``` - -## How to Continue-As-New {#continue-as-new} - -[Continue-As-New](/workflows#continue-as-new) enables a Workflow Execution to close successfully and create a new Workflow Execution in a single atomic operation if the number of Events in the Event History is becoming too large. -The Workflow Execution spawned from the use of Continue-As-New has the same Workflow Id, a new Run Id, and a fresh Event History and is passed all the appropriate parameters. - -To Continue-As-New in Python, call the [`continue_as_new()`](https://python.temporal.io/temporalio.workflow.html#continue_as_new) function from inside your Workflow, which will stop the Workflow immediately and Continue-As-New. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn -class LoopingWorkflow: - @workflow.run - async def run(self, iteration: int) -> None: - if iteration == 5: - return - await asyncio.sleep(10) - workflow.continue_as_new(iteration + 1) -``` - -## What is a Timer? {#timers} - -A Workflow can set a durable timer for a fixed time period. -In some SDKs, the function is called `sleep()`, and in others, it's called `timer()`. - -A Workflow can sleep for months. -Timers are persisted, so even if your Worker or Temporal Cluster is down when the time period completes, as soon as your Worker and Cluster are back up, the `sleep()` call will resolve and your code will continue executing. - -Sleeping is a resource-light operation: it does not tie up the process, and you can run millions of Timers off a single Worker. - -To set a Timer in Python, call the [`asyncio.sleep()`](https://docs.python.org/3/library/asyncio-task.html#sleeping) function and pass the duration in seconds you want to wait before continuing. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - await asyncio.sleep(10) -``` - -## How to Schedule a Workflow {#schedule-a-workflow} - -Scheduling Workflows is a crucial aspect of any automation process, especially when dealing with time-sensitive tasks. By scheduling a Workflow, you can automate repetitive tasks, reduce the need for manual intervention, and ensure timely execution of your business processes - -Use any of the following action to help Schedule a Workflow Execution and take control over your automation process. - -### How to Create a Scheduled Workflow {#create} - -The create action enables you to create a new Schedule. When you create a new Schedule, a unique Schedule ID is generated, which you can use to reference the Schedule in other Schedule commands. - -To create a Scheduled Workflow Execution in Python, use the [create_schedule()](https://python.temporal.io/temporalio.client.Client.html#create_schedule) -asynchronous method on the Client. -Then pass the Schedule ID and the Schedule object to the method to create a Scheduled Workflow Execution. -Set the `action` parameter to `ScheduleActionStartWorkflow` to start a Workflow Execution. -Optionally, you can set the `spec` parameter to `ScheduleSpec` to specify the schedule or set the `intervals` parameter to `ScheduleIntervalSpec` to specify the interval. -Other options include: `cron_expressions`, `skip`, `start_at`, and `jitter`. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - await client.create_schedule( - "workflow-schedule-id", - Schedule( - action=ScheduleActionStartWorkflow( - YourSchedulesWorkflow.run, - "my schedule arg", - id="schedules-workflow-id", - task_queue="schedules-task-queue", - ), - spec=ScheduleSpec( - intervals=[ScheduleIntervalSpec(every=timedelta(minutes=2))] - ), - state=ScheduleState(note="Here's a note on my Schedule."), - ), - ) -``` - -### How to Backfill a Scheduled Workflow {#backfill} - -The backfill action executes Actions ahead of their specified time range. This command is useful when you need to execute a missed or delayed Action, or when you want to test the Workflow before its scheduled time. - -To Backfill a Scheduled Workflow Execution in Python, use the [backfill()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#backfill) asynchronous -method on the Schedule Handle. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -import asyncio -from datetime import datetime, timedelta - -from temporalio.client import Client, ScheduleBackfill, ScheduleOverlapPolicy - - - -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - now = datetime.utcnow() - ( - await handle.backfill( - ScheduleBackfill( - start_at=now - timedelta(minutes=10), - end_at=now - timedelta(minutes=9), - overlap=ScheduleOverlapPolicy.ALLOW_ALL, - ), - ), - ) -``` - -### How to Delete a Scheduled Workflow {#delete} - -The delete action enables you to delete a Schedule. When you delete a Schedule, it does not affect any Workflows that were started by the Schedule. - -To delete a Scheduled Workflow Execution in Python, use the [delete()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#delete) asynchronous method on the Schedule Handle. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - - - -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - await handle.delete() -``` - -### How to Describe a Scheduled Workflow {#describe} - -The describe action shows the current Schedule configuration, including information about past, current, and future Workflow Runs. This command is helpful when you want to get a detailed view of the Schedule and its associated Workflow Runs. - -To describe a Scheduled Workflow Execution in Python, use the [describe()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#delete) asynchronous method on the Schedule Handle. -You can get a complete list of the attributes of the Scheduled Workflow Execution from the [ScheduleDescription](https://python.temporal.io/temporalio.client.ScheduleDescription.html) class. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - desc = await handle.describe() - - print(f"Returns the note: {desc.schedule.state.note}") -``` - -### How to List a Scheduled Workflow {#list} - -The list action lists all the available Schedules. This command is useful when you want to view a list of all the Schedules and their respective Schedule IDs. - -To list all schedules, use the [list_schedules()](https://python.temporal.io/temporalio.client.Client.html#list_schedules) asynchronous method on the Client. -If a schedule is added or deleted, it may not be available in the list immediately. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main() -> None: - client = await Client.connect("localhost:7233") - async for schedule in await client.list_schedules(): - print(f"List Schedule Info: {schedule.info}.") -``` - -### How to Pause a Scheduled Workflow {#pause} - -The pause action enables you to pause and unpause a Schedule. When you pause a Schedule, all the future Workflow Runs associated with the Schedule are temporarily stopped. This command is useful when you want to temporarily halt a Workflow due to maintenance or any other reason. - -To pause a Scheduled Workflow Execution in Python, use the [pause()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#pause) asynchronous method on the Schedule Handle. -You can pass a `note` to the `pause()` method to provide a reason for pausing the schedule. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - await handle.pause(note="Pausing the schedule for now") -``` - -### How to Trigger a Scheduled Workflow {#trigger} - -The trigger action triggers an immediate action with a given Schedule. By default, this action is subject to the Overlap Policy of the Schedule. This command is helpful when you want to execute a Workflow outside of its scheduled time. - -To trigger a Scheduled Workflow Execution in Python, use the [trigger()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#trigger) asynchronous method on the Schedule Handle. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - await handle.trigger() -``` - -### How to Update a Scheduled Workflow {#update} - -The update action enables you to update an existing Schedule. This command is useful when you need to modify the Schedule's configuration, such as changing the start time, end time, or interval. - -Create a function that takes `ScheduleUpdateInput` and returns `ScheduleUpdate`. -To update a Schedule, use a callback to build the update from the description. -The following example updates the Schedule to use a new argument. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - async def update_schedule_simple(input: ScheduleUpdateInput) -> ScheduleUpdate: - schedule_action = input.description.schedule.action - - if isinstance(schedule_action, ScheduleActionStartWorkflow): - schedule_action.args = ["my new schedule arg"] - return ScheduleUpdate(schedule=input.description.schedule) -``` - -## How to use Temporal Cron Jobs {#temporal-cron-jobs} - -A [Temporal Cron Job](/workflows#temporal-cron-job) is the series of Workflow Executions that occur when a Cron Schedule is provided in the call to spawn a Workflow Execution. - -A Cron Schedule is provided as an option when the call to spawn a Workflow Execution is made. - -You can set each Workflow to repeat on a schedule with the `cron_schedule` option from either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - result = await client.execute_workflow( - CronWorkflow.run, - id="your-workflow-id", - task_queue="your-task-queue", - cron_schedule="* * * * *", - ) - print(f"Results: {result}") -``` - -## How to use Start Delay {#start-delay} - -Use the `start_delay` to schedule a Workflow Execution at a specific one-time future point rather than on a recurring schedule. - -Use the `start_delay` option in either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods in the Client. - -```python -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - start_delay=timedelta(hours=1, minutes=20, seconds=30) - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` diff --git a/docs/dev-guide/python/foundations.mdx b/docs/dev-guide/python/foundations.mdx index ef51defad1..94f3daf5fe 100644 --- a/docs/dev-guide/python/foundations.mdx +++ b/docs/dev-guide/python/foundations.mdx @@ -188,728 +188,3 @@ You can find a complete list of executable code samples in [Temporal's GitHub re Additionally, several of the [Tutorials](https://learn.temporal.io) are backed by a fully executable template application. - [Python samples library](https://github.com/temporalio/samples-python) - -## How to connect a Temporal Client to a Temporal Cluster {#connect-to-a-dev-cluster} - -A [Temporal Client](/encyclopedia/temporal-sdks#temporal-client) enables you to communicate with the [Temporal Cluster](/clusters). -Communication with a Temporal Cluster includes, but isn't limited to, the following: - -- Starting Workflow Executions. -- Sending Signals to Workflow Executions. -- Sending Queries to Workflow Executions. -- Getting the results of a Workflow Execution. -- Providing an Activity Task Token. - -:::caution - -A Temporal Client cannot be initialized and used inside a Workflow. -However, it is acceptable and common to use a Temporal Client inside an Activity to communicate with a Temporal Cluster. - -::: - -When you are running a Cluster locally (such as the [Temporal CLI](https://docs.temporal.io/cli/server#start-dev)), the number of connection options you must provide is minimal. -Many SDKs default to the local host or IP address and port that Temporalite and [Docker Compose](https://github.com/temporalio/docker-compose) serve (`127.0.0.1:7233`). - -Use the `connect()` method on the Client class to create and connect to a Temporal Client to the Temporal Cluster. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -## How to connect to Temporal Cloud {#connect-to-temporal-cloud} - -When you connect to [Temporal Cloud](/cloud), you need to provide additional connection and client options that include the following: - -- The [Temporal Cloud Namespace Id](/cloud/namespaces#temporal-cloud-namespace-id). -- The [Namespace's gRPC endpoint](/cloud/namespaces#temporal-cloud-grpc-endpoint). - An endpoint listing is available at the [Temporal Cloud Website](https://cloud.temporal.io/namespaces) on each Namespace detail page. - The endpoint contains the Namespace Id and port. -- mTLS CA certificate. -- mTLS private key. - -For more information about managing and generating client certificates for Temporal Cloud, see [How to manage certificates in Temporal Cloud](/cloud/certificates). - -For more information about configuring TLS to secure inter- and intra-network communication for a Temporal Cluster, see [Temporal Customization Samples](https://github.com/temporalio/samples-server). - -Use the `connect()` method on the Client class to create and connect to a Temporal Client to the Temporal Cluster. -Then specify the [TLSConfig](https://python.temporal.io/temporalio.service.TLSConfig.html) arguments to connect to a Temporal Cluster with TLS enabled. -The `client_cert` must be combined with `client_private_key` to authenticate the Client. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client, TLSConfig -# ... -# ... -async def main(): - with open("client-cert.pem", "rb") as f: - client_cert = f.read() - with open("client-private-key.pem", "rb") as f: - client_private_key = f.read() - client = await Client.connect( - "your-custom-namespace.tmprl.cloud:7233", - namespace=".", - tls=TLSConfig( - client_cert=client_cert, - client_private_key=client_private_key, - # domain=domain, # TLS domain - # server_root_ca_cert=server_root_ca_cert, # ROOT CA to validate the server cert - ), - ) -``` - -## How to develop a basic Workflow {#develop-workflows} - -Workflows are the fundamental unit of a Temporal Application, and it all starts with the development of a [Workflow Definition](/workflows#workflow-definition). - -In the Temporal Python SDK programming model, Workflows are defined as classes. - -Specify the `@workflow.defn` decorator on the Workflow class to identify a Workflow. - -Use the `@workflow.run` to mark the entry point method to be invoked. This must be set on one asynchronous method defined on the same class as `@workflow.defn`. Run methods have positional parameters. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to define Workflow parameters {#workflow-parameters} - -Temporal Workflows may have any number of custom parameters. -However, we strongly recommend that objects are used as parameters, so that the object's individual fields may be altered without breaking the signature of the Workflow. -All Workflow Definition parameters must be serializable. - -Workflow parameters are the method parameters of the singular method decorated with `@workflow.run`. -These can be any data type Temporal can convert, including [`dataclasses`](https://docs.python.org/3/library/dataclasses.html) when properly type-annotated. -Technically this can be multiple parameters, but Temporal strongly encourages a single `dataclass` parameter containing all input fields. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from dataclasses import dataclass -# ... -# ... -@dataclass -class YourParams: - greeting: str - name: str -``` - -### How to define Workflow return parameters {#workflow-return-values} - -Workflow return values must also be serializable. -Returning results, returning errors, or throwing exceptions is fairly idiomatic in each language that is supported. -However, Temporal APIs that must be used to get the result of a Workflow Execution will only ever receive one of either the result or the error. - -To return a value of the Workflow, use `return` to return an object. - -To return the results of a Workflow Execution, use either `start_workflow()` or `execute_workflow()` asynchronous methods. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to customize your Workflow Type {#workflow-type} - -Workflows have a Type that are referred to as the Workflow name. - -The following examples demonstrate how to set a custom name for your Workflow Type. - -You can customize the Workflow name with a custom name in the decorator argument. For example, `@workflow.defn(name="your-workflow-name")`. If the name parameter is not specified, the Workflow name defaults to the function name. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How develop Workflow logic {#workflow-logic-requirements} - -Workflow logic is constrained by [deterministic execution requirements](/workflows#deterministic-constraints). -Therefore, each language is limited to the use of certain idiomatic techniques. -However, each Temporal SDK provides a set of APIs that can be used inside your Workflow to interact with external (to the Workflow) application code. - -Workflow code must be deterministic. This means: - -- no threading -- no randomness -- no external calls to processes -- no network I/O -- no global state mutation -- no system date or time - -All API safe for Workflows used in the [`temporalio.workflow`](https://python.temporal.io/temporalio.workflow.html) must run in the implicit [`asyncio` event loop](https://docs.python.org/3/library/asyncio-eventloop.html) and be _deterministic_. - -## How to develop a basic Activity {#develop-activities} - -One of the primary things that Workflows do is orchestrate the execution of Activities. -An Activity is a normal function or method execution that's intended to execute a single, well-defined action (either short or long-running), such as querying a database, calling a third-party API, or transcoding a media file. -An Activity can interact with world outside the Temporal Platform or use a Temporal Client to interact with a Cluster. -For the Workflow to be able to execute the Activity, we must define the [Activity Definition](/activities#activity-definition). - -You can develop an Activity Definition by using the `@activity.defn` decorator. -Register the function as an Activity with a custom name through a decorator argument, for example `@activity.defn(name="your_activity")`. - -:::note - -The Temporal Python SDK supports multiple ways of implementing an Activity: - -- Asynchronously using [`asyncio`](https://docs.python.org/3/library/asyncio.html) -- Synchronously multithreaded using [`concurrent.futures.ThreadPoolExecutor`](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) -- Synchronously multiprocess using [`concurrent.futures.ProcessPoolExecutor`](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and [`multiprocessing.managers.SyncManager`](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.managers.SyncManager) - -Blocking the async event loop in Python would turn your asynchronous program into a synchronous program that executes serially, defeating the entire purpose of using `asyncio`. -This can also lead to potential deadlock, and unpredictable behavior that causes tasks to be unable to execute. -Debugging these issues can be difficult and time consuming, as locating the source of the blocking call might not always be immediately obvious. - -Due to this, consider not make blocking calls from within an asynchronous Activity, or use an async safe library to perform -these actions. -If you must use a blocking library, consider using a synchronous Activity instead. - -::: - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio import activity -# ... -# ... -@activity.defn(name="your_activity") -async def your_activity(input: YourParams) -> str: - return f"{input.greeting}, {input.name}!" -``` - -### How to develop Activity Parameters {#activity-parameters} - -There is no explicit limit to the total number of parameters that an [Activity Definition](/activities#activity-definition) may support. -However, there is a limit to the total size of the data that ends up encoded into a gRPC message Payload. - -A single argument is limited to a maximum size of 2 MB. -And the total size of a gRPC message, which includes all the arguments, is limited to a maximum of 4 MB. - -Also, keep in mind that all Payload data is recorded in the [Workflow Execution Event History](/workflows#event-history) and large Event Histories can affect Worker performance. -This is because the entire Event History could be transferred to a Worker Process with a [Workflow Task](/workers#workflow-task). - - - -Some SDKs require that you pass context objects, others do not. -When it comes to your application data—that is, data that is serialized and encoded into a Payload—we recommend that you use a single object as an argument that wraps the application data passed to Activities. -This is so that you can change what data is passed to the Activity without breaking a function or method signature. - -Activity parameters are the function parameters of the function decorated with `@activity.defn`. -These can be any data type Temporal can convert, including dataclasses when properly type-annotated. -Technically this can be multiple parameters, but Temporal strongly encourages a single dataclass parameter containing all input fields. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio import activity -from your_dataobject_dacx import YourParams - -# ... -# ... -@activity.defn(name="your_activity") -async def your_activity(input: YourParams) -> str: - return f"{input.greeting}, {input.name}!" -``` - -### How to define Activity return values {#activity-return-values} - -All data returned from an Activity must be serializable. - -There is no explicit limit to the amount of data that can be returned by an Activity, but keep in mind that all return values are recorded in a [Workflow Execution Event History](/workflows#event-history). - -An Activity Execution can return inputs and other Activity values. - -The following example defines an Activity that takes a string as input and returns a string. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -@activity.defn(name="your_activity") -async def your_activity(input: YourParams) -> str: - return f"{input.greeting}, {input.name}!" -``` - -### How to customize your Activity Type {#activity-type} - -Activities have a Type that are referred to as the Activity name. -The following examples demonstrate how to set a custom name for your Activity Type. - -You can customize the Activity name with a custom name in the decorator argument. For example, `@activity.defn(name="your-activity")`. -If the name parameter is not specified, the Activity name defaults to the function name. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -@activity.defn(name="your_activity") -async def your_activity(input: YourParams) -> str: - return f"{input.greeting}, {input.name}!" -``` - -## How to start an Activity Execution {#activity-execution} - -Calls to spawn [Activity Executions](/activities#activity-execution) are written within a [Workflow Definition](/workflows#workflow-definition). -The call to spawn an Activity Execution generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command. -This results in the set of three [Activity Task](/workers#activity-task) related Events ([ActivityTaskScheduled](/references/events#activitytaskscheduled), [ActivityTaskStarted](/references/events#activitytaskstarted), and ActivityTask[Closed])in your Workflow Execution Event History. - -A single instance of the Activities implementation is shared across multiple simultaneous Activity invocations. -Activity implementation code should be _idempotent_. - -The values passed to Activities through invocation parameters or returned through a result value are recorded in the Execution history. -The entire Execution history is transferred from the Temporal service to Workflow Workers when a Workflow state needs to recover. -A large Execution history can thus adversely impact the performance of your Workflow. - -Therefore, be mindful of the amount of data you transfer through Activity invocation parameters or Return Values. -Otherwise, no additional limitations exist on Activity implementations. - -To spawn an Activity Execution, use the [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) operation from within your Workflow Definition. - -`execute_activity()` is a shortcut for [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) that waits on its result. - -To get just the handle to wait and cancel separately, use `start_activity()`. -In most cases, use `execute_activity()` unless advanced task capabilities are needed. - -A single argument to the Activity is positional. Multiple arguments are not supported in the type-safe form of `start_activity()` or `execute_activity()` and must be supplied by the `args` keyword argument. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set the required Activity Timeouts {#required-timeout} - -Activity Execution semantics rely on several parameters. -The only required value that needs to be set is either a [Schedule-To-Close Timeout](/activities#start-to-close-timeout) or a [Start-To-Close Timeout](/activities#start-to-close-timeout). -These values are set in the Activity Options. - -Activity options are set as keyword arguments after the Activity arguments. - -Available timeouts are: - -- schedule_to_close_timeout -- schedule_to_start_timeout -- start_to_close_timeout - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... - activity_timeout_result = await workflow.execute_activity( - your_activity, - YourParams(greeting, "Activity Timeout option"), - # Activity Execution Timeout - start_to_close_timeout=timedelta(seconds=10), - # schedule_to_start_timeout=timedelta(seconds=10), - # schedule_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to get the results of an Activity Execution {#get-activity-results} - -The call to spawn an [Activity Execution](/activities#activity-execution) generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command and provides the Workflow with an Awaitable. -Workflow Executions can either block progress until the result is available through the Awaitable or continue progressing, making use of the result when it becomes available. - -Use [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) to start an Activity and return its handle, [`ActivityHandle`](https://python.temporal.io/temporalio.workflow.ActivityHandle.html). Use [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) to return the results. - -You must provide either `schedule_to_close_timeout` or `start_to_close_timeout`. - -`execute_activity()` is a shortcut for `await start_activity()`. An asynchronous `execute_activity()` helper is provided which takes the same arguments as `start_activity()` and `await`s on the result. `execute_activity()` should be used in most cases unless advanced task capabilities are needed. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -## How to run Worker Processes {#run-a-dev-worker} - -The [Worker Process](/workers#worker-process) is where Workflow Functions and Activity Functions are executed. - -- Each [Worker Entity](/workers#worker-entity) in the Worker Process must register the exact Workflow Types and Activity Types it may execute. -- Each Worker Entity must also associate itself with exactly one [Task Queue](/workers#task-queue). -- Each Worker Entity polling the same Task Queue must be registered with the same Workflow Types and Activity Types. - -A [Worker Entity](/workers#worker-entity) is the component within a Worker Process that listens to a specific Task Queue. - -Although multiple Worker Entities can be in a single Worker Process, a single Worker Entity Worker Process may be perfectly sufficient. -For more information, see the [Worker tuning guide](/dev-guide/worker-performance). - -A Worker Entity contains a Workflow Worker and/or an Activity Worker, which makes progress on Workflow Executions and Activity Executions, respectively. - -To develop a Worker, use the `Worker()` constructor and add your Client, Task Queue, Workflows, and Activities as arguments. -The following code example creates a Worker that polls for tasks from the Task Queue and executes the Workflow. -When a Worker is created, it accepts a list of Workflows in the workflows parameter, a list of Activities in the activities parameter, or both. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -from temporalio.worker import Worker -# ... -# ... -async def main(): - client = await Client.connect("localhost:7233") - worker = Worker( - client, - task_queue="your-task-queue", - workflows=[YourWorkflow], - activities=[your_activity], - ) - await worker.run() - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -### How to register types {#register-types} - -All Workers listening to the same Task Queue name must be registered to handle the exact same Workflows Types and Activity Types. - -If a Worker polls a Task for a Workflow Type or Activity Type it does not know about, it fails that Task. -However, the failure of the Task does not cause the associated Workflow Execution to fail. - -When a `Worker` is created, it accepts a list of Workflows in the `workflows` parameter, a list of Activities in the `activities` parameter, or both. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - worker = Worker( - client, - task_queue="your-task-queue", - workflows=[YourWorkflow], - activities=[your_activity], - ) - await worker.run() - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -## How to start a Workflow Execution {#start-workflow-execution} - -[Workflow Execution](/workflows#workflow-execution) semantics rely on several parameters—that is, to start a Workflow Execution you must supply a Task Queue that will be used for the Tasks (one that a Worker is polling), the Workflow Type, language-specific contextual data, and Workflow Function parameters. - -In the examples below, all Workflow Executions are started using a Temporal Client. -To spawn Workflow Executions from within another Workflow Execution, use either the [Child Workflow](features#child-workflows) or External Workflow APIs. - -See the [Customize Workflow Type](#workflow-type) section to see how to customize the name of the Workflow Type. - -A request to spawn a Workflow Execution causes the Temporal Cluster to create the first Event ([WorkflowExecutionStarted](/references/events#workflowexecutionstarted)) in the Workflow Execution Event History. -The Temporal Cluster then creates the first Workflow Task, resulting in the first [WorkflowTaskScheduled](/references/events#workflowtaskscheduled) Event. - -To start a Workflow Execution in Python, use either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods in the Client. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -### How to set a Workflow's Task Queue {#set-task-queue} - -In most SDKs, the only Workflow Option that must be set is the name of the [Task Queue](/workers#task-queue). - -For any code to execute, a Worker Process must be running that contains a Worker Entity that is polling the same Task Queue name. - -To set a Task Queue in Python, specify the `task_queue` argument when executing a Workflow with either [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) methods. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -### How to set a Workflow Id {#workflow-id} - -You must set a [Workflow Id](/workflows#workflow-id). - -When setting a Workflow Id, we recommended mapping it to a business process or business entity identifier, such as an order identifier or customer identifier. - -To set a Workflow Id in Python, specify the `id` argument when executing a Workflow with either [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) methods. - -The `id` argument should be a unique identifier for the Workflow Execution. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -### How to get the results of a Workflow Execution {#get-workflow-results} - -If the call to start a Workflow Execution is successful, you will gain access to the Workflow Execution's Run Id. - -The Workflow Id, Run Id, and Namespace may be used to uniquely identify a Workflow Execution in the system and get its result. - -It's possible to both block progress on the result (synchronous execution) or get the result at some other point in time (asynchronous execution). - -In the Temporal Platform, it's also acceptable to use Queries as the preferred method for accessing the state and results of Workflow Executions. - -Use [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`get_workflow_handle()`](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle) to return a Workflow handle. -Then use the [`result`](https://python.temporal.io/temporalio.client.WorkflowHandle.html#result) method to await on the result of the Workflow. - -To get a handle for an existing Workflow by its Id, you can use [`get_workflow_handle()`](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle), or use [`get_workflow_handle_for()`](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle_for) for type safety. - -Then use [`describe()`](https://python.temporal.io/temporalio.client.workflowhandle#describe) to get the current status of the Workflow. -If the Workflow does not exist, this call fails. - -
- - View the source code - {" "} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - handle = client.get_workflow_handle( - workflow_id="your-workflow-id", - ) - results = await handle.result() - print(f"Result: {results}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` diff --git a/docs/dev-guide/python/interrupt-workflow.mdx b/docs/dev-guide/python/interrupt-workflow.mdx new file mode 100644 index 0000000000..340512b2f3 --- /dev/null +++ b/docs/dev-guide/python/interrupt-workflow.mdx @@ -0,0 +1,73 @@ +--- +id: interrupt-a-workflow-execution +title: Interrupt a Workflow Execution +sidebar_label: Interrupt a Workflow Execution +sidebar_position: 18 +description: Learn how to interrupt a workflow execution by canceling or terminating, including the differences and use cases for each method. +slug: /dev-guide/python/interrupt_a_workflow_execution +toc_max_heading_level: 2 +keywords: + - interrupt-a-workflow-execution +tags: + - interrupt-a-workflow-execution +--- + +## How to interrupt a Workflow Execution {#interrupt-a-workflow-execution} + +You can interrupt a Workflow Execution in one of the following ways: + +- [Cancel](#cancel) +- [Terminate](#terminate) + +The following are the main differences between canceling and terminating a Workflow in Temporal: + +##### Cancel + +Canceling a Workflow provides a graceful way to stop Workflow Execution. +This action resembles sending a `SIGTERM` to a process. + +- The system records a `WorkflowExecutionCancelRequested` event in the Workflow History. +- A Workflow Task gets scheduled to process the cancelation. +- The Workflow code can handle the cancelation and execute any cleanup logic. +- The system doesn't forcefully stop the Workflow. + +For more information, see [How to cancel a Workflow Execution](#cancel-a-workflow-execution). + +##### Terminate + +Terminating a Workflow forcefully stops Workflow Execution. +This action resembles killing a process. + +- The system records a `WorkflowExecutionTerminated` event in the Workflow History. +- The termination forcefully and immediately stops the Workflow Execution. +- The Workflow code gets no chance to handle termination. +- A Workflow Task doesn't get scheduled. + +For more information, see [How to terminate a Workflow Execution](#terminate-a-workflow-execution). + +##### Summary + +In summary: + +- Canceling provides a graceful way to stop the Workflow and allows it to handle cancelation logic. +- Termination forcefully stops the Workflow and prevents any further events. + +In most cases, canceling is preferable because it allows the Workflow to finish gracefully. +Terminate only if the Workflow is stuck and cannot be canceled normally. + +### How to cancel a Workflow Execution in Python {#cancel-a-workflow-execution} + +To cancel a Workflow Execution in Python, use the [cancel()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#cancel) function on the Workflow handle. + +```python +await client.get_workflow_handle("your_workflow_id").cancel() +``` + +### How to terminate a Workflow Execution in Python {#terminate-a-workflow-execution} + +To terminate a Workflow Execution in Python, use the [terminate()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#terminate) function on the Workflow handle. + +```python +await client.get_workflow_handle("your_workflow_id").terminate() +``` + diff --git a/docs/dev-guide/python/messages.mdx b/docs/dev-guide/python/messages.mdx new file mode 100644 index 0000000000..296d91c4b1 --- /dev/null +++ b/docs/dev-guide/python/messages.mdx @@ -0,0 +1,432 @@ +--- +id: messages +title: Messages +sidebar_label: Messages +sidebar_position: 5 +description: Explore using Signals in Temporal Python to send messages to Workflows, with details on defining, sending, and handling Signals, including customization options. +slug: /dev-guide/python/messages +toc_max_heading_level: 2 +keywords: + - messages +tags: + - messages +--- + +## How to develop with Signals {#signals} + +A [Signal](/workflows#signal) is a message sent to a running Workflow Execution. + +Signals are defined in your code and handled in your Workflow Definition. +Signals can be sent to Workflow Executions from a Temporal Client or from another Workflow Execution. + +A Signal has a name and can have arguments. + +- The name, also called a Signal type, is a string. +- The arguments must be serializable. + To define a Signal, set the Signal decorator [`@workflow.signal`](https://python.temporal.io/temporalio.workflow.html#signal) on the Signal function inside your Workflow. + +Non-dynamic methods can only have positional arguments. +Temporal suggests taking a single argument that is an object or data class of fields that can be added to as needed. + +Return values from Signal methods are ignored. + +**Customize names** + +You can have a name parameter to customize the Signal's name, otherwise it defaults to the name of the Signal method. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio import workflow +# ... +# ... + @workflow.signal + async def submit_greeting(self, name: str) -> None: + await self._pending_greetings.put(name) + + @workflow.signal + def exit(self) -> None: +# ... + @workflow.signal(name="Custom Signal Name") + async def custom_signal(self, name: str) -> None: + await self._pending_greetings.put(name) +``` + +Workflows listen for Signals by the Signal's name. + +To send a Signal to the Workflow, use the [signal](https://python.temporal.io/temporalio.client.WorkflowHandle.html#signal) method from the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio.client import Client +# ... +# ... + await handle.signal(GreetingWorkflow.submit_greeting, "User 1") +``` + +### How to send a Signal from a Temporal Client {#send-signal-from-client} + +When a Signal is sent successfully from the Temporal Client, the [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the Event History of the Workflow that receives the Signal. + +To send a Signal from the Client, use the [signal()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#signal) function on the Workflow handle. + +To get the Workflow handle, you can use any of the following options. + +- Use the [get_workflow_handle()](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle) method. +- Use the [get_workflow_handle_for()](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle_for) method to get a type-safe Workflow handle by its Workflow Id. +- Use the [start_workflow()](https://python.temporal.io/temporalio.client.Client.html#start_workflow) to start a Workflow and return its handle. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio.client import Client +# ... +# ... + client = await Client.connect("localhost:7233") + handle = await client.start_workflow( + GreetingWorkflow.run, + id="your-greeting-workflow", + task_queue="signal-tq", + ) + await handle.signal(GreetingWorkflow.submit_greeting, "User 1") +``` + +### How to send a Signal from a Workflow {#send-signal-from-workflow} + +A Workflow can send a Signal to another Workflow, in which case it's called an _External Signal_. + +When an External Signal is sent: + +- A [SignalExternalWorkflowExecutionInitiated](/references/events#signalexternalworkflowexecutioninitiated) Event appears in the sender's Event History. +- A [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the recipient's Event History. + +Use [`get_external_workflow_handle_for`](https://python.temporal.io/temporalio.workflow.html#get_external_workflow_handle_for) to get a typed Workflow handle to an existing Workflow by its identifier. +Use [`get_external_workflow_handle`](https://python.temporal.io/temporalio.workflow.html#get_external_workflow_handle) when you don't know the type of the other Workflow. + +:::note + +The Workflow Type passed is only for type annotations and not for validation. + +::: + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +@workflow.defn +class WorkflowB: + @workflow.run + async def run(self) -> None: + handle = workflow.get_external_workflow_handle_for(WorkflowA.run, "workflow-a") + await handle.signal(WorkflowA.your_signal, "signal argument") +``` + +### How to Signal-With-Start {#signal-with-start} + +Signal-With-Start is used from the Client. +It takes a Workflow Id, Workflow arguments, a Signal name, and Signal arguments. + +If there's a Workflow running with the given Workflow Id, it will be signaled. If there isn't, a new Workflow will be started and immediately signaled. + +To send a Signal-With-Start in Python, use the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) method and pass the `start_signal` argument with the name of your Signal. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio.client import Client +# ... +# ... +async def main(): + client = await Client.connect("localhost:7233") + await client.start_workflow( + GreetingWorkflow.run, + id="your-signal-with-start-workflow", + task_queue="signal-tq", + start_signal="submit_greeting", + start_signal_args=["User Signal with Start"], + ) +``` + +## How to develop with Queries {#queries} + +A [Query](/workflows#query) is a synchronous operation that is used to get the state of a Workflow Execution. + +### How to define a Query {#define-query} + +A Query has a name and can have arguments. + +- The name, also called a Query type, is a string. +- The arguments must be [serializable](/dataconversion). + +To define a Query, set the Query decorator [`@workflow.query`](https://python.temporal.io/temporalio.workflow.html#query) on the Query function inside your Workflow. + +**Customize names** + +You can have a name parameter to customize the Query's name, otherwise it defaults to the name of the Query method. + +:::note + +You can either set the `name` or the `dynamic` parameter in a Query's decorator, but not both. + +::: + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + @workflow.query + def greeting(self) -> str: + return self._greeting +``` + +### How to handle a Query {#handle-query} + +Queries are handled by your Workflow. + +Don’t include any logic that causes [Command](/workflows#command) generation within a Query handler (such as executing Activities). +Including such logic causes unexpected behavior. + +To send a Query to the Workflow, use the [`query`](https://python.temporal.io/temporalio.client.WorkflowHandle.html#query) method from the [`WorkflowHandle`](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + + +# ... + result = await handle.query(GreetingWorkflow.greeting) +``` + +### How to send a Query {#send-query} + +Queries are sent from a Temporal Client. + +To send a Query to a Workflow Execution from Client code, use the `query()` method on the Workflow handle. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + result = await handle.query(GreetingWorkflow.greeting) +``` + +## How to develop with Updates {#updates} + +An [Update](/workflows#update) is an operation that can mutate the state of a Workflow Execution and return a response. + +### How to define an Update {#define-update} + +Workflow Updates handlers are methods in your Workflow Definition designed to handle updates. +These updates can be triggered during the lifecycle of a Workflow Execution. + +**Define an Update Handler** + +To define an update handler, use the [@workflow.update](https://python.temporal.io/temporalio.workflow.html#update) decorator on a method within your Workflow. This decorator can be applied to both asynchronous and synchronous methods. + +- **Decorator Usage:** Apply `@workflow.update` to the method intended to handle updates. +- **Overriding:** If a method with this decorator is overridden, the overriding method should also be decorated with `@workflow.update`. +- **Validator Method:** Optionally, you can define a validator method for the update handler. This validator is specified using `@update_handler_method_name.validator` and is invoked before the update handler. +- **Method Parameters:** Update handlers should only use positional parameters. For non-dynamic methods, it's recommended to use a single parameter that is an object or data class, which allows for future expansion of fields. +- **Return Values:** The update handler can return a serializable value. This value is sent back to the caller of the update. + +```python +# ... + @workflow.update + async def update_workflow_status(self) -> str: + self.is_complete = True + return "Workflow status updated" +``` + +### How to send an Update from a Temporal Client {#send-update-from-client} + +To send a Workflow Update from a Temporal Client, call the [execute_update](https://python.temporal.io/temporalio.client.WorkflowHandle.html#execute_update) method on the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. + +```python +# ... + update_result = await handle.execute_update( + HelloWorldWorkflow.update_workflow_status + ) + print(f"Update Result: {update_result}") +``` + +## What is a Dynamic Handler {#dynamic-handler} + +Temporal supports Dynamic Workflows, Activities, Signals, and Queries. +These are unnamed handlers that are invoked if no other statically defined handler with the given name exists. + +Dynamic Handlers provide flexibility to handle cases where the names of Workflows, Activities, Signals, or Queries aren't known at run time. + +:::caution + +Dynamic Handlers should be used judiciously as a fallback mechanism rather than the primary approach. +Overusing them can lead to maintainability and debugging issues down the line. + +Instead, Workflows, Activities, Signals, and Queries should be defined statically whenever possible, with clear names that indicate their purpose. +Use static definitions as the primary way of structuring your Workflows. + +Reserve Dynamic Handlers for cases where the handler names are not known at compile time and need to be looked up dynamically at runtime. +They are meant to handle edge cases and act as a catch-all, not as the main way of invoking logic. + +::: + +### How to set a Dynamic Workflow {#set-a-dynamic-workflow} + +A Dynamic Workflow in Temporal is a Workflow that is invoked dynamically at runtime if no other Workflow with the same name is registered. +A Workflow can be made dynamic by adding `dynamic=True` to the `@workflow.defn` decorator. +You must register the Workflow with the [Worker](https://python.temporal.io/temporalio.worker.html) before it can be invoked. + +The Workflow Definition must then accept a single argument of type `Sequence[temporalio.common.RawValue]`. +The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +@workflow.defn(dynamic=True) +class DynamicWorkflow: + @workflow.run + async def run(self, args: Sequence[RawValue]) -> str: + name = workflow.payload_converter().from_payload(args[0].payload, str) + return await workflow.execute_activity( + default_greeting, + YourDataClass("Hello", name), + start_to_close_timeout=timedelta(seconds=10), + ) +``` + +### How to set a Dynamic Activity {#set-a-dynamic-activity} + +A Dynamic Activity in Temporal is an Activity that is invoked dynamically at runtime if no other Activity with the same name is registered. +An Activity can be made dynamic by adding `dynamic=True` to the `@activity.defn` decorator. +You must register the Activity with the [Worker](https://python.temporal.io/temporalio.worker.html) before it can be invoked. + +The Activity Definition must then accept a single argument of type `Sequence[temporalio.common.RawValue]`. +The [payload_converter()](https://python.temporal.io/temporalio.activity.html#payload_converter) function is used to convert a `RawValue` object to the desired type. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +@activity.defn(dynamic=True) +async def dynamic_greeting(args: Sequence[RawValue]) -> str: + arg1 = activity.payload_converter().from_payload(args[0].payload, YourDataClass) + return ( + f"{arg1.greeting}, {arg1.name}!\nActivity Type: {activity.info().activity_type}" + ) +# ... +@workflow.defn +class GreetingWorkflow: + @workflow.run + async def run(self, name: str) -> str: + return await workflow.execute_activity( + "unregistered_activity", + YourDataClass("Hello", name), + start_to_close_timeout=timedelta(seconds=10), + ) +``` + +### How to set a Dynamic Signal {#set-a-dynamic-signal} + +A Dynamic Signal in Temporal is a Signal that is invoked dynamically at runtime if no other Signal with the same input is registered. +A Signal can be made dynamic by adding `dynamic=True` to the `@signal.defn` decorator. + +The Signal Handler should accept `self`, a string input, and a `Sequence[temporalio.common.RawValue]`. +The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + @workflow.signal(dynamic=True) + async def dynamic_signal(self, name: str, args: Sequence[RawValue]) -> None: + await self._pending_greetings.put(name) +``` + +### How to set a Dynamic Query {#set-a-dynamic-query} + +A Dynamic Query in Temporal is a Query that is invoked dynamically at runtime if no other Query with the same name is registered. +A Query can be made dynamic by adding `dynamic=True` to the `@query.defn` decorator. + +The Query Handler should accept `self`, a string name, and a `Sequence[temporalio.common.RawValue]`. +The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + @workflow.query(dynamic=True) + def dynamic_query(self, input: str, args: Sequence[RawValue]) -> str: + return self._greeting +``` diff --git a/docs/dev-guide/python/observability.mdx b/docs/dev-guide/python/observability.mdx index f3b9ec5f38..af3a58e0c0 100644 --- a/docs/dev-guide/python/observability.mdx +++ b/docs/dev-guide/python/observability.mdx @@ -1,34 +1,15 @@ --- id: observability -title: Observability - Python SDK feature guide +title: Observability sidebar_label: Observability -sidebar_position: 8 -description: Improve observability in your Python-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. -toc_max_heading_level: 4 +sidebar_position: 10 +description: Learn about observability tools for Temporal applications, covering metrics, tracing, logging, and visibility to monitor and troubleshoot Workflows. +slug: /dev-guide/python/observability +toc_max_heading_level: 2 keywords: -- client -- code sample -- developer-guide -- guide-context -- how-to -- logging -- python -- python sdk -- sdk -- search attribute -- workflow + - observability tags: -- client -- code-sample -- developer-guide -- guide-context -- how-to -- logging -- python -- python-sdk -- sdk -- search-attribute -- workflow + - observability --- diff --git a/docs/dev-guide/python/schedules.mdx b/docs/dev-guide/python/schedules.mdx new file mode 100644 index 0000000000..e28f6351a1 --- /dev/null +++ b/docs/dev-guide/python/schedules.mdx @@ -0,0 +1,306 @@ +--- +id: schedules +title: Schedules +sidebar_label: Schedules +sidebar_position: 12 +description: Discover how to effectively Schedule Workflows in Temporal Python, covering creation, management, and operations like backfilling, deleting, and triggering Scheduled Workflows for precise automation timing. +slug: /dev-guide/python/schedules +toc_max_heading_level: 2 +keywords: + - schedules +tags: + - schedules +--- + +## How to Schedule a Workflow {#schedule-a-workflow} + +Scheduling Workflows is a crucial aspect of any automation process, especially when dealing with time-sensitive tasks. By scheduling a Workflow, you can automate repetitive tasks, reduce the need for manual intervention, and ensure timely execution of your business processes + +Use any of the following action to help Schedule a Workflow Execution and take control over your automation process. + +### How to Create a Scheduled Workflow {#create} + +The create action enables you to create a new Schedule. When you create a new Schedule, a unique Schedule ID is generated, which you can use to reference the Schedule in other Schedule commands. + +To create a Scheduled Workflow Execution in Python, use the [create_schedule()](https://python.temporal.io/temporalio.client.Client.html#create_schedule) +asynchronous method on the Client. +Then pass the Schedule ID and the Schedule object to the method to create a Scheduled Workflow Execution. +Set the `action` parameter to `ScheduleActionStartWorkflow` to start a Workflow Execution. +Optionally, you can set the `spec` parameter to `ScheduleSpec` to specify the schedule or set the `intervals` parameter to `ScheduleIntervalSpec` to specify the interval. +Other options include: `cron_expressions`, `skip`, `start_at`, and `jitter`. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + + await client.create_schedule( + "workflow-schedule-id", + Schedule( + action=ScheduleActionStartWorkflow( + YourSchedulesWorkflow.run, + "my schedule arg", + id="schedules-workflow-id", + task_queue="schedules-task-queue", + ), + spec=ScheduleSpec( + intervals=[ScheduleIntervalSpec(every=timedelta(minutes=2))] + ), + state=ScheduleState(note="Here's a note on my Schedule."), + ), + ) +``` + +### How to Backfill a Scheduled Workflow {#backfill} + +The backfill action executes Actions ahead of their specified time range. This command is useful when you need to execute a missed or delayed Action, or when you want to test the Workflow before its scheduled time. + +To Backfill a Scheduled Workflow Execution in Python, use the [backfill()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#backfill) asynchronous +method on the Schedule Handle. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +import asyncio +from datetime import datetime, timedelta + +from temporalio.client import Client, ScheduleBackfill, ScheduleOverlapPolicy + + + +async def main(): + client = await Client.connect("localhost:7233") + handle = client.get_schedule_handle( + "workflow-schedule-id", + ) + now = datetime.utcnow() + ( + await handle.backfill( + ScheduleBackfill( + start_at=now - timedelta(minutes=10), + end_at=now - timedelta(minutes=9), + overlap=ScheduleOverlapPolicy.ALLOW_ALL, + ), + ), + ) +``` + +### How to Delete a Scheduled Workflow {#delete} + +The delete action enables you to delete a Schedule. When you delete a Schedule, it does not affect any Workflows that were started by the Schedule. + +To delete a Scheduled Workflow Execution in Python, use the [delete()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#delete) asynchronous method on the Schedule Handle. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + + + +async def main(): + client = await Client.connect("localhost:7233") + handle = client.get_schedule_handle( + "workflow-schedule-id", + ) + + await handle.delete() +``` + +### How to Describe a Scheduled Workflow {#describe} + +The describe action shows the current Schedule configuration, including information about past, current, and future Workflow Runs. This command is helpful when you want to get a detailed view of the Schedule and its associated Workflow Runs. + +To describe a Scheduled Workflow Execution in Python, use the [describe()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#delete) asynchronous method on the Schedule Handle. +You can get a complete list of the attributes of the Scheduled Workflow Execution from the [ScheduleDescription](https://python.temporal.io/temporalio.client.ScheduleDescription.html) class. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + handle = client.get_schedule_handle( + "workflow-schedule-id", + ) + + desc = await handle.describe() + + print(f"Returns the note: {desc.schedule.state.note}") +``` + +### How to List a Scheduled Workflow {#list} + +The list action lists all the available Schedules. This command is useful when you want to view a list of all the Schedules and their respective Schedule IDs. + +To list all schedules, use the [list_schedules()](https://python.temporal.io/temporalio.client.Client.html#list_schedules) asynchronous method on the Client. +If a schedule is added or deleted, it may not be available in the list immediately. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main() -> None: + client = await Client.connect("localhost:7233") + async for schedule in await client.list_schedules(): + print(f"List Schedule Info: {schedule.info}.") +``` + +### How to Pause a Scheduled Workflow {#pause} + +The pause action enables you to pause and unpause a Schedule. When you pause a Schedule, all the future Workflow Runs associated with the Schedule are temporarily stopped. This command is useful when you want to temporarily halt a Workflow due to maintenance or any other reason. + +To pause a Scheduled Workflow Execution in Python, use the [pause()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#pause) asynchronous method on the Schedule Handle. +You can pass a `note` to the `pause()` method to provide a reason for pausing the schedule. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + handle = client.get_schedule_handle( + "workflow-schedule-id", + ) + + await handle.pause(note="Pausing the schedule for now") +``` + +### How to Trigger a Scheduled Workflow {#trigger} + +The trigger action triggers an immediate action with a given Schedule. By default, this action is subject to the Overlap Policy of the Schedule. This command is helpful when you want to execute a Workflow outside of its scheduled time. + +To trigger a Scheduled Workflow Execution in Python, use the [trigger()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#trigger) asynchronous method on the Schedule Handle. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + handle = client.get_schedule_handle( + "workflow-schedule-id", + ) + + await handle.trigger() +``` + +### How to Update a Scheduled Workflow {#update} + +The update action enables you to update an existing Schedule. This command is useful when you need to modify the Schedule's configuration, such as changing the start time, end time, or interval. + +Create a function that takes `ScheduleUpdateInput` and returns `ScheduleUpdate`. +To update a Schedule, use a callback to build the update from the description. +The following example updates the Schedule to use a new argument. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + async def update_schedule_simple(input: ScheduleUpdateInput) -> ScheduleUpdate: + schedule_action = input.description.schedule.action + + if isinstance(schedule_action, ScheduleActionStartWorkflow): + schedule_action.args = ["my new schedule arg"] + return ScheduleUpdate(schedule=input.description.schedule) +``` + +## How to use Temporal Cron Jobs {#temporal-cron-jobs} + +A [Temporal Cron Job](/workflows#temporal-cron-job) is the series of Workflow Executions that occur when a Cron Schedule is provided in the call to spawn a Workflow Execution. + +A Cron Schedule is provided as an option when the call to spawn a Workflow Execution is made. + +You can set each Workflow to repeat on a schedule with the `cron_schedule` option from either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + result = await client.execute_workflow( + CronWorkflow.run, + id="your-workflow-id", + task_queue="your-task-queue", + cron_schedule="* * * * *", + ) + print(f"Results: {result}") +``` + +## How to use Start Delay {#start-delay} + +Use the `start_delay` to schedule a Workflow Execution at a specific one-time future point rather than on a recurring schedule. + +Use the `start_delay` option in either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods in the Client. + +```python +async def main(): + client = await Client.connect("localhost:7233") + + result = await client.execute_workflow( + YourWorkflow.run, + "your name", + id="your-workflow-id", + task_queue="your-task-queue", + start_delay=timedelta(hours=1, minutes=20, seconds=30) + ) + + print(f"Result: {result}") + + +if __name__ == "__main__": + asyncio.run(main()) +``` diff --git a/docs/dev-guide/python/temporal-clients.mdx b/docs/dev-guide/python/temporal-clients.mdx new file mode 100644 index 0000000000..332e439bb1 --- /dev/null +++ b/docs/dev-guide/python/temporal-clients.mdx @@ -0,0 +1,267 @@ +--- +id: temporal-clients +title: Temporal Clients +sidebar_label: Temporal Clients +sidebar_position: 2 +description: Explore how to utilize Temporal Clients to connect to and interact with Temporal, including initiating Workflow Executions and handling Workflow results, with specific instructions for both local and Temporal Cloud environments. +slug: /dev-guide/python/temporal_clients +toc_max_heading_level: 2 +keywords: + - temporal-clients +tags: + - temporal-clients +--- + +## How to connect a Temporal Client to a Temporal Cluster {#connect-to-a-dev-cluster} + +A [Temporal Client](/encyclopedia/temporal-sdks#temporal-client) enables you to communicate with the [Temporal Cluster](/clusters). +Communication with a Temporal Cluster includes, but isn't limited to, the following: + +- Starting Workflow Executions. +- Sending Signals to Workflow Executions. +- Sending Queries to Workflow Executions. +- Getting the results of a Workflow Execution. +- Providing an Activity Task Token. + +:::caution + +A Temporal Client cannot be initialized and used inside a Workflow. +However, it is acceptable and common to use a Temporal Client inside an Activity to communicate with a Temporal Cluster. + +::: + +When you are running a Cluster locally (such as the [Temporal CLI](https://docs.temporal.io/cli/server#start-dev)), the number of connection options you must provide is minimal. +Many SDKs default to the local host or IP address and port that Temporalite and [Docker Compose](https://github.com/temporalio/docker-compose) serve (`127.0.0.1:7233`). + +Use the `connect()` method on the Client class to create and connect to a Temporal Client to the Temporal Cluster. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + + result = await client.execute_workflow( + YourWorkflow.run, + "your name", + id="your-workflow-id", + task_queue="your-task-queue", + ) + + print(f"Result: {result}") + + +if __name__ == "__main__": + asyncio.run(main()) +``` + +## How to connect to Temporal Cloud {#connect-to-temporal-cloud} + +When you connect to [Temporal Cloud](/cloud), you need to provide additional connection and client options that include the following: + +- The [Temporal Cloud Namespace Id](/cloud/namespaces#temporal-cloud-namespace-id). +- The [Namespace's gRPC endpoint](/cloud/namespaces#temporal-cloud-grpc-endpoint). + An endpoint listing is available at the [Temporal Cloud Website](https://cloud.temporal.io/namespaces) on each Namespace detail page. + The endpoint contains the Namespace Id and port. +- mTLS CA certificate. +- mTLS private key. + +For more information about managing and generating client certificates for Temporal Cloud, see [How to manage certificates in Temporal Cloud](/cloud/certificates). + +For more information about configuring TLS to secure inter- and intra-network communication for a Temporal Cluster, see [Temporal Customization Samples](https://github.com/temporalio/samples-server). + +Use the `connect()` method on the Client class to create and connect to a Temporal Client to the Temporal Cluster. +Then specify the [TLSConfig](https://python.temporal.io/temporalio.service.TLSConfig.html) arguments to connect to a Temporal Cluster with TLS enabled. +The `client_cert` must be combined with `client_private_key` to authenticate the Client. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +from temporalio.client import Client, TLSConfig +# ... +# ... +async def main(): + with open("client-cert.pem", "rb") as f: + client_cert = f.read() + with open("client-private-key.pem", "rb") as f: + client_private_key = f.read() + client = await Client.connect( + "your-custom-namespace.tmprl.cloud:7233", + namespace=".", + tls=TLSConfig( + client_cert=client_cert, + client_private_key=client_private_key, + # domain=domain, # TLS domain + # server_root_ca_cert=server_root_ca_cert, # ROOT CA to validate the server cert + ), + ) +``` + + +## How to start a Workflow Execution {#start-workflow-execution} + +[Workflow Execution](/workflows#workflow-execution) semantics rely on several parameters—that is, to start a Workflow Execution you must supply a Task Queue that will be used for the Tasks (one that a Worker is polling), the Workflow Type, language-specific contextual data, and Workflow Function parameters. + +In the examples below, all Workflow Executions are started using a Temporal Client. +To spawn Workflow Executions from within another Workflow Execution, use either the [Child Workflow](features#child-workflows) or External Workflow APIs. + +See the [Customize Workflow Type](#workflow-type) section to see how to customize the name of the Workflow Type. + +A request to spawn a Workflow Execution causes the Temporal Cluster to create the first Event ([WorkflowExecutionStarted](/references/events#workflowexecutionstarted)) in the Workflow Execution Event History. +The Temporal Cluster then creates the first Workflow Task, resulting in the first [WorkflowTaskScheduled](/references/events#workflowtaskscheduled) Event. + +To start a Workflow Execution in Python, use either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods in the Client. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + + result = await client.execute_workflow( + YourWorkflow.run, + "your name", + id="your-workflow-id", + task_queue="your-task-queue", + ) + + print(f"Result: {result}") + + +if __name__ == "__main__": + asyncio.run(main()) +``` + +### How to set a Workflow's Task Queue {#set-task-queue} + +In most SDKs, the only Workflow Option that must be set is the name of the [Task Queue](/workers#task-queue). + +For any code to execute, a Worker Process must be running that contains a Worker Entity that is polling the same Task Queue name. + +To set a Task Queue in Python, specify the `task_queue` argument when executing a Workflow with either [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) methods. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + + result = await client.execute_workflow( + YourWorkflow.run, + "your name", + id="your-workflow-id", + task_queue="your-task-queue", + ) + + print(f"Result: {result}") + + +if __name__ == "__main__": + asyncio.run(main()) +``` + +### How to set a Workflow Id {#workflow-id} + +You must set a [Workflow Id](/workflows#workflow-id). + +When setting a Workflow Id, we recommended mapping it to a business process or business entity identifier, such as an order identifier or customer identifier. + +To set a Workflow Id in Python, specify the `id` argument when executing a Workflow with either [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) methods. + +The `id` argument should be a unique identifier for the Workflow Execution. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + + result = await client.execute_workflow( + YourWorkflow.run, + "your name", + id="your-workflow-id", + task_queue="your-task-queue", + ) + + print(f"Result: {result}") + + +if __name__ == "__main__": + asyncio.run(main()) +``` + +### How to get the results of a Workflow Execution {#get-workflow-results} + +If the call to start a Workflow Execution is successful, you will gain access to the Workflow Execution's Run Id. + +The Workflow Id, Run Id, and Namespace may be used to uniquely identify a Workflow Execution in the system and get its result. + +It's possible to both block progress on the result (synchronous execution) or get the result at some other point in time (asynchronous execution). + +In the Temporal Platform, it's also acceptable to use Queries as the preferred method for accessing the state and results of Workflow Executions. + +Use [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`get_workflow_handle()`](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle) to return a Workflow handle. +Then use the [`result`](https://python.temporal.io/temporalio.client.WorkflowHandle.html#result) method to await on the result of the Workflow. + +To get a handle for an existing Workflow by its Id, you can use [`get_workflow_handle()`](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle), or use [`get_workflow_handle_for()`](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle_for) for type safety. + +Then use [`describe()`](https://python.temporal.io/temporalio.client.workflowhandle#describe) to get the current status of the Workflow. +If the Workflow does not exist, this call fails. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + + handle = client.get_workflow_handle( + workflow_id="your-workflow-id", + ) + results = await handle.result() + print(f"Result: {results}") + + +if __name__ == "__main__": + asyncio.run(main()) +``` diff --git a/docs/dev-guide/python/testing.mdx b/docs/dev-guide/python/test-suites.mdx similarity index 98% rename from docs/dev-guide/python/testing.mdx rename to docs/dev-guide/python/test-suites.mdx index c7be2c66ca..6af99367d2 100644 --- a/docs/dev-guide/python/testing.mdx +++ b/docs/dev-guide/python/test-suites.mdx @@ -1,10 +1,11 @@ --- -id: testing -title: Testing - Python SDK feature guide -sidebar_label: Testing -sidebar_position: 7 +id: test-suites +title: Test suites +sidebar_label: Test suites +sidebar_position: 3 description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. -toc_max_heading_level: 4 +slug: /dev-guide/python/test_suites +toc_max_heading_level: 2 keywords: - developer-guide - guide-context diff --git a/docs/dev-guide/python/timers.mdx b/docs/dev-guide/python/timers.mdx new file mode 100644 index 0000000000..0f9d4c2a34 --- /dev/null +++ b/docs/dev-guide/python/timers.mdx @@ -0,0 +1,38 @@ +--- +id: timers +title: Timers +sidebar_label: Timers +sidebar_position: 17 +description: Learn how to use timers within Temporal workflows to delay execution, enabling durable and long-term scheduling of tasks that can persist even if the worker or cluster goes down. +slug: /dev-guide/python/timers +toc_max_heading_level: 2 +keywords: + - timers +tags: + - timers +--- + +## What is a Timer? {#timers} + +A Workflow can set a durable timer for a fixed time period. +In some SDKs, the function is called `sleep()`, and in others, it's called `timer()`. + +A Workflow can sleep for months. +Timers are persisted, so even if your Worker or Temporal Cluster is down when the time period completes, as soon as your Worker and Cluster are back up, the `sleep()` call will resolve and your code will continue executing. + +Sleeping is a resource-light operation: it does not tie up the process, and you can run millions of Timers off a single Worker. + +To set a Timer in Python, call the [`asyncio.sleep()`](https://docs.python.org/3/library/asyncio-task.html#sleeping) function and pass the duration in seconds you want to wait before continuing. + +
+ + View the source code + {" "} + in the context of the rest of the application code. +
+ +```python + +# ... + await asyncio.sleep(10) +``` diff --git a/docs/dev-guide/python/versioning.mdx b/docs/dev-guide/python/versioning.mdx index 2ea57e0ef8..3327498af8 100644 --- a/docs/dev-guide/python/versioning.mdx +++ b/docs/dev-guide/python/versioning.mdx @@ -1,11 +1,11 @@ --- id: versioning -title: Versioning - Python SDK feature guide +title: Versioning sidebar_label: Versioning sidebar_position: 9 description: The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. slug: /dev-guide/python/versioning -toc_max_heading_level: 4 +toc_max_heading_level: 2 keywords: - best practices - code sample diff --git a/docusaurus.config.js b/docusaurus.config.js index 5a189ef57d..b45ebb3dde 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,6 +1,4 @@ //@ts-check -const path = require("path"); -const visit = require("unist-util-visit"); const FontPreloadPlugin = require("webpack-font-preload-plugin"); /** @type {import('@docusaurus/types').DocusaurusConfig} */ @@ -11,6 +9,7 @@ module.exports = async function createConfigAsync() { tagline: "Build invincible applications", url: "https://docs.temporal.io", baseUrl: "/", + onBrokenAnchors: "throw", onBrokenLinks: "throw", onBrokenMarkdownLinks: "throw", favicon: "img/favicon.svg", diff --git a/sidebars.js b/sidebars.js index 36087b61fd..aee7d0f1b4 100644 --- a/sidebars.js +++ b/sidebars.js @@ -119,16 +119,22 @@ module.exports = { id: "dev-guide/python/index", }, items: [ - "dev-guide/python/introduction", - "dev-guide/python/project-setup", - "dev-guide/python/durable-execution", - "dev-guide/python/foundations", - "dev-guide/python/features", + "dev-guide/python/core-application", + "dev-guide/python/temporal-clients", + "dev-guide/python/test-suites", + "dev-guide/python/failure-detection", + "dev-guide/python/messages", + "dev-guide/python/cancellation", + "dev-guide/python/asynchronous-activity-completion", + "dev-guide/python/versioning", "dev-guide/python/observability", - "dev-guide/python/testing", "dev-guide/python/debugging", - "dev-guide/python/versioning", - "dev-guide/python/converters", + "dev-guide/python/schedules", + "dev-guide/python/data-encryption", + "dev-guide/python/child-workflows", + "dev-guide/python/continue-as-new", + "dev-guide/python/timers", + "dev-guide/python/interrupt-a-workflow-execution", ], }, { diff --git a/vercel.json b/vercel.json deleted file mode 100644 index 9bf89b9ae6..0000000000 --- a/vercel.json +++ /dev/null @@ -1,2002 +0,0 @@ -{ - "public": true, - "trailingSlash": false, - "github": { - "silent": true - }, - "redirects": [ - { - "source": "/leadership", - "destination": "https://temporal.io/about" - }, - { - "source": "/privacy-policy", - "destination": "https://temporal.io/global-privacy-policy", - "permanent": true - }, - { - "source": "/docs/:path*", - "destination": "/:path*" - }, - { - "source": "/reference/:path*", - "destination": "/references/:path*" - }, - { - "source": "/system-tools/:path*", - "destination": "/devtools/:path*" - }, - { - "source": "/devtools/tctl", - "destination": "/cli" - }, - { - "source": "/devtools/introduction", - "destination": "/" - }, - { - "source": "/devtools/web-ui", - "destination": "/web-ui" - }, - { - "source": "/sdks-introduction", - "destination": "/dev-guide" - }, - { - "source": "/other-sdks", - "destination": "/dev-guide" - }, - { - "source": "/get-started", - "destination": "https://learn.temporal.io/getting_started" - }, - { - "source": "/getting-started", - "destination": "https://learn.temporal.io/getting_started" - }, - { - "source": "/references/glossary", - "destination": "/glossary" - }, - { - "source": "/tasks:path*", - "destination": "/workers:path*" - }, - { - "source": "/cluster-deployment-guide:path*", - "destination": "/self-hosted-guide" - }, - { - "source": "/application-development-guide", - "destination": "/dev-guide" - }, - { - "source": "/application-development/foundations:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "go" - } - ], - "destination": "/dev-guide/go/features:path*", - "permanent": false - }, - { - "source": "/application-development/features:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "go" - } - ], - "destination": "/dev-guide/go/features:path*", - "permanent": false - }, - { - "source": "/application-development/observability:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "go" - } - ], - "destination": "/dev-guide/go/observability:path*", - "permanent": false - }, - { - "source": "/application-development/testing:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "go" - } - ], - "destination": "/dev-guide/go/testing:path*", - "permanent": false - }, - { - "source": "/application-development/foundations:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "java" - } - ], - "destination": "/dev-guide/java/foundations:path*", - "permanent": false - }, - { - "source": "/application-development/features:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "java" - } - ], - "destination": "/dev-guide/java/features:path*", - "permanent": false - }, - { - "source": "/application-development/observability:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "java" - } - ], - "destination": "/dev-guide/java/observability:path*", - "permanent": false - }, - { - "source": "/application-development/testing:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "java" - } - ], - "destination": "/dev-guide/java/testing:path*", - "permanent": false - }, - { - "source": "/application-development/foundations:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "php" - } - ], - "destination": "/dev-guide/php/foundations:path*", - "permanent": false - }, - { - "source": "/application-development/features:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "php" - } - ], - "destination": "/dev-guide/php/features:path*", - "permanent": false - }, - { - "source": "/application-development/observability:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "php" - } - ], - "destination": "/dev-guide/php/observability:path*", - "permanent": false - }, - { - "source": "/application-development/testing:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "php" - } - ], - "destination": "/dev-guide/php/testing:path*", - "permanent": false - }, - { - "source": "/application-development/foundations:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "python" - } - ], - "destination": "/dev-guide/python/foundations:path*", - "permanent": false - }, - { - "source": "/application-development/features:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "python" - } - ], - "destination": "/dev-guide/python/features:path*", - "permanent": false - }, - { - "source": "/application-development/observability:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "python" - } - ], - "destination": "/dev-guide/python/observability:path*", - "permanent": false - }, - { - "source": "/application-development/testing:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "python" - } - ], - "destination": "/dev-guide/python/testing:path*", - "permanent": false - }, - { - "source": "/application-development/foundations:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "typescript" - } - ], - "destination": "/dev-guide/typescript/foundations:path*", - "permanent": false - }, - { - "source": "/application-development/features:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "typescript" - } - ], - "destination": "/dev-guide/typescript/features:path*", - "permanent": false - }, - { - "source": "/application-development/observability:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "typescript" - } - ], - "destination": "/dev-guide/typescript/observability:path*", - "permanent": false - }, - { - "source": "/application-development/testing:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "typescript" - } - ], - "destination": "/dev-guide/typescript/testing:path*", - "permanent": false - }, - { - "source": "/application-development:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "go" - } - ], - "destination": "/dev-guide/go", - "permanent": false - }, - { - "source": "/application-development:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "java" - } - ], - "destination": "/dev-guide/java", - "permanent": false - }, - { - "source": "/application-development:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "php" - } - ], - "destination": "/dev-guide/php", - "permanent": false - }, - { - "source": "/application-development:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "python" - } - ], - "destination": "/dev-guide/python", - "permanent": false - }, - { - "source": "/application-development:path*", - "has": [ - { - "type": "query", - "key": "lang", - "value": "typescript" - } - ], - "destination": "/dev-guide/typescript", - "permanent": false - }, - { - "source": "/application-development/foundations", - "destination": "/dev-guide" - }, - { - "source": "/application-development/features", - "destination": "/dev-guide" - }, - { - "source": "/application-development/observability", - "destination": "/dev-guide" - }, - { - "source": "/application-development/testing", - "destination": "/dev-guide" - }, - { - "source": "/application-development", - "destination": "/dev-guide" - }, - { - "source": "/dev-guide/golang/versioning:path*", - "destination": "/dev-guide/go/versioning:path*" - }, - { - "source": "/kb", - "destination": "https://docs.temporal.io" - }, - { - "source": "/changelog", - "destination": "https://temporal.io/change-log" - }, - { - "source": "/blog/how-datadog-ensures-database-reliability-with-temporal", - "destination": "https://temporal.io/case-studies/how-datadog-ensures-database-reliability-with-temporal" - }, - { - "source": "/blog/how-temporal-simplified-checkr-workflows", - "destination": "https://temporal.io/case-studies/how-temporal-simplified-checkr-workflows" - }, - { - "source": "/blog/descript-case-study/", - "destination": "https://temporal.io/case-studies/descript-case-study" - }, - { - "source": "/blog/reliable-crypto-transactions-at-coinbase", - "destination": "https://temporal.io/case-studies/reliable-crypto-transactions-at-coinbase" - }, - { - "source": "/blog/temporal-a-central-brain-for-box", - "destination": "https://temporal.io/case-studies/temporal-a-central-brain-for-box" - }, - { - "source": "/blog/tags/go-ecommerce-tutorial", - "destination": "https://learn.temporal.io/tutorials/go/ecommerce/" - }, - { - "source": "/blog/build-an-ecommerce-app-with-temporal-part-1/", - "destination": "https://learn.temporal.io/tutorials/go/ecommerce/build-an-ecommerce-app-with-temporal-part-1" - }, - { - "source": "/blog/build-an-ecommerce-app-with-temporal-part-2-reminder-emails", - "destination": "https://learn.temporal.io/tutorials/go/ecommerce/build-an-ecommerce-app-with-temporal-part-2-reminder-emails" - }, - { - "source": "/blog/build-an-ecommerce-app-with-temporal-part-3-testing", - "destination": "https://learn.temporal.io/tutorials/go/ecommerce/build-an-ecommerce-app-with-temporal-part-3-testing" - }, - { - "source": "/blog/build-an-ecommerce-app-with-temporal-part-4-rest-api", - "destination": "https://learn.temporal.io/tutorials/go/ecommerce/build-an-ecommerce-app-with-temporal-part-4-rest-api" - }, - { - "source": "/blog/typescript-1.0.0", - "destination": "https://temporal.io/blog/typescript-1-0-0" - }, - { - "source": "/blog/:path*", - "destination": "https://temporal.io/blog/:path*" - }, - { - "source": "/temporal-explained", - "destination": "/temporal" - }, - { - "source": "/concepts/introduction", - "destination": "/temporal" - }, - { - "source": "/concepts/workflows", - "destination": "/workflows" - }, - { - "source": "/concepts/activities", - "destination": "/activities" - }, - { - "source": "/concepts/signals", - "destination": "/signals" - }, - { - "source": "/concepts/queries", - "destination": "/workflows#queries" - }, - { - "source": "/concepts/task-queues", - "destination": "/workers" - }, - { - "source": "/concepts/what-is-a-retry-policy/#visualizing-retry-policies", - "destination": "/dev-guide/activity-retry-simulator" - }, - { - "source": "/retry-policies/#visualizing-retry-policies", - "destination": "/dev-guide/activity-retry-simulator" - }, - { - "source": "/application-development/features#activity-retry-simulator", - "destination": "/dev-guide/activity-retry-simulator" - }, - { - "source": "/temporal-explained/introduction", - "destination": "/temporal" - }, - { - "source": "/temporal-explained/workflows", - "destination": "/workflows" - }, - { - "source": "/temporal-explained/activities", - "destination": "/activities" - }, - { - "source": "/temporal-explained/task-queues-and-workers", - "destination": "/workers" - }, - { - "source": "/temporal-explained/signals-and-queries", - "destination": "/workflows#signals" - }, - { - "source": "/temporal-explained/timeouts-and-retries", - "destination": "/retry-policies" - }, - { - "source": "/temporal-explained/visibility", - "destination": "/visibility" - }, - { - "source": "/content/:path(what-is-.*)", - "destination": "/concepts/:path" - }, - { - "source": "/node/:path*", - "destination": "/typescript/:path*" - }, - { - "source": "/typescript/getting-started", - "destination": "/typescript/introduction#getting-started" - }, - { - "source": "/typescript", - "destination": "/typescript/introduction" - }, - { - "source": "/content/how-to-develop-a-worker-program-in-typescript", - "destination": "/typescript/run-a-dev-worker" - }, - { - "source": "/go/run-your-first-app-tutorial", - "destination": "https://learn.temporal.io/getting_started/go/first_program_in_go/" - }, - { - "source": "/java/run-your-first-app-tutorial", - "destination": "https://learn.temporal.io/getting_started/java/first_program_in_java/" - }, - { - "source": "/go/hello-world-tutorial", - "destination": "https://learn.temporal.io/getting_started/go/hello_world_in_go/" - }, - { - "source": "/java/hello-world-tutorial", - "destination": "https://learn.temporal.io/getting_started/java/hello_world_in_java/" - }, - { - "source": "/php/hello-world", - "destination": "https://learn.temporal.io/getting_started/php/hello_world_in_php/" - }, - { - "source": "/typescript/hello-world", - "destination": "https://learn.temporal.io/getting_started/typescript/hello_world_in_typescript/" - }, - { - "source": "/php/booking-saga-tutorial", - "destination": "https://learn.temporal.io/tutorials/php/booking_saga/" - }, - { - "source": "/php/subscription-tutorial", - "destination": "https://learn.temporal.io/tutorials/php/subscriptions/" - }, - { - "source": "/typescript/subscription-tutorial", - "destination": "https://learn.temporal.io/tutorials/typescript/subscriptions/" - }, - { - "source": "/typescript/chatbot-tutorial", - "destination": "https://learn.temporal.io/tutorials/typescript/chatbot/" - }, - { - "source": "/typescript/nextjs-tutorial", - "destination": "https://learn.temporal.io/tutorials/typescript/nextjs/" - }, - { - "source": "/learning-paths/background-checks/project-narrative", - "destination": "https://learn.temporal.io/examples/go/background-checks/" - }, - { - "source": "/learning-paths/background-checks/how-to-use", - "destination": "https://learn.temporal.io/examples/go/background-checks/how-to-use" - }, - { - "source": "/learning-paths/background-checks/application-requirements", - "destination": "https://learn.temporal.io/examples/go/background-checks/application-requirements" - }, - { - "source": "/learning-paths/background-checks/application-design", - "destination": "https://learn.temporal.io/examples/go/background-checks/application-design" - }, - { - "source": "/learning-paths/background-checks/main-background-check", - "destination": "https://learn.temporal.io/examples/go/background-checks/main-background-check" - }, - { - "source": "/learning-paths/background-checks/candidate-acceptance", - "destination": "https://learn.temporal.io/examples/go/background-checks/candidate-acceptance" - }, - { - "source": "/learning-paths/background-checks/ssn-trace", - "destination": "https://learn.temporal.io/examples/go/background-checks/ssn-trace" - }, - { - "source": "/learning-paths/background-checks/federal-criminal-search", - "destination": "https://learn.temporal.io/examples/go/background-checks/federal-criminal-search" - }, - { - "source": "/learning-paths/background-checks/state-criminal-search", - "destination": "https://learn.temporal.io/examples/go/background-checks/state-criminal-search" - }, - { - "source": "/learning-paths/background-checks/motor-vehicle-search", - "destination": "https://learn.temporal.io/examples/go/background-checks/motor-vehicle-search" - }, - { - "source": "/learning-paths/background-checks/employment-verification", - "destination": "https://learn.temporal.io/examples/go/background-checks/employment-verification" - }, - { - "source": "/learning-paths/background-checks/application-deployment", - "destination": "https://learn.temporal.io/examples/go/background-checks/application-deployment" - }, - { - "source": "/learning-paths/background-checks/api-reference", - "destination": "https://learn.temporal.io/examples/go/background-checks/api-reference" - }, - { - "source": "/learning-paths/background-checks/cli-reference", - "destination": "https://learn.temporal.io/examples/go/background-checks/cli-reference" - }, - { - "source": "/go/getting-started", - "destination": "/go" - }, - { - "source": "/go/introduction", - "destination": "/go" - }, - { - "source": "/go-activities", - "destination": "/dev-guide/go/foundations#develop-activities" - }, - { - "source": "/go/activities", - "destination": "/dev-guide/go/foundations#develop-activities" - }, - { - "source": "/go/how-to-develop-an-activity-in-go", - "destination": "/dev-guide/go/foundations#develop-activities" - }, - { - "source": "/go/how-to-spawn-an-activity-execution-in-go", - "destination": "/dev-guide/go/foundations#activity-execution" - }, - { - "source": "/go/how-to-get-the-result-of-an-activity-execution-in-go", - "destination": "/dev-guide/go/foundations#get-activity-results" - }, - { - "source": "/go/how-to-heartbeat-an-activity-in-go", - "destination": "/dev-guide/go/features#activity-heartbeats" - }, - { - "source": "/go/child-workflows", - "destination": "/dev-guide/go/features#child-workflows" - }, - { - "source": "/go/how-to-spawn-a-child-workflow-execution-in-go", - "destination": "/dev-guide/go/features#child-workflows" - }, - { - "source": "/go-continue-as-new", - "destination": "/go/how-to-continue-as-new-in-go" - }, - { - "source": "/go/continue-as-new", - "destination": "/go/how-to-continue-as-new-in-go" - }, - { - "source": "/go-create-workflows", - "destination": "/dev-guide/go/foundations#develop-workflows" - }, - { - "source": "/go/create-workflows", - "destination": "/dev-guide/go/foundations#develop-workflows" - }, - { - "source": "/go/workflows", - "destination": "/dev-guide/go/foundations#develop-workflows" - }, - { - "source": "/go/how-to-develop-a-workflow-in-go", - "destination": "/dev-guide/go/foundations#develop-workflows" - }, - { - "source": "/go/how-to-spawn-a-workflow-execution-in-go", - "destination": "/dev-guide/go/foundations#start-workflow-execution" - }, - { - "source": "/go/how-to-get-the-result-of-a-workflow-execution-in-go", - "destination": "/dev-guide/go/foundations#get-workflow-results" - }, - { - "source": "/go/distributed-cron", - "destination": "/dev-guide/go/features#temporal-cron-jobs" - }, - { - "source": "/go-error-handling", - "destination": "/go/error-handling" - }, - { - "source": "/go-hello-world", - "destination": "https://learn.temporal.io/getting_started/go/hello_world_in_go/" - }, - { - "source": "/go/queries", - "destination": "/dev-guide/go/features#queries" - }, - { - "source": "/go/retries", - "destination": "/dev-guide/go/features#activity-timeouts" - }, - { - "source": "/go-run-your-first-app", - "destination": "https://learn.temporal.io" - }, - { - "source": "/go-sdk-video-tutorial", - "destination": "https://learn.temporal.io" - }, - { - "source": "/go-search-apis", - "destination": "/go/search-apis" - }, - { - "source": "/go-selectors", - "destination": "/go/selectors" - }, - { - "source": "/go/sessions", - "destination": "/go/how-to-create-a-worker-session-in-go" - }, - { - "source": "/go/side-effects", - "destination": "/go/how-to-execute-a-side-effect-in-go" - }, - { - "source": "/go/signals", - "destination": "/dev-guide/go/features#signals" - }, - { - "source": "/go/how-to-use-signals-in-go", - "destination": "/dev-guide/go/features#signals" - }, - { - "source": "/go/how-to-send-a-signal-to-a-workflow-execution-in-go", - "destination": "/dev-guide/go/features#signals" - }, - { - "source": "/go/how-to-handle-a-signal-in-a-workflow-in-go", - "destination": "/dev-guide/go/features#signals" - }, - { - "source": "/go-sync-vs-async-start", - "destination": "/go/sync-vs-async-start" - }, - { - "source": "/go/sync-vs-async-start", - "destination": "/go/workflows/#how-to-start-a-workflow" - }, - { - "source": "/go/task-queues", - "destination": "/workers" - }, - { - "source": "/go/testing", - "destination": "/go/how-to-test-workflow-definitions-in-go" - }, - { - "source": "/go-tracing", - "destination": "/go/tracing" - }, - { - "source": "/go-tutorial-prerequisites", - "destination": "/go/tutorial-prerequisites" - }, - { - "source": "/go-versioning", - "destination": "/go/versioning" - }, - { - "source": "/go-workflows", - "destination": "/go/workflows" - }, - { - "source": "/go/workers", - "destination": "/dev-guide/go/foundations#run-a-dev-worker" - }, - { - "source": "/go/how-to-develop-a-worker-program-in-go", - "destination": "/dev-guide/go/foundations#run-a-dev-worker" - }, - { - "source": "/go/how-to-develop-a-worker-in-go", - "destination": "/dev-guide/go/foundations#run-a-dev-worker" - }, - { - "source": "/go-execute-activity", - "destination": "/dev-guide/go/foundations#activity-execution" - }, - { - "source": "/go-activity-async-completion", - "destination": "/go/activities#asynchronous-activity-completion" - }, - { - "source": "/go/how-to-set-startworkflowoptions-in-go", - "destination": "/go/startworkflowoptions-reference" - }, - { - "source": "/go/how-to-set-activityoptions-in-go", - "destination": "/go/activityoptions-reference" - }, - { - "source": "/java/introduction", - "destination": "/java" - }, - { - "source": "/java-activities", - "destination": "/java/activities" - }, - { - "source": "/java-distributed-cron", - "destination": "/java/distributed-cron" - }, - { - "source": "/java-hello-world", - "destination": "https://learn.temporal.io" - }, - { - "source": "/java/implementing-workflows", - "destination": "/java/workflows" - }, - { - "source": "/java-implementing-workflows", - "destination": "/java/workflows" - }, - { - "source": "/java-queries", - "destination": "/java/queries" - }, - { - "source": "/java-quick-start", - "destination": "/java/quick-start" - }, - { - "source": "/java-run-your-first-app", - "destination": "https://learn.temporal.io" - }, - { - "source": "/java-signals", - "destination": "/java/signals" - }, - { - "source": "/java-start-workflow-execution", - "destination": "/java/workflows" - }, - { - "source": "/java/start-workflow-execution", - "destination": "/java/workflows" - }, - { - "source": "/java-task-queues", - "destination": "/java/task-queues" - }, - { - "source": "/java-testing-and-debugging:path*", - "destination": "/java/testing:path*" - }, - { - "source": "/java/testing-and-debugging:path*", - "destination": "/java/testing:path*" - }, - { - "source": "/java-sdk-tutorial-prerequisites", - "destination": "https://learn.temporal.io" - }, - { - "source": "/java-versioning", - "destination": "/java/versioning" - }, - { - "source": "/java-workers", - "destination": "/java/workers" - }, - { - "source": "/java/workflow-interface", - "destination": "/java/workflows" - }, - { - "source": "/java-workflow-interface", - "destination": "/java/workflows" - }, - { - "source": "/java/starting-workflow-executions", - "destination": "/java/workflows" - }, - { - "source": "/content/how-to-provide-an-authorization-token-in-java", - "destination": "/java/how-to-provide-an-authorization-token-in-java" - }, - { - "source": "/content/how-to-develop-a-worker-program-in-java", - "destination": "/java/how-to-develop-a-worker-program-in-java" - }, - { - "source": "/php", - "destination": "/dev-guide/php" - }, - { - "source": "/php-sdk-overview", - "destination": "/dev-guide/php" - }, - { - "source": "/php-sdk-introduction", - "destination": "/dev-guide/php" - }, - { - "source": "/php-activities", - "destination": "/php/activities" - }, - { - "source": "/php-activity-async-completion", - "destination": "/php/activities/#async-completion" - }, - { - "source": "/php-activity-interface", - "destination": "/php/activities/#activity-interface" - }, - { - "source": "/php-child-workflows", - "destination": "/php/workflows/#child-workflows" - }, - { - "source": "/php-continue-as-new", - "destination": "/php/workflows/#large-event-histories" - }, - { - "source": "/php-distributed-cron", - "destination": "/php/distributed-cron" - }, - { - "source": "/php-error-handling", - "destination": "/php/error-handling" - }, - { - "source": "/php-implementing-activities", - "destination": "/php/activities/#implementing-activities" - }, - { - "source": "/php-implementing-workflows", - "destination": "/php/workflows/#implementing-workflows" - }, - { - "source": "/workflow-interface", - "destination": "/php/workflows" - }, - { - "source": "/php-workflows", - "destination": "/php/workflows" - }, - { - "source": "/php-queries", - "destination": "/php/queries" - }, - { - "source": "/php-retries", - "destination": "/php/retries" - }, - { - "source": "/php-side-effect", - "destination": "/php/side-effect" - }, - { - "source": "/php-signals", - "destination": "/php/signals" - }, - { - "source": "/php-sync-vs-async-start", - "destination": "/php/workflows/#starting-workflows" - }, - { - "source": "/php-task-queues", - "destination": "/php/task-queues" - }, - { - "source": "/content/how-to-develop-a-worker-program-in-php", - "destination": "/dev-guide/php/foundations#run-a-dev-worker" - }, - { - "source": "/php/how-to-develop-a-worker-program-in-php", - "destination": "/dev-guide/php/foundations#run-a-dev-worker" - }, - { - "source": "/server", - "destination": "/clusters/" - }, - { - "source": "/server/configuration", - "destination": "/references/configuration" - }, - { - "source": "/server-archive-data", - "destination": "/clusters#" - }, - { - "source": "/server/archive-data", - "destination": "/clusters#archival" - }, - { - "source": "/clusters/how-to-set-up-archival", - "destination": "/self-hosted-guide/archival" - }, - { - "source": "/clusters/how-to-create-a-custom-archiver", - "destination": "/self-hosted-guide/archival" - }, - { - "source": "/server-configuration", - "destination": "/references/configuration" - }, - { - "source": "/server-introduction", - "destination": "/clusters" - }, - { - "source": "/server/introduction", - "destination": "/clusters" - }, - { - "source": "/server-namespaces", - "destination": "/namespaces" - }, - { - "source": "/server/namespaces", - "destination": "/namespaces" - }, - { - "source": "/server/multi-cluster", - "destination": "/clusters#multi-cluster-replication" - }, - { - "source": "/clusters/how-to-set-up-multi-cluster-replication", - "destination": "/self-hosted-guide/multi-cluster-replication" - }, - { - "source": "/server-options", - "destination": "/references/server-options" - }, - { - "source": "/server/options", - "destination": "/references/server-options" - }, - { - "source": "/server-production-deploy", - "destination": "/production-deployment" - }, - { - "source": "/server-production-deployment", - "destination": "production-deployment" - }, - { - "source": "/server/production-deploy", - "destination": "/production-deployment" - }, - { - "source": "/server-quick-install", - "destination": "/dev-guide" - }, - { - "source": "/server/quick-install", - "destination": "/dev-guide" - }, - { - "source": "/clusters/quick-install", - "destination": "/dev-guide" - }, - { - "source": "/server/security", - "destination": "/security" - }, - { - "source": "/cluster/how-to-deploy-temporal-to-kubernetes-for-testing-and-development", - "destination": "/kb/all-the-ways-to-run-a-cluster#helm-charts" - }, - { - "source": "/cluster/how-to-quickly-install-the-temporal-cluster-using-docker-compose", - "destination": "/kb/all-the-ways-to-run-a-cluster#docker--docker-compose" - }, - { - "source": "/content/how-to-deploy-temporal-to-kubernetes-for-testing-and-development", - "destination": "/kb/all-the-ways-to-run-a-cluster#helm-charts" - }, - { - "source": "/content/how-to-quickly-install-the-temporal-server", - "destination": "/kb/all-the-ways-to-run-a-cluster" - }, - { - "source": "/content/how-to-integrate-elasticsearch-into-a-temporal-cluster", - "destination": "/self-hosted-guide/visibility" - }, - { - "source": "/cluster/how-to-integrate-elasticsearch-into-a-temporal-cluster", - "destination": "/self-hosted-guide/visibility" - }, - { - "source": "/clusters/how-to-integrate-elasticsearch-into-a-temporal-cluster", - "destination": "/self-hosted-guide/visibility" - }, - { - "source": "/server-security", - "destination": "/security" - }, - { - "source": "/server-versions-and-dependencies", - "destination": "/clusters" - }, - { - "source": "/server/workflow-search", - "destination": "/visibility" - }, - { - "source": "/content/how-to-remove-a-search-attribute-from-a-cluster-using-tctl", - "destination": "https://docs.temporal.io/dev-guide/go/observability#remove-search-attribute" - }, - { - "source": "/operation/how-to-tune-workers", - "destination": "/dev-guide/worker-performance" - }, - { - "source": "/cadence-to-temporal", - "destination": "/kb/cadence-to-temporal" - }, - { - "source": "/kb/install-temporal-cluster-for-development", - "destination": "/kb/all-the-ways-to-run-a-cluster" - }, - { - "source": "/kb/install-temporal-cluster-for-development", - "destination": "/kb/all-the-ways-to-run-a-cluster" - }, - { - "source": "/tctl", - "destination": "/tctl-v1" - }, - { - "source": "/references/ui-configuration", - "destination": "/references/web-ui-configuration" - }, - { - "source": "/cloud/tcld/account/get", - "destination": "/cloud/tcld/account#get" - }, - { - "source": "/cloud/tcld/account/metrics/", - "destination": "/cloud/tcld/account#metrics" - }, - { - "source": "/cloud/tcld/account/metrics/enable", - "destination": "/cloud/tcld/account#enable" - }, - { - "source": "/cloud/tcld/account/metrics/disable", - "destination": "/cloud/tcld/account#disable" - }, - { - "source": "/cloud/tcld/account/metrics/accepted-client-ca/", - "destination": "/cloud/tcld/account#accepted-client-ca" - }, - { - "source": "/cloud/tcld/account/metrics/accepted-client-ca/add", - "destination": "/cloud/tcld/account#add" - }, - { - "source": "/cloud/tcld/account/metrics/accepted-client-ca/list", - "destination": "/cloud/tcld/account#list" - }, - { - "source": "/cloud/tcld/account/metrics/accepted-client-ca/set", - "destination": "/cloud/tcld/account#set" - }, - { - "source": "/cloud/tcld/account/metrics/accepted-client-ca/remove", - "destination": "/cloud/tcld/account#remove" - }, - { - "source": "/cloud/tcld/account/metrics/accepted-client-ca/remove", - "destination": "/cloud/tcld/account#remove" - }, - { - "source": "/cloud/tcld/namespace/list", - "destination": "/cloud/tcld/namespace#list" - }, - { - "source": "/cloud/tcld/namespace/get", - "destination": "/cloud/tcld/namespace#get" - }, - { - "source": "/cloud/tcld/namespace/accepted-client-ca/", - "destination": "/cloud/tcld/namespace#accepted-client-ca" - }, - { - "source": "/cloud/tcld/namespace/accepted-client-ca/add", - "destination": "/cloud/tcld/namespace#add" - }, - { - "source": "/cloud/tcld/namespace/accepted-client-ca/list", - "destination": "/cloud/tcld/namespace#list-1" - }, - { - "source": "/cloud/tcld/namespace/accepted-client-ca/set", - "destination": "/cloud/tcld/namespace#set" - }, - { - "source": "/cloud/tcld/namespace/accepted-client-ca/remove", - "destination": "/cloud/tcld/namespace#remove" - }, - { - "source": "/cloud/tcld/namespace/certificate-filters/", - "destination": "/cloud/tcld/namespace#certificate-filters" - }, - { - "source": "/cloud/tcld/namespace/certificate-filters/import", - "destination": "/cloud/tcld/namespace#import" - }, - { - "source": "/cloud/tcld/namespace/certificate-filters/export", - "destination": "/cloud/tcld/namespace#export" - }, - { - "source": "/cloud/tcld/namespace/certificate-filters/clear", - "destination": "/cloud/tcld/namespace#clear" - }, - { - "source": "/cloud/tcld/namespace/search-attributes/", - "destination": "/cloud/tcld/namespace#search-attributes" - }, - { - "source": "/cloud/tcld/namespace/search-attributes/add", - "destination": "/cloud/tcld/namespace#add-1" - }, - { - "source": "/cloud/tcld/namespace/search-attributes/rename", - "destination": "/cloud/tcld/namespace#rename" - }, - { - "source": "/cloud/tcld/request/get", - "destination": "/cloud/tcld/request#get" - }, - { - "source": "/cloud/operating-envelope", - "destination": "/cloud/service-availability" - }, - { - "source": "/external-resources", - "destination": "/kb/additional-resources" - }, - { - "source": "/concepts/what-is-an-activity", - "destination": "/activities" - }, - { - "source": "/concepts/what-is-an-activity-definition", - "destination": "/activities#activity-definition" - }, - { - "source": "/concepts/what-is-an-activity-execution", - "destination": "/activities#activity-execution" - }, - { - "source": "/concepts/what-is-an-activity-heartbeat", - "destination": "/activities#activity-heartbeat" - }, - { - "source": "/concepts/what-is-an-activity-id", - "destination": "/activities#activity-id" - }, - { - "source": "/concepts/what-is-an-activity-task", - "destination": "/workers#activity-task" - }, - { - "source": "/concepts/what-is-an-activity-task-execution", - "destination": "/workers#activity-task-execution" - }, - { - "source": "/concepts/what-is-an-activity-type", - "destination": "/activities#activity-type" - }, - { - "source": "/concepts/what-is-advanced-visibility", - "destination": "/visibility#advanced-visibility" - }, - { - "source": "/concepts/what-is-archival", - "destination": "/clusters#archival" - }, - { - "source": "/concepts/what-is-a-child-workflow-execution", - "destination": "/workflows#child-workflow" - }, - { - "source": "/concepts/what-is-a-command", - "destination": "/workflows#command" - }, - { - "source": "/concepts/what-is-continue-as-new", - "destination": "/workflows#continue-as-new" - }, - { - "source": "/concepts/what-is-a-cloud-namespace-name", - "destination": "/cloud/namespaces#temporal-cloud-namespace-name" - }, - { - "source": "/concepts/what-is-a-data-converter", - "destination": "/security#data-converter" - }, - { - "source": "/concepts/what-is-an-event", - "destination": "/workflows#event" - }, - { - "source": "/concepts/what-is-an-event-history", - "destination": "/workflows#event-history" - }, - { - "source": "/concepts/what-is-a-failure", - "destination": "/temporal#failure" - }, - { - "source": "/concepts/what-is-a-heartbeat-timeout", - "destination": "/activities#heartbeat-timeout" - }, - { - "source": "/concepts/what-is-a-list-filter", - "destination": "/visibility#list-filter" - }, - { - "source": "/concepts/what-is-a-local-activity", - "destination": "/activities#local-activity" - }, - { - "source": "/concepts/what-is-a-memo", - "destination": "/workflows#memo" - }, - { - "source": "/concepts/what-is-a-namespace", - "destination": "/namespaces" - }, - { - "source": "/concepts/what-is-a-parent-close-policy", - "destination": "/workflows#parent-close-policy" - }, - { - "source": "/concepts/what-is-a-query", - "destination": "/workflows#query" - }, - { - "source": "/concepts/what-is-a-run-id", - "destination": "/workflows#run-id" - }, - { - "source": "/concepts/what-is-a-schedule-to-close-timeout", - "destination": "/activities#schedule-to-close-timeout" - }, - { - "source": "/concepts/what-is-a-schedule-to-start-timeout", - "destination": "/activities#schedule-to-start-timeout" - }, - { - "source": "/concepts/what-is-a-run-id", - "destination": "/workflows#run-id" - }, - { - "source": "/concepts/what-is-a-search-attribute", - "destination": "/visibility#search-attribute" - }, - { - "source": "/concepts/what-is-a-side-effect", - "destination": "/workflows#side-effect" - }, - { - "source": "/concepts/what-is-a-signal", - "destination": "/workflows#signal" - }, - { - "source": "/concepts/what-is-standard-visibility", - "destination": "/visibility#standard-visibility" - }, - { - "source": "/concepts/what-is-a-start-to-close-timeout", - "destination": "/activities#start-to-close-timeout" - }, - { - "source": "/concepts/what-is-a-start-to-close-timeout", - "destination": "/activities#start-to-close-timeout" - }, - { - "source": "/concepts/what-is-a-sticky-execution", - "destination": "/workers#sticky-execution" - }, - { - "source": "/concepts/what-is-a-task-queue", - "destination": "/workers#task-queue" - }, - { - "source": "/concepts/what-is-task-routing", - "destination": "/workers#task-routing" - }, - { - "source": "/concepts/what-is-a-task-token", - "destination": "/activities#task-token" - }, - { - "source": "/concepts/what-is-a-task", - "destination": "/workers" - }, - { - "source": "/concepts/what-is-temporal", - "destination": "/temporal" - }, - { - "source": "/concepts/what-is-a-temporal-application", - "destination": "/temporal#temporal-application" - }, - { - "source": "/concepts/what-is-a-temporal-cluster", - "destination": "/clusters" - }, - { - "source": "/concepts/what-is-a-temporal-cron-job", - "destination": "/workflows#temporal-cron-job" - }, - { - "source": "/concepts/what-is-the-temporal-platform", - "destination": "/temporal#temporal-platform" - }, - { - "source": "/concepts/what-is-a-temporal-sdk", - "destination": "/temporal#temporal-sdk" - }, - { - "source": "/concepts/what-is-a-worker", - "destination": "/workers" - }, - { - "source": "/concepts/what-is-a-worker-entity", - "destination": "/workers#worker-entity" - }, - { - "source": "/concepts/what-is-a-worker-process", - "destination": "/workers#worker-process" - }, - { - "source": "/concepts/what-is-a-worker-program", - "destination": "/workers#worker-program" - }, - { - "source": "/concepts/what-is-a-workflow", - "destination": "/workflows" - }, - { - "source": "/concepts/what-is-a-workflow-definition", - "destination": "/workflows#workflow-definition" - }, - { - "source": "/concepts/what-is-a-workflow-execution", - "destination": "/workflows#workflow-execution" - }, - { - "source": "/concepts/what-is-a-workflow-execution-timeout", - "destination": "/workflows#workflow-execution-timeout" - }, - { - "source": "/concepts/what-is-a-workflow-id-reuse-policy", - "destination": "/workflows#workflow-id-reuse-policy" - }, - { - "source": "/concepts/what-is-a-workflow-id", - "destination": "/workflows#workflow-id" - }, - { - "source": "/concepts/what-is-a-workflow-run-timeout", - "destination": "/workflows#workflow-run-timeout" - }, - { - "source": "/concepts/what-is-a-workflow-task", - "destination": "/workflows#workflow-task-timeout" - }, - { - "source": "/concepts/what-is-a-workflow-task-execution", - "destination": "/workers#workflow-task-execution" - }, - { - "source": "/concepts/what-is-a-workflow-task-timeout", - "destination": "/workflows#workflow-task-timeout" - }, - { - "source": "/concepts/what-is-a-workflow-type", - "destination": "/workflows#workflow-type" - }, - { - "source": "/content/how-to-add-a-custom-search-attribute-to-a-cluster-using-tctl", - "destination": "/self-hosted-guide/visibility" - }, - { - "source": "archive-data", - "destination": "/cluster-deployment-guide#archival" - }, - { - "source": "/blog/airbyte-case-study/", - "destination": "https://temporal.io/case-studies/airbyte-case-study" - }, - { - "source": "/blog/build-an-ecommerce-app-with-temporal-part-1/", - "destination": "https://learn.temporal.io/tutorials/go/ecommerce/build-an-ecommerce-app-with-temporal-part-1" - }, - { - "source": "/blog/descript-case-study/", - "destination": "https://temporal.io/case-studies/descript-case-study" - }, - { - "source": "/blog/tags/case-study", - "destination": "https://temporal.io/use-cases" - }, - { - "source": "/blog/zebra-medical-case-study/", - "destination": "https://temporal.io/case-studies/zebra-medical-case-study" - }, - { - "source": "/clusters/how-to-upgrade-the-temporal-server-version", - "destination": "/cluster-deployment-guide#upgrade-server" - }, - { - "source": "/concepts/what-is-a-claimmapper-plugin", - "destination": "/security#claim-mapper" - }, - { - "source": "/concepts/what-is-a-claimmapper-plugin/#default-jwt-claimmapper", - "destination": "/security#default-jwt-claimmapper" - }, - { - "source": "/concepts/what-is-a-retention-period", - "destination": "clusters#retention-period" - }, - { - "source": "/concepts/what-is-multi-cluster-replication", - "destination": "/clusters#multi-cluster-replication" - }, - { - "source": "/configure-temporal-server", - "destination": "/references/configuration" - }, - { - "source": "/configuring-temporal-server", - "destination": "/references/configuration" - }, - { - "source": "/archive-data#providers", - "destination": "/cluster-deployment-guide#provider" - }, - { - "source": "/configure-temporal-server#membership---required", - "destination": "/blog/workflow-engine-principles#membership-and-routing-1350" - }, - { - "source": "/configuring-temporal-server#clustermetadata", - "destination": "/references/configuration#clustermetadata" - }, - { - "source": "/filter-workflows", - "destination": "/visibility#list-filter" - }, - { - "source": "/go-queries", - "destination": "/dev-guide/go/features#queries" - }, - { - "source": "/go-sessions", - "destination": "/dev-guide/go" - }, - { - "source": "/go-sessions#use-cases", - "destination": "/dev-guide/go" - }, - { - "source": "/go-workers", - "destination": "/dev-guide/go/foundations#develop-worker" - }, - { - "source": "/go/how-to-develop-a-workflow-definition-in-go#workflow-logic-requirements-in-go", - "destination": "/dev-guide/go/foundations#develop-workflows" - }, - { - "source": "/go/side-effect", - "destination": "/dev-guide/go/features#side-effects" - }, - { - "source": "/install-temporal-server", - "destination": "/clusters#temporal-server" - }, - { - "source": "/java-quick-start", - "destination": "/dev-guide/java" - }, - { - "source": "/java/how-to-provide-an-authorization-token-in-java", - "destination": "/security#authorizer-plugin" - }, - { - "source": "/learn-archival", - "destination": "/clusters#archival" - }, - { - "source": "/learn-cli", - "destination": "/cli" - }, - { - "source": "/learn-server-configuration#tls", - "destination": "/references/configuration#tls" - }, - { - "source": "/learn-workflow-filtering", - "destination": "/visibility#list-filter" - }, - { - "source": "/php-sdk-overview", - "destination": "/dev-guide/php" - }, - { - "source": "/queries", - "destination": "/workflows#query" - }, - { - "source": "/server-workflow-search", - "destination": "/visibility#search-attribute" - }, - { - "source": "/server/elasticsearch-setup", - "destination": "/cluster-deployment-guide#elasticsearch" - }, - { - "source": "/server/versions-and-dependencies", - "destination": "/clusters/#version-and-support" - }, - { - "source": "/shared/continue-as-new", - "destination": "/workflows#continue-as-new" - }, - { - "source": "/external-resources", - "destination": "https://docs.temporal.io" - }, - { - "source": "/filter-workflows", - "destination": "/visibility#list-filter" - }, - { - "source": "/go/how-to-develop-a-workflow-definition-in-go", - "destination": "/dev-guide/go/foundations#develop-workflows" - }, - { - "source": "/learn-server-configuration", - "destination": "/references/configuration" - }, - { - "source": "/next/java/how-to-develop-an-activity-in-java", - "destination": "/dev-guide/java/foundations#develop-activities" - }, - { - "source": "/next/java/how-to-develop-an-activity-in-java/#return-values", - "destination": "/dev-guide/java/foundations#workflow-return-values" - }, - { - "source": "/php/versioning", - "destination": "/dev-guide/php" - }, - { - "source": "/php/versioning#workflowgetversion", - "destination": "/dev-guide/php" - }, - { - "source": "/server-architecture", - "destination": "/security#authorizer-plugin" - }, - { - "source": "/tctl-next", - "destination": "/cli" - }, - { - "source": "/tctl-next/modifiers#--event-id", - "destination": "/cli/workflow#reset" - }, - { - "source": "/tctl-next/workflow#reset", - "destination": "/cli/workflow#reset" - }, - { - "source": "/java/quick-start", - "destination": "/dev-guide/java" - }, - { - "source": "/typescript/versioning", - "destination": "/dev-guide/typescript/versioning" - }, - { - "source": "/typescript/:path*", - "destination": "/dev-guide/typescript" - }, - { - "source": "/go/:path*", - "destination": "/dev-guide/go" - }, - { - "source": "/java/:path*", - "destination": "/dev-guide/java" - }, - { - "source": "/python/:path*", - "destination": "/dev-guide/python" - }, - { - "source": "/concepts/what-is-a-retry-policy", - "destination": "/retry-policies" - }, - { - "source": "/php/introduction", - "destination": "/dev-guide/php" - }, - { - "source": "/external-resources/#how-temporal-works", - "destination": "/kb/how-to-explain-temporal#how-temporal-works" - }, - { - "source": "/application-development/worker-performance", - "destination": "/dev-guide/worker-performance" - }, - { - "source": "/cli/index", - "destination": "/cli" - }, - { - "source": "/php/activities#local-activity", - "destination": "/dev-guide/php/foundations#develop-activities" - }, - { - "source": "/cloud/index", - "destination": "/cloud" - }, - { - "source": "/cloud/account-setup/certificates:path*", - "destination": "/cloud/certificates:path*" - }, - { - "source": "/cloud/account-setup/namespaces:path*", - "destination": "/cloud/namespaces:path*" - }, - { - "source": "/cloud/account-setup/users:path*", - "destination": "/cloud/users:path*" - }, - { - "source": "/kb/cloud/how-to-manage-certificates-in-temporal-cloud:path*", - "destination": "/cloud/certificates:path*" - }, - { - "source": "/server/production-deployment/:path*", - "destination": "/production-deployment" - }, - { - "source": "/kb/legacy-oss-prod-deploy:path*", - "destination": "/production-deployment" - }, - { - "source": "/cloud/release-notes", - "destination": "https://temporal.io/change-log/product-area/cloud" - }, - { - "source": "/cloud/release-notes/:path*", - "destination": "https://temporal.io/change-log/product-area/cloud" - }, - { - "source": "/cloud/how-to-manage-namespaces-in-temporal-cloud:path*", - "destination": "/cloud/namespaces:path*" - }, - { - "source": "/cloud/how-to-manage-certificates-in-temporal-cloud:path*", - "destination": "/cloud/certificates:path*" - }, - { - "source": "/cloud/how-to-monitor-temporal-cloud-metrics", - "destination": "/cloud/metrics" - }, - { - "source": "/cloud/introduction/security-cloud:path*", - "destination": "cloud/security:path*" - }, - { - "source": "/cloud/introduction/operating-envelope:path*", - "destination": "cloud/operating-envelope:path*" - }, - { - "source": "/cloud/introduction/pricing:path*", - "destination": "/cloud/pricing:path*" - }, - { - "source": "/cloud/introduction/support:path*", - "destination": "/cloud/support:path*" - }, - { - "source": "/cloud/how-to-create-a-ticket-for-temporal-support", - "destination": "/cloud/support#support-ticket" - }, - { - "source": "/cloud/how-to-get-started-with-temporal-cloud:path*", - "destination": "/cloud/get-started:path*" - }, - { - "source": "/cloud/how-to-manage-saml-with-temporal-cloud:path*", - "destination": "/cloud/saml:path*" - }, - { - "source": "/cloud/how-to-manage-audit-logging:path*", - "destination": "/cloud/audit-logging:path*" - }, - { - "source": "/kb/prometheus-grafana-setup-cloud", - "destination": "/cloud/metrics#prometheus-and-grafana-setup" - }, - { - "source": "/kb/cloud-namespace-naming-considerations", - "destination": "/cloud/namespaces#best-practices" - }, - { - "source": "/typescript/versioning", - "destination": "/dev-guide/typescript/versioning" - }, - { - "source": "/java/quick-start", - "destination": "/dev-guide/java" - }, - { - "source": "/java/how-to-provide-an-authorization-token-in-java", - "destination": "/security#authorizer-plugin" - }, - { - "source": "/go/side-effect", - "destination": "/dev-guide/go/features#side-effects" - }, - { - "source": "/go/how-to-develop-a-workflow-definition-in-go", - "destination": "/dev-guide/go/foundations#develop-workflows" - }, - { - "source": "/tctl-next/workflow#reset", - "destination": "/cli/workflow#reset" - }, - { - "source": "/tctl-next/modifiers#--event-id", - "destination": "/cli/cmd-options#event-id" - }, - { - "source": "/php/versioning#workflowgetversion", - "destination": "/dev-guide/php" - }, - { - "source": "/php/activities#local-activity", - "destination": "/dev-guide/php/foundations#develop-activities" - }, - { - "source": "/kb/additional-resources", - "destination": "/kb/how-to-explain-temporal" - }, - { - "source": "/external-resources/#how-temporal-works", - "destination": "/kb/how-to-explain-temporal#how-temporal-works" - }, - { - "source": "/external-resources", - "destination": "/kb/how-to-explain-temporal" - }, - { - "source": "/go-sessions/#use-cases", - "destination": "/dev-guide/go/features#recreate-session" - }, - { - "source": "/configure-temporal-server#membership---required", - "destination": "/blog/workflow-engine-principles#membership-and-routing-1350" - }, - { - "source": "/archive-data#providers", - "destination": "/cluster-deployment-guide#providers" - }, - { - "source": "/concepts/what-is-a-retention-period", - "destination": "/clusters#retention-period" - }, - { - "source": "/archive-data", - "destination": "/cluster-deployment-guide#archival" - }, - { - "source": "/kb/non-determinism-issues-for-run-ids", - "destination": "/workflows#run-id" - }, - { - "source": "/kb/troubleshoot-last-connection-error", - "destination": "/troubleshooting/last-connection-error" - }, - { - "source": "/kb/deadline-exceeded-troubleshooting", - "destination": "/troubleshooting/deadline-exceeded-error" - }, - { - "source": "/kb/failures", - "destination": "/references/failures" - }, - { - "source": "/kb/temporal-platform-limits-sheet", - "destination": "/self-hosted-guide/defaults" - }, - { - "source": "/kb/all-the-ways-to-run-a-cluster", - "destination": "/self-hosted-guide" - }, - { - "source": "/kb/prometheus-grafana-setup", - "destination": "/self-hosted-guide/monitoring" - }, - { - "source": "/kb/python-sandbox-environment", - "destination": "/python/python-sandbox-environment" - }, - { - "source": "production-readiness/:path*", - "destination": "/self-hosted-guide" - }, - { - "source": "/kb/python-sandbox-environment", - "destination": "/python/python-sandbox-environment" - }, - { - "source": "/kb/cadence-to-temporal", - "destination": "https://community.temporal.io/t/cadence-to-temporal-migration-highlights/" - }, - { - "source": "/self-hosted-guide/data-encryption", - "destination": "/production-deployment/data-encryption" - }, - { - "source": "/temporal/release-stages", - "destination": "/evaluate/release-stages" - }, - { - "source": "/getting-started", - "destination": "https://learn.temporal.io/getting_started/" - }, - { - "source": "/concepts:path*", - "destination": "/encyclopedia" - }, - { - "source": "/dev-guide/sdks", - "destination": "/encyclopedia/temporal-sdks" - }, - { - "source": "/dev-guide/:path*/how-it-works", - "destination": "/encyclopedia/temporal-sdks" - }, - { - "source": "/dev-guide/go/multithreading", - "destination": "/encyclopedia/go-sdk-multithreading" - }, - { - "source": "/dev-guide/python/async-vs-sync", - "destination": "/encyclopedia/python-sdk-sync-vs-async" - }, - { - "source": "/dev-guide/python/sandbox", - "destination": "/encyclopedia/python-sdk-sandbox" - } - ] -} \ No newline at end of file From 4a671a77fa21481fad7340ae0ecdc27017b388f6 Mon Sep 17 00:00:00 2001 From: rachfop Date: Wed, 8 May 2024 10:51:34 -0700 Subject: [PATCH 02/26] Remove script --- docs/dev-guide/hi.py | 51 -------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 docs/dev-guide/hi.py diff --git a/docs/dev-guide/hi.py b/docs/dev-guide/hi.py deleted file mode 100644 index 5d26527676..0000000000 --- a/docs/dev-guide/hi.py +++ /dev/null @@ -1,51 +0,0 @@ -import os - -titles = [ - "Core application", - "Temporal Clients", - "Test suites", - "Failure detection", - "Messages", - "Runtime safeguards", - "Cancellation", - "Asynchronous Activity Completion", - "Versioning", - "Observability", - "Debugging", - "Schedules", - "Data encryption", - "Side Effects", - "Child Workflows", - "Continue-As-New", - "Timers", - "Interrupt a Workflow Execution" -] - -# Create a directory to store the .mdx files -os.makedirs("mdx", exist_ok=True) - -for index, title in enumerate(titles, start=1): - file_name = title.lower().replace(" ", "_") + ".mdx" - file_path = os.path.join("mdx", file_name) - - with open(file_path, "w") as file: - # Write metadata - file.write("---\n") - file.write(f"id: {title.lower().replace(' ', '-')}\n") - file.write(f"title: {title}\n") - file.write(f"sidebar_label: {title}\n") - file.write(f"sidebar_position: {index}\n") - file.write("description: \n") - file.write(f"slug: /dev-guide/python/{file_name[:-4]}\n") - file.write("toc_max_heading_level: 2\n") - file.write("keywords:\n") - file.write(f" - {title.lower().replace(' ', '-')}\n") - file.write("tags:\n") - file.write(f" - {title.lower().replace(' ', '-')}\n") - file.write("---\n\n") - - # Write title and content placeholder - file.write(f"# {title}\n\n") - file.write("{/* Content goes here */}\n") - -print("MDX files created successfully.") \ No newline at end of file From a09a90e5a58e1c6a6a96e827e9f1dc1046537ac2 Mon Sep 17 00:00:00 2001 From: rachfop Date: Wed, 8 May 2024 10:56:28 -0700 Subject: [PATCH 03/26] Warn on broken links build --- docs/dev-guide/python/timers.mdx | 2 +- docusaurus.config.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/dev-guide/python/timers.mdx b/docs/dev-guide/python/timers.mdx index 0f9d4c2a34..1364586eea 100644 --- a/docs/dev-guide/python/timers.mdx +++ b/docs/dev-guide/python/timers.mdx @@ -3,7 +3,7 @@ id: timers title: Timers sidebar_label: Timers sidebar_position: 17 -description: Learn how to use timers within Temporal workflows to delay execution, enabling durable and long-term scheduling of tasks that can persist even if the worker or cluster goes down. +description: Learn how to use timers within Temporal Workflows to delay execution, enabling durable and long-term scheduling of tasks that can persist even if the worker or cluster goes down. slug: /dev-guide/python/timers toc_max_heading_level: 2 keywords: diff --git a/docusaurus.config.js b/docusaurus.config.js index b45ebb3dde..718f1cd835 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -9,9 +9,9 @@ module.exports = async function createConfigAsync() { tagline: "Build invincible applications", url: "https://docs.temporal.io", baseUrl: "/", - onBrokenAnchors: "throw", - onBrokenLinks: "throw", - onBrokenMarkdownLinks: "throw", + onBrokenAnchors: "warn", + onBrokenLinks: "warn", + onBrokenMarkdownLinks: "warn", favicon: "img/favicon.svg", organizationName: "temporalio", // Usually your GitHub org/user name. projectName: "temporal-documentation", // Usually your repo name. From 25835bde3cfe5aed02cf35d31a2cb87dc03590ad Mon Sep 17 00:00:00 2001 From: rachfop Date: Wed, 8 May 2024 11:38:41 -0700 Subject: [PATCH 04/26] Update titles and subtitles --- docs/cli/index.mdx | 2 +- docs/dev-guide/golang/cancellation.mdx | 2 +- docs/dev-guide/golang/converters.mdx | 2 +- docs/dev-guide/golang/debugging.mdx | 2 +- docs/dev-guide/golang/durable-execution.mdx | 2 +- docs/dev-guide/golang/features.mdx | 2 +- docs/dev-guide/golang/foundations.mdx | 2 +- docs/dev-guide/golang/index.mdx | 2 +- docs/dev-guide/golang/introduction.mdx | 2 +- docs/dev-guide/golang/observability.mdx | 2 +- docs/dev-guide/golang/project-setup.mdx | 2 +- docs/dev-guide/golang/testing.mdx | 2 +- docs/dev-guide/golang/versioning.mdx | 2 +- docs/dev-guide/index.mdx | 2 +- docs/dev-guide/javalang/converters.mdx | 2 +- docs/dev-guide/javalang/debugging.mdx | 2 +- docs/dev-guide/javalang/durable-execution.mdx | 2 +- docs/dev-guide/javalang/features.mdx | 2 +- docs/dev-guide/javalang/foundations.mdx | 2 +- docs/dev-guide/javalang/index.mdx | 2 +- docs/dev-guide/javalang/introduction.mdx | 2 +- docs/dev-guide/javalang/observability.mdx | 2 +- docs/dev-guide/javalang/project-setup.mdx | 2 +- docs/dev-guide/javalang/testing.mdx | 2 +- docs/dev-guide/javalang/versioning.mdx | 2 +- docs/dev-guide/phplang/debugging.mdx | 2 +- docs/dev-guide/phplang/features.mdx | 2 +- docs/dev-guide/phplang/foundations.mdx | 2 +- docs/dev-guide/phplang/index.mdx | 2 +- docs/dev-guide/phplang/observability.mdx | 2 +- docs/dev-guide/phplang/testing.mdx | 2 +- .../asynchronous-activity-completion.mdx | 5 +- docs/dev-guide/python/cancellation.mdx | 3 +- docs/dev-guide/python/child-workflows.mdx | 9 ++- docs/dev-guide/python/continue-as-new.mdx | 5 +- docs/dev-guide/python/core-application.mdx | 57 +++++++++++----- docs/dev-guide/python/data-encryption.mdx | 1 - docs/dev-guide/python/debugging.mdx | 2 - docs/dev-guide/python/durable-execution.mdx | 1 - docs/dev-guide/python/failure-detection.mdx | 17 +++-- docs/dev-guide/python/foundations.mdx | 1 - docs/dev-guide/python/index.mdx | 2 +- docs/dev-guide/python/interrupt-workflow.mdx | 13 ++-- docs/dev-guide/python/introduction.mdx | 2 +- docs/dev-guide/python/messages.mdx | 50 ++++++++++---- docs/dev-guide/python/observability.mdx | 1 - docs/dev-guide/python/project-setup.mdx | 1 - docs/dev-guide/python/schedules.mdx | 45 +++++++++---- docs/dev-guide/python/temporal-clients.mdx | 65 ++++++++++++++----- docs/dev-guide/python/test-suites.mdx | 1 - docs/dev-guide/python/timers.mdx | 3 +- docs/dev-guide/python/versioning.mdx | 1 - docs/dev-guide/tscript/debugging.mdx | 2 +- docs/dev-guide/tscript/features.mdx | 2 +- docs/dev-guide/tscript/foundations.mdx | 2 +- docs/dev-guide/tscript/index.mdx | 2 +- docs/dev-guide/tscript/introduction.mdx | 2 +- docs/dev-guide/tscript/observability.mdx | 2 +- docs/dev-guide/tscript/project-setup.mdx | 2 +- docs/dev-guide/tscript/testing.mdx | 2 +- docs/dev-guide/tscript/versioning.mdx | 2 +- docs/encyclopedia/activities.mdx | 2 +- docs/encyclopedia/clusters.mdx | 2 +- docs/encyclopedia/dataconversion.mdx | 2 +- docs/encyclopedia/namespaces.mdx | 2 +- docs/encyclopedia/retry-policies.mdx | 2 +- docs/encyclopedia/temporal-sdks.mdx | 2 +- docs/encyclopedia/temporal.mdx | 2 +- docs/encyclopedia/visibility.mdx | 2 +- docs/encyclopedia/workers.mdx | 2 +- docs/encyclopedia/workflows.mdx | 2 +- docs/evaluate/index.mdx | 2 +- docs/evaluate/release-stages.mdx | 2 +- docs/evaluate/why-temporal.mdx | 2 +- docs/getting-started.mdx | 2 +- docs/index.mdx | 2 +- .../cloud/account-setup/certificates.mdx | 2 +- .../cloud/account-setup/index.mdx | 2 +- .../cloud/account-setup/namespaces.mdx | 2 +- .../cloud/account-setup/users.mdx | 2 +- docs/production-deployment/cloud/api-keys.mdx | 2 +- .../cloud/audit-logging.mdx | 2 +- docs/production-deployment/cloud/export.mdx | 2 +- .../cloud/get-started.mdx | 2 +- docs/production-deployment/cloud/index.mdx | 2 +- .../cloud/introduction/index.mdx | 2 +- .../cloud/introduction/limits.mdx | 2 +- .../cloud/introduction/overview.mdx | 2 +- .../cloud/introduction/pricing.mdx | 2 +- .../cloud/introduction/security.mdx | 2 +- .../introduction/service-availability.mdx | 2 +- .../cloud/introduction/sla.mdx | 2 +- .../cloud/introduction/support.mdx | 2 +- .../cloud/metrics/index.mdx | 2 +- .../cloud/operation-api.mdx | 2 +- docs/production-deployment/cloud/saml.mdx | 2 +- .../cloud/terraform-provider.mdx | 2 +- .../production-deployment/data-encryption.mdx | 2 +- docs/production-deployment/index.mdx | 2 +- docs/production-deployment/migration.mdx | 2 +- .../self-hosted-guide/archival.mdx | 2 +- .../self-hosted-guide/checklist.mdx | 2 +- .../self-hosted-guide/defaults.mdx | 2 +- .../self-hosted-guide/index.mdx | 2 +- .../self-hosted-guide/monitoring.mdx | 2 +- .../multi-cluster-replication.mdx | 2 +- .../self-hosted-guide/security.mdx | 2 +- .../server-frontend-api-reference.mdx | 2 +- .../self-hosted-guide/setup.mdx | 2 +- .../self-hosted-guide/upgrade-server.mdx | 2 +- .../self-hosted-guide/visibility.mdx | 2 +- docs/references/index.mdx | 2 +- docs/security.mdx | 2 +- docs/tctl-v1/index.mdx | 2 +- docs/troubleshooting/index.mdx | 2 +- docs/web-ui.mdx | 2 +- 116 files changed, 293 insertions(+), 182 deletions(-) diff --git a/docs/cli/index.mdx b/docs/cli/index.mdx index b3d3c553fa..ab67e20f50 100644 --- a/docs/cli/index.mdx +++ b/docs/cli/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal CLI command reference sidebar_label: Temporal CLI -sidebar_position: 8 + description: Discover the Temporal Command Line Interface (CLI) documentation. Navigate, configure, and utilize the Temporal CLI effectively. slug: /cli toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/cancellation.mdx b/docs/dev-guide/golang/cancellation.mdx index 31b49ecb69..d4f650c4ed 100644 --- a/docs/dev-guide/golang/cancellation.mdx +++ b/docs/dev-guide/golang/cancellation.mdx @@ -2,7 +2,7 @@ id: cancellation title: Cancellation - Go SDK feature guide sidebar_label: Cancellation -sidebar_position: 6 + description: How to cancel a Workflow Execution and it's Activities using the Go SDK. slug: /dev-guide/go/cancellation toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/converters.mdx b/docs/dev-guide/golang/converters.mdx index 92c1ac406e..575b584ce1 100644 --- a/docs/dev-guide/golang/converters.mdx +++ b/docs/dev-guide/golang/converters.mdx @@ -2,7 +2,7 @@ id: converters title: Converters and Codecs - Go SDK feature guide sidebar_label: Converters and Codecs -sidebar_position: 11 + description: The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. slug: /dev-guide/go/converters toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/debugging.mdx b/docs/dev-guide/golang/debugging.mdx index 6bd36067c4..2772b14958 100644 --- a/docs/dev-guide/golang/debugging.mdx +++ b/docs/dev-guide/golang/debugging.mdx @@ -2,7 +2,7 @@ id: debugging title: Debugging - Go SDK feature guide sidebar_label: Debugging -sidebar_position: 9 + description: The Debugging section of the Temporal Go SDK Developer's guide covers the many ways to debug your application. slug: /dev-guide/go/debugging toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/durable-execution.mdx b/docs/dev-guide/golang/durable-execution.mdx index 7fe589c4e8..31395b5816 100644 --- a/docs/dev-guide/golang/durable-execution.mdx +++ b/docs/dev-guide/golang/durable-execution.mdx @@ -2,7 +2,7 @@ id: durable-execution title: Develop code that durably executes - Go SDK dev guide sidebar_label: Develop for durability -sidebar_position: 3 + description: The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. slug: /dev-guide/go/durable-execution toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/features.mdx b/docs/dev-guide/golang/features.mdx index cbded0503b..8c7650f676 100644 --- a/docs/dev-guide/golang/features.mdx +++ b/docs/dev-guide/golang/features.mdx @@ -2,7 +2,7 @@ id: features title: Features - Go SDK feature guide sidebar_label: Features -sidebar_position: 5 + description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. slug: /dev-guide/go/features toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/foundations.mdx b/docs/dev-guide/golang/foundations.mdx index 69dd12bfea..012c65bae6 100644 --- a/docs/dev-guide/golang/foundations.mdx +++ b/docs/dev-guide/golang/foundations.mdx @@ -2,7 +2,7 @@ id: foundations title: Foundations - Go SDK feature guide sidebar_label: Foundations -sidebar_position: 4 + description: The Foundations section of the Temporal Go SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in Go – that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/go/foundations toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/index.mdx b/docs/dev-guide/golang/index.mdx index bf8bb37c01..754a65fbe7 100644 --- a/docs/dev-guide/golang/index.mdx +++ b/docs/dev-guide/golang/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal Go SDK development documentation sidebar_label: Go SDK -sidebar_position: 2 + description: Learn how to use the Temporal Go SDK. slug: /dev-guide/go toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/introduction.mdx b/docs/dev-guide/golang/introduction.mdx index 632588dd00..a8ff12a239 100644 --- a/docs/dev-guide/golang/introduction.mdx +++ b/docs/dev-guide/golang/introduction.mdx @@ -2,7 +2,7 @@ id: introduction title: Introduction to the Temporal Go SDK sidebar_label: Introduction -sidebar_position: 1 + description: Learn more about Temporal Go SDK. slug: /dev-guide/go/introduction toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/observability.mdx b/docs/dev-guide/golang/observability.mdx index 6f890482ad..b5334cfbbe 100644 --- a/docs/dev-guide/golang/observability.mdx +++ b/docs/dev-guide/golang/observability.mdx @@ -2,7 +2,7 @@ id: observability title: Observability - Go SDK feature guide sidebar_label: Observability -sidebar_position: 7 + description: Improve observability in your Go-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. slug: /dev-guide/go/observability toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/project-setup.mdx b/docs/dev-guide/golang/project-setup.mdx index 56b956ac81..629d5287e7 100644 --- a/docs/dev-guide/golang/project-setup.mdx +++ b/docs/dev-guide/golang/project-setup.mdx @@ -2,7 +2,7 @@ id: project-setup title: Set up a Temporal Application project - Go SDK dev guide sidebar_label: Project setup -sidebar_position: 2 + description: The project setup section of the Temporal Go SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in Go—that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/go/project-setup toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/testing.mdx b/docs/dev-guide/golang/testing.mdx index 372de5632d..4547652131 100644 --- a/docs/dev-guide/golang/testing.mdx +++ b/docs/dev-guide/golang/testing.mdx @@ -2,7 +2,7 @@ id: testing title: Testing - Go SDK feature guide sidebar_label: Testing -sidebar_position: 8 + description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. slug: /dev-guide/go/testing toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/versioning.mdx b/docs/dev-guide/golang/versioning.mdx index 618d8dc0f6..386828f48d 100644 --- a/docs/dev-guide/golang/versioning.mdx +++ b/docs/dev-guide/golang/versioning.mdx @@ -2,7 +2,7 @@ id: versioning title: Versioning - Go SDK feature guide sidebar_label: Versioning -sidebar_position: 10 + description: The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. slug: /dev-guide/go/versioning toc_max_heading_level: 4 diff --git a/docs/dev-guide/index.mdx b/docs/dev-guide/index.mdx index c87255997c..2f190bb342 100644 --- a/docs/dev-guide/index.mdx +++ b/docs/dev-guide/index.mdx @@ -3,7 +3,7 @@ id: index title: Build durable applications with Temporal description: The Temporal developer's guide provides a comprehensive overview of the structures, primitives, and features used in Temporal Application development. sidebar_label: Development -sidebar_position: 4 + --- import { SdkLogos } from "../components/SdkLogos"; diff --git a/docs/dev-guide/javalang/converters.mdx b/docs/dev-guide/javalang/converters.mdx index 538a588318..c36508c263 100644 --- a/docs/dev-guide/javalang/converters.mdx +++ b/docs/dev-guide/javalang/converters.mdx @@ -2,7 +2,7 @@ id: converters title: Converters and Codecs - Java SDK feature guide sidebar_label: Converters and Codecs -sidebar_position: 10 + description: The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. slug: /dev-guide/java/converters toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/debugging.mdx b/docs/dev-guide/javalang/debugging.mdx index add91c50b3..32f07a08db 100644 --- a/docs/dev-guide/javalang/debugging.mdx +++ b/docs/dev-guide/javalang/debugging.mdx @@ -2,7 +2,7 @@ id: debugging title: Debugging - Java SDK feature guide sidebar_label: Debugging -sidebar_position: 9 + description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. slug: /dev-guide/java/debugging toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/durable-execution.mdx b/docs/dev-guide/javalang/durable-execution.mdx index 1ff34178f9..bc29f9d999 100644 --- a/docs/dev-guide/javalang/durable-execution.mdx +++ b/docs/dev-guide/javalang/durable-execution.mdx @@ -2,7 +2,7 @@ id: durable-execution title: Develop code that durably executes - Java SDK dev guide sidebar_label: Develop for durability -sidebar_position: 3 + description: The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. slug: /dev-guide/java/durable-execution toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/features.mdx b/docs/dev-guide/javalang/features.mdx index d50aefc7cd..e8a0fa7665 100644 --- a/docs/dev-guide/javalang/features.mdx +++ b/docs/dev-guide/javalang/features.mdx @@ -2,7 +2,7 @@ id: features title: Features - Java SDK feature guide sidebar_label: Features -sidebar_position: 6 + description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. slug: /dev-guide/java/features toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/foundations.mdx b/docs/dev-guide/javalang/foundations.mdx index 7dca91b260..7a71d365bd 100644 --- a/docs/dev-guide/javalang/foundations.mdx +++ b/docs/dev-guide/javalang/foundations.mdx @@ -2,7 +2,7 @@ id: foundations title: Foundations - Java SDK feature guide sidebar_label: Foundations -sidebar_position: 4 + description: The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application – that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/java/foundations toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/index.mdx b/docs/dev-guide/javalang/index.mdx index 1103b7b7b9..a292c75579 100644 --- a/docs/dev-guide/javalang/index.mdx +++ b/docs/dev-guide/javalang/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal Java SDK development documentation sidebar_label: Java SDK -sidebar_position: 2 + description: Learn how to use Temporal Java SDK. slug: /dev-guide/java toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/introduction.mdx b/docs/dev-guide/javalang/introduction.mdx index ec9e9b3500..fa11cdaef2 100644 --- a/docs/dev-guide/javalang/introduction.mdx +++ b/docs/dev-guide/javalang/introduction.mdx @@ -2,7 +2,7 @@ id: introduction title: Introduction to the Temporal Java SDK sidebar_label: Introduction -sidebar_position: 1 + description: Learn more about Temporal Java SDK. slug: /dev-guide/java/introduction toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/observability.mdx b/docs/dev-guide/javalang/observability.mdx index 8947245a77..7c50e89cf9 100644 --- a/docs/dev-guide/javalang/observability.mdx +++ b/docs/dev-guide/javalang/observability.mdx @@ -2,7 +2,7 @@ id: observability title: Observability - Java SDK feature guide sidebar_label: Observability -sidebar_position: 7 + description: Improve observability in your Java-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. slug: /dev-guide/java/observability toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/project-setup.mdx b/docs/dev-guide/javalang/project-setup.mdx index 291dd9a1a5..253949c9ed 100644 --- a/docs/dev-guide/javalang/project-setup.mdx +++ b/docs/dev-guide/javalang/project-setup.mdx @@ -2,7 +2,7 @@ id: project-setup title: Set up a Temporal Application project - Java SDK dev guide sidebar_label: Project setup -sidebar_position: 2 + description: The project setup section of the Temporal Java SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in java—that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/java/project-setup toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/testing.mdx b/docs/dev-guide/javalang/testing.mdx index 712dea4707..12d9011442 100644 --- a/docs/dev-guide/javalang/testing.mdx +++ b/docs/dev-guide/javalang/testing.mdx @@ -2,7 +2,7 @@ id: testing title: Testing - Java SDK feature guide sidebar_label: Testing -sidebar_position: 8 + description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. slug: /dev-guide/java/testing toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/versioning.mdx b/docs/dev-guide/javalang/versioning.mdx index 47be7f6543..f3e37dc3eb 100644 --- a/docs/dev-guide/javalang/versioning.mdx +++ b/docs/dev-guide/javalang/versioning.mdx @@ -2,7 +2,7 @@ id: versioning title: Versioning - Java SDK feature guide sidebar_label: Versioning -sidebar_position: 9 + description: The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. slug: /dev-guide/java/versioning toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/debugging.mdx b/docs/dev-guide/phplang/debugging.mdx index a214dbf56d..51fcf1198e 100644 --- a/docs/dev-guide/phplang/debugging.mdx +++ b/docs/dev-guide/phplang/debugging.mdx @@ -2,7 +2,7 @@ id: debugging title: Debugging - PHP SDK feature guide sidebar_label: Debugging -sidebar_position: 5 + description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. slug: /dev-guide/php/debugging toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/features.mdx b/docs/dev-guide/phplang/features.mdx index f097df18cf..a35ce6b935 100644 --- a/docs/dev-guide/phplang/features.mdx +++ b/docs/dev-guide/phplang/features.mdx @@ -2,7 +2,7 @@ id: features title: Features - PHP SDK feature guide sidebar_label: Features -sidebar_position: 2 + description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. slug: /dev-guide/php/features toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/foundations.mdx b/docs/dev-guide/phplang/foundations.mdx index 5b17723934..734bf8921b 100644 --- a/docs/dev-guide/phplang/foundations.mdx +++ b/docs/dev-guide/phplang/foundations.mdx @@ -2,7 +2,7 @@ id: foundations title: Foundations - PHP SDK feature guide sidebar_label: Foundations -sidebar_position: 1 + description: The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application – that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/php/foundations toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/index.mdx b/docs/dev-guide/phplang/index.mdx index 0cb23e17c0..9a872ec536 100644 --- a/docs/dev-guide/phplang/index.mdx +++ b/docs/dev-guide/phplang/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal PHP SDK development information sidebar_label: PHP SDK -sidebar_position: 4 + description: Learn how to use the Temporal PHP SDK. slug: /dev-guide/php toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/observability.mdx b/docs/dev-guide/phplang/observability.mdx index a19d9a3005..a00b300599 100644 --- a/docs/dev-guide/phplang/observability.mdx +++ b/docs/dev-guide/phplang/observability.mdx @@ -2,7 +2,7 @@ id: observability title: Observability - PHP SDK feature guide sidebar_label: Observability -sidebar_position: 3 + description: Improve observability in your PHP-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. slug: /dev-guide/php/observability toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/testing.mdx b/docs/dev-guide/phplang/testing.mdx index 185b33d03d..7400187396 100644 --- a/docs/dev-guide/phplang/testing.mdx +++ b/docs/dev-guide/phplang/testing.mdx @@ -2,7 +2,7 @@ id: testing title: Testing - PHP SDK feature guide sidebar_label: Testing -sidebar_position: 4 + description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. slug: /dev-guide/php/testing toc_max_heading_level: 4 diff --git a/docs/dev-guide/python/asynchronous-activity-completion.mdx b/docs/dev-guide/python/asynchronous-activity-completion.mdx index 6889800f09..607f61ae76 100644 --- a/docs/dev-guide/python/asynchronous-activity-completion.mdx +++ b/docs/dev-guide/python/asynchronous-activity-completion.mdx @@ -2,13 +2,14 @@ id: asynchronous-activity-completion title: Asynchronous Activity Completion sidebar_label: Asynchronous Activity Completion -sidebar_position: 8 description: Complete an Activity without waiting for execution to finish, using Temporal Client and Activity Function. slug: /dev-guide/python/asynchronous_activity_completion toc_max_heading_level: 2 --- -## How to asynchronously complete an Activity +## Asynchronously complete an Activity + +**How to Asynchronously complete an Activity** [Asynchronous Activity Completion](/activities#asynchronous-activity-completion) enables the Activity Function to return without the Activity Execution completing. diff --git a/docs/dev-guide/python/cancellation.mdx b/docs/dev-guide/python/cancellation.mdx index 5973817e7f..c6ab6232bb 100644 --- a/docs/dev-guide/python/cancellation.mdx +++ b/docs/dev-guide/python/cancellation.mdx @@ -2,7 +2,6 @@ id: cancellation title: Cancellation sidebar_label: Cancellation -sidebar_position: 7 description: Cancel an Activity from a Workflow, sending Heartbeats and setting a Heartbeat Timeout, and handling cancellation errors. slug: /dev-guide/python/cancellation toc_max_heading_level: 2 @@ -13,6 +12,8 @@ tags: --- ## Cancel an Activity from a Workflow {#cancel-an-activity} +**How to cancel an Activity from a Workflow** + Canceling an Activity from within a Workflow requires that the Activity Execution sends Heartbeats and sets a Heartbeat Timeout. If the Heartbeat is not invoked, the Activity cannot receive a cancellation request. When any non-immediate Activity is executed, the Activity Execution should send Heartbeats and set a [Heartbeat Timeout](/activities#heartbeat-timeout) to ensure that the server knows it is still working. diff --git a/docs/dev-guide/python/child-workflows.mdx b/docs/dev-guide/python/child-workflows.mdx index 89a9fe23db..4556b015e5 100644 --- a/docs/dev-guide/python/child-workflows.mdx +++ b/docs/dev-guide/python/child-workflows.mdx @@ -2,7 +2,6 @@ id: child-workflows title: Child Workflows sidebar_label: Child Workflows -sidebar_position: 15 description: Spawn a new Workflow from within another Workflow, with options for Parent Close Policy and handling Child Workflow Events. slug: /dev-guide/python/child_workflows toc_max_heading_level: 2 @@ -12,7 +11,9 @@ tags: - child-workflows --- -## How to start a Child Workflow Execution {#child-workflows} +## Start a Child Workflow Execution {#child-workflows} + +**How to start a Child Workflow Execution** A [Child Workflow Execution](/encyclopedia/child-workflows) is a Workflow Execution that is scheduled from within another Workflow using a Child Workflow API. @@ -64,7 +65,9 @@ class GreetingWorkflow: ) ``` -#### How to set a Parent Close Policy {#parent-close-policy} +#### Set a Parent Close Policy {#parent-close-policy} + +**How to set a Parent Close Policy** A [Parent Close Policy](/encyclopedia/child-workflows#parent-close-policy) determines what happens to a Child Workflow Execution if its Parent changes to a Closed status (Completed, Failed, or Timed Out). diff --git a/docs/dev-guide/python/continue-as-new.mdx b/docs/dev-guide/python/continue-as-new.mdx index fd5e06ee61..fc4eb73502 100644 --- a/docs/dev-guide/python/continue-as-new.mdx +++ b/docs/dev-guide/python/continue-as-new.mdx @@ -2,7 +2,6 @@ id: continue-as-new title: Continue-As-New sidebar_label: Continue-As-New -sidebar_position: 16 description: Close a Workflow Execution and create a new one with the same Workflow ID, new Run ID, and fresh Event History. slug: /dev-guide/python/continue-as-new toc_max_heading_level: 2 @@ -12,7 +11,9 @@ tags: - continue-as-new --- -## How to Continue-As-New {#continue-as-new} +## Continue-As-New {#continue-as-new} + +**How to Continue-As-New** [Continue-As-New](/workflows#continue-as-new) enables a Workflow Execution to close successfully and create a new Workflow Execution in a single atomic operation if the number of Events in the Event History is becoming too large. The Workflow Execution spawned from the use of Continue-As-New has the same Workflow Id, a new Run Id, and a fresh Event History and is passed all the appropriate parameters. diff --git a/docs/dev-guide/python/core-application.mdx b/docs/dev-guide/python/core-application.mdx index 7fd1cb34c6..de2a700e0b 100644 --- a/docs/dev-guide/python/core-application.mdx +++ b/docs/dev-guide/python/core-application.mdx @@ -2,7 +2,6 @@ id: core-application title: Core application sidebar_label: Core application -sidebar_position: 1 description: Develop basic Temporal application with workflows & activities in Python using Temporal SDK. slug: /dev-guide/python/core_application toc_max_heading_level: 2 @@ -12,7 +11,9 @@ tags: - core-application --- -## How to develop a basic Workflow {#develop-workflows} +## Develop a basic Workflow {#develop-workflows} + +**How to develop a basic Workflow** Workflows are the fundamental unit of a Temporal Application, and it all starts with the development of a [Workflow Definition](/workflows#workflow-definition). @@ -45,7 +46,9 @@ class YourWorkflow: ) ``` -### How to define Workflow parameters {#workflow-parameters} +### Define Workflow parameters {#workflow-parameters} + +**How to define Workflow parameters** Temporal Workflows may have any number of custom parameters. However, we strongly recommend that objects are used as parameters, so that the object's individual fields may be altered without breaking the signature of the Workflow. @@ -73,7 +76,9 @@ class YourParams: name: str ``` -### How to define Workflow return parameters {#workflow-return-values} +### Define Workflow return parameters {#workflow-return-values} + +**How to define Workflow return parameters** Workflow return values must also be serializable. Returning results, returning errors, or throwing exceptions is fairly idiomatic in each language that is supported. @@ -106,7 +111,9 @@ class YourWorkflow: ) ``` -### How to customize your Workflow Type {#workflow-type} +### Customize your Workflow Type {#workflow-type} + +**How to customize your Workflow Type** Workflows have a Type that are referred to as the Workflow name. @@ -137,7 +144,9 @@ class YourWorkflow: ) ``` -### How develop Workflow logic {#workflow-logic-requirements} +### Develop Workflow logic {#workflow-logic-requirements} + +**How to develop Workflow logic** Workflow logic is constrained by [deterministic execution requirements](/workflows#deterministic-constraints). Therefore, each language is limited to the use of certain idiomatic techniques. @@ -154,7 +163,9 @@ Workflow code must be deterministic. This means: All API safe for Workflows used in the [`temporalio.workflow`](https://python.temporal.io/temporalio.workflow.html) must run in the implicit [`asyncio` event loop](https://docs.python.org/3/library/asyncio-eventloop.html) and be _deterministic_. -## How to develop a basic Activity {#develop-activities} +## Develop a basic Activity {#develop-activities} + +**How to develop a basic Activity** One of the primary things that Workflows do is orchestrate the execution of Activities. An Activity is a normal function or method execution that's intended to execute a single, well-defined action (either short or long-running), such as querying a database, calling a third-party API, or transcoding a media file. @@ -199,7 +210,9 @@ async def your_activity(input: YourParams) -> str: return f"{input.greeting}, {input.name}!" ``` -### How to develop Activity Parameters {#activity-parameters} +### Develop Activity Parameters {#activity-parameters} + +**How to develop Activity Parameters** There is no explicit limit to the total number of parameters that an [Activity Definition](/activities#activity-definition) may support. However, there is a limit to the total size of the data that ends up encoded into a gRPC message Payload. @@ -239,7 +252,9 @@ async def your_activity(input: YourParams) -> str: return f"{input.greeting}, {input.name}!" ``` -### How to define Activity return values {#activity-return-values} +### Define Activity return values {#activity-return-values} + +**How to define Activity return values** All data returned from an Activity must be serializable. @@ -264,7 +279,9 @@ async def your_activity(input: YourParams) -> str: return f"{input.greeting}, {input.name}!" ``` -### How to customize your Activity Type {#activity-type} +### Customize your Activity Type {#activity-type} + +**How to customize your Activity Type** Activities have a Type that are referred to as the Activity name. The following examples demonstrate how to set a custom name for your Activity Type. @@ -287,7 +304,9 @@ async def your_activity(input: YourParams) -> str: return f"{input.greeting}, {input.name}!" ``` -## How to start an Activity Execution {#activity-execution} +## Start an Activity Execution {#activity-execution} + +**How to start an Activity Execution** Calls to spawn [Activity Executions](/activities#activity-execution) are written within a [Workflow Definition](/workflows#workflow-definition). The call to spawn an Activity Execution generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command. @@ -335,7 +354,9 @@ class YourWorkflow: ) ``` -### How to set the required Activity Timeouts {#required-timeout} +### Set the required Activity Timeouts {#required-timeout} + +**How to set the required Activity Timeouts** Activity Execution semantics rely on several parameters. The only required value that needs to be set is either a [Schedule-To-Close Timeout](/activities#start-to-close-timeout) or a [Start-To-Close Timeout](/activities#start-to-close-timeout). @@ -369,7 +390,9 @@ Available timeouts are: ) ``` -### How to get the results of an Activity Execution {#get-activity-results} +### Get the results of an Activity Execution {#get-activity-results} + +**How to get the results of an Activity Execution** The call to spawn an [Activity Execution](/activities#activity-execution) generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command and provides the Workflow with an Awaitable. Workflow Executions can either block progress until the result is available through the Awaitable or continue progressing, making use of the result when it becomes available. @@ -403,7 +426,9 @@ class YourWorkflow: ) ``` -## How to run Worker Processes {#run-a-dev-worker} +## Run a Worker Processes {#run-a-dev-worker} + +**How to run a Worker Process** The [Worker Process](/workers#worker-process) is where Workflow Functions and Activity Functions are executed. @@ -450,7 +475,9 @@ if __name__ == "__main__": asyncio.run(main()) ``` -### How to register types {#register-types} +### Register types {#register-types} + +**How to register types** All Workers listening to the same Task Queue name must be registered to handle the exact same Workflows Types and Activity Types. diff --git a/docs/dev-guide/python/data-encryption.mdx b/docs/dev-guide/python/data-encryption.mdx index 6b3b3813c8..a29ae648b4 100644 --- a/docs/dev-guide/python/data-encryption.mdx +++ b/docs/dev-guide/python/data-encryption.mdx @@ -2,7 +2,6 @@ id: data-encryption title: Data encryption sidebar_label: Data encryption -sidebar_position: 13 description: The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. slug: /dev-guide/python/data_encryption toc_max_heading_level: 2 diff --git a/docs/dev-guide/python/debugging.mdx b/docs/dev-guide/python/debugging.mdx index b4c3bde7bb..b047aa6bbd 100644 --- a/docs/dev-guide/python/debugging.mdx +++ b/docs/dev-guide/python/debugging.mdx @@ -2,7 +2,6 @@ id: debugging title: Debugging sidebar_label: Debugging -sidebar_position: 11 description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. slug: /dev-guide/python/debugging toc_max_heading_level: 2 @@ -16,7 +15,6 @@ tags: ## Debugging {#debug} - ### How to debug in a development environment {#debug-in-a-development-environment} In addition to the normal development tools of logging and a debugger, you can also see what’s happening in your Workflow by using the [Web UI](/web-ui) or [Temporal CLI](/cli). diff --git a/docs/dev-guide/python/durable-execution.mdx b/docs/dev-guide/python/durable-execution.mdx index e64e694b52..85f7028b92 100644 --- a/docs/dev-guide/python/durable-execution.mdx +++ b/docs/dev-guide/python/durable-execution.mdx @@ -2,7 +2,6 @@ id: durable-execution title: Develop code that durably executes - Python SDK dev guide sidebar_label: Develop for durability -sidebar_position: 3 description: The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. slug: /dev-guide/python/durable-execution toc_max_heading_level: 4 diff --git a/docs/dev-guide/python/failure-detection.mdx b/docs/dev-guide/python/failure-detection.mdx index 925288dd63..37b6be4c3e 100644 --- a/docs/dev-guide/python/failure-detection.mdx +++ b/docs/dev-guide/python/failure-detection.mdx @@ -2,7 +2,6 @@ id: failure-detection title: Failure detection sidebar_label: Failure detection -sidebar_position: 4 Description: Guidance on setting timeouts, retries, and heartbeat functionality for Workflows and Activities in Python with Temporal. slug: /dev-guide/python/failure_detection toc_max_heading_level: 2 @@ -81,7 +80,9 @@ Set the Retry Policy to either the [`start_workflow()`](https://python.temporal. ) ``` -## How to set Activity timeouts {#activity-timeouts} +## Set Activity timeouts {#activity-timeouts} + +**How to set an Activity Execution Timeout** Each Activity timeout controls the maximum duration of a different aspect of an Activity Execution. @@ -121,7 +122,9 @@ Available timeouts are: ) ``` -### How to set an Activity Retry Policy {#activity-retries} +### Set an Activity Retry Policy {#activity-retries} + +**How to set an Activity Retry Policy** A Retry Policy works in cooperation with the timeouts to provide fine controls to optimize the execution experience. @@ -157,7 +160,9 @@ from temporalio.common import RetryPolicy -## How to Heartbeat an Activity {#activity-heartbeats} +## Heartbeat an Activity {#activity-heartbeats} + +**How to Heartbeat an Activity** An [Activity Heartbeat](/activities#activity-heartbeat) is a ping from the [Worker Process](/workers#worker-process) that is executing the Activity to the [Temporal Cluster](/clusters). Each Heartbeat informs the Temporal Cluster that the [Activity Execution](/activities#activity-execution) is making progress and the Worker has not crashed. @@ -182,7 +187,9 @@ async def your_activity_definition() -> str: In addition to obtaining cancellation information, Heartbeats also support detail data that persists on the server for retrieval during Activity retry. If an Activity calls `heartbeat(123, 456)` and then fails and is retried, `heartbeat_details` returns an iterable containing `123` and `456` on the next Run. -#### How to set a Heartbeat Timeout {#heartbeat-timeout} +#### Set a Heartbeat Timeout {#heartbeat-timeout} + +**How to set a Heartbeat Timeout** A [Heartbeat Timeout](/activities#heartbeat-timeout) works in conjunction with [Activity Heartbeats](/activities#activity-heartbeat). diff --git a/docs/dev-guide/python/foundations.mdx b/docs/dev-guide/python/foundations.mdx index 94f3daf5fe..75fb163d03 100644 --- a/docs/dev-guide/python/foundations.mdx +++ b/docs/dev-guide/python/foundations.mdx @@ -2,7 +2,6 @@ id: foundations title: Foundations - Python SDK feature guide sidebar_label: Foundations -sidebar_position: 4 description: The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application – that is, all the relevant steps to start a Workflow Execution that executes an Activity. toc_max_heading_level: 4 keywords: diff --git a/docs/dev-guide/python/index.mdx b/docs/dev-guide/python/index.mdx index 71b3ab9eae..9893352560 100644 --- a/docs/dev-guide/python/index.mdx +++ b/docs/dev-guide/python/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal Python SDK development documentation sidebar_label: Python SDK -sidebar_position: 4 + description: Learn how to use the Temporal Python SDK. slug: /dev-guide/python toc_max_heading_level: 4 diff --git a/docs/dev-guide/python/interrupt-workflow.mdx b/docs/dev-guide/python/interrupt-workflow.mdx index 340512b2f3..a4108ff478 100644 --- a/docs/dev-guide/python/interrupt-workflow.mdx +++ b/docs/dev-guide/python/interrupt-workflow.mdx @@ -2,7 +2,6 @@ id: interrupt-a-workflow-execution title: Interrupt a Workflow Execution sidebar_label: Interrupt a Workflow Execution -sidebar_position: 18 description: Learn how to interrupt a workflow execution by canceling or terminating, including the differences and use cases for each method. slug: /dev-guide/python/interrupt_a_workflow_execution toc_max_heading_level: 2 @@ -12,7 +11,9 @@ tags: - interrupt-a-workflow-execution --- -## How to interrupt a Workflow Execution {#interrupt-a-workflow-execution} +## Interrupt a Workflow Execution {#interrupt-a-workflow-execution} + +**How to interrupt a Workflow Execution** You can interrupt a Workflow Execution in one of the following ways: @@ -55,7 +56,9 @@ In summary: In most cases, canceling is preferable because it allows the Workflow to finish gracefully. Terminate only if the Workflow is stuck and cannot be canceled normally. -### How to cancel a Workflow Execution in Python {#cancel-a-workflow-execution} +### Cancel a Workflow Execution {#cancel-a-workflow-execution} + +**How to cancel a Workflow Execution** To cancel a Workflow Execution in Python, use the [cancel()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#cancel) function on the Workflow handle. @@ -63,7 +66,9 @@ To cancel a Workflow Execution in Python, use the [cancel()](https://python.temp await client.get_workflow_handle("your_workflow_id").cancel() ``` -### How to terminate a Workflow Execution in Python {#terminate-a-workflow-execution} +### Terminate a Workflow Execution {#terminate-a-workflow-execution} + +**How to terminate a Workflow Execution** To terminate a Workflow Execution in Python, use the [terminate()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#terminate) function on the Workflow handle. diff --git a/docs/dev-guide/python/introduction.mdx b/docs/dev-guide/python/introduction.mdx index 15c77afac0..19038d089d 100644 --- a/docs/dev-guide/python/introduction.mdx +++ b/docs/dev-guide/python/introduction.mdx @@ -2,7 +2,7 @@ id: introduction title: Introduction to the Temporal Python SDK sidebar_label: Introduction -sidebar_position: 1 + description: Learn more about Temporal Python SDK. slug: /dev-guide/python/introduction toc_max_heading_level: 4 diff --git a/docs/dev-guide/python/messages.mdx b/docs/dev-guide/python/messages.mdx index 296d91c4b1..aaea5ddae4 100644 --- a/docs/dev-guide/python/messages.mdx +++ b/docs/dev-guide/python/messages.mdx @@ -2,7 +2,6 @@ id: messages title: Messages sidebar_label: Messages -sidebar_position: 5 description: Explore using Signals in Temporal Python to send messages to Workflows, with details on defining, sending, and handling Signals, including customization options. slug: /dev-guide/python/messages toc_max_heading_level: 2 @@ -12,7 +11,9 @@ tags: - messages --- -## How to develop with Signals {#signals} +## Develop with Signals {#signals} + +**How to develop with Signals** A [Signal](/workflows#signal) is a message sent to a running Workflow Execution. @@ -77,7 +78,9 @@ from temporalio.client import Client await handle.signal(GreetingWorkflow.submit_greeting, "User 1") ``` -### How to send a Signal from a Temporal Client {#send-signal-from-client} +### Send a Signal from a Temporal Client {#send-signal-from-client} + +**How to send a Signal from a Temporal Client** When a Signal is sent successfully from the Temporal Client, the [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the Event History of the Workflow that receives the Signal. @@ -110,7 +113,9 @@ from temporalio.client import Client await handle.signal(GreetingWorkflow.submit_greeting, "User 1") ``` -### How to send a Signal from a Workflow {#send-signal-from-workflow} +### Send a Signal from a Workflow {#send-signal-from-workflow} + +**How to send a Signal from a Workflow** A Workflow can send a Signal to another Workflow, in which case it's called an _External Signal_. @@ -146,7 +151,9 @@ class WorkflowB: await handle.signal(WorkflowA.your_signal, "signal argument") ``` -### How to Signal-With-Start {#signal-with-start} +### Signal-With-Start {#signal-with-start} + +**How to send a Signal-With-Start** Signal-With-Start is used from the Client. It takes a Workflow Id, Workflow arguments, a Signal name, and Signal arguments. @@ -178,7 +185,7 @@ async def main(): ) ``` -## How to develop with Queries {#queries} +## Develop with Queries {#queries} A [Query](/workflows#query) is a synchronous operation that is used to get the state of a Workflow Execution. @@ -216,7 +223,9 @@ You can either set the `name` or the `dynamic` parameter in a Query's decorator, return self._greeting ``` -### How to handle a Query {#handle-query} +### Handle a Query {#handle-query} + +**How to handle a Query** Queries are handled by your Workflow. @@ -239,7 +248,9 @@ To send a Query to the Workflow, use the [`query`](https://python.temporal.io/te result = await handle.query(GreetingWorkflow.greeting) ``` -### How to send a Query {#send-query} +### Send a Query {#send-query} + +**How to send a Query** Queries are sent from a Temporal Client. @@ -258,7 +269,7 @@ To send a Query to a Workflow Execution from Client code, use the `query()` meth result = await handle.query(GreetingWorkflow.greeting) ``` -## How to develop with Updates {#updates} +## Develop with Updates {#updates} An [Update](/workflows#update) is an operation that can mutate the state of a Workflow Execution and return a response. @@ -285,7 +296,9 @@ To define an update handler, use the [@workflow.update](https://python.temporal. return "Workflow status updated" ``` -### How to send an Update from a Temporal Client {#send-update-from-client} +### Send an Update from a Temporal Client {#send-update-from-client} + +**How to send an Update from a Temporal Client** To send a Workflow Update from a Temporal Client, call the [execute_update](https://python.temporal.io/temporalio.client.WorkflowHandle.html#execute_update) method on the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. @@ -317,7 +330,9 @@ They are meant to handle edge cases and act as a catch-all, not as the main way ::: -### How to set a Dynamic Workflow {#set-a-dynamic-workflow} +### Set a Dynamic Workflow {#set-a-dynamic-workflow} + +**How to set a Dynamic Workflow** A Dynamic Workflow in Temporal is a Workflow that is invoked dynamically at runtime if no other Workflow with the same name is registered. A Workflow can be made dynamic by adding `dynamic=True` to the `@workflow.defn` decorator. @@ -348,7 +363,9 @@ class DynamicWorkflow: ) ``` -### How to set a Dynamic Activity {#set-a-dynamic-activity} +### Set a Dynamic Activity {#set-a-dynamic-activity} + +**How to set a Dynamic Activity** A Dynamic Activity in Temporal is an Activity that is invoked dynamically at runtime if no other Activity with the same name is registered. An Activity can be made dynamic by adding `dynamic=True` to the `@activity.defn` decorator. @@ -385,7 +402,10 @@ class GreetingWorkflow: ) ``` -### How to set a Dynamic Signal {#set-a-dynamic-signal} +### Set a Dynamic Signal {#set-a-dynamic-signal} + +**How to set a Dynamic Signal** + A Dynamic Signal in Temporal is a Signal that is invoked dynamically at runtime if no other Signal with the same input is registered. A Signal can be made dynamic by adding `dynamic=True` to the `@signal.defn` decorator. @@ -408,7 +428,9 @@ The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#pa await self._pending_greetings.put(name) ``` -### How to set a Dynamic Query {#set-a-dynamic-query} +### Set a Dynamic Query {#set-a-dynamic-query} + +**How to set a Dynamic Query** A Dynamic Query in Temporal is a Query that is invoked dynamically at runtime if no other Query with the same name is registered. A Query can be made dynamic by adding `dynamic=True` to the `@query.defn` decorator. diff --git a/docs/dev-guide/python/observability.mdx b/docs/dev-guide/python/observability.mdx index af3a58e0c0..7fe444eb78 100644 --- a/docs/dev-guide/python/observability.mdx +++ b/docs/dev-guide/python/observability.mdx @@ -2,7 +2,6 @@ id: observability title: Observability sidebar_label: Observability -sidebar_position: 10 description: Learn about observability tools for Temporal applications, covering metrics, tracing, logging, and visibility to monitor and troubleshoot Workflows. slug: /dev-guide/python/observability toc_max_heading_level: 2 diff --git a/docs/dev-guide/python/project-setup.mdx b/docs/dev-guide/python/project-setup.mdx index de0a8a064f..48f1b91f84 100644 --- a/docs/dev-guide/python/project-setup.mdx +++ b/docs/dev-guide/python/project-setup.mdx @@ -2,7 +2,6 @@ id: project-setup title: Set up a Temporal Application project - Python SDK dev guide sidebar_label: Project setup -sidebar_position: 2 description: The project setup section of the Temporal Python SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in Python—that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/python/project-setup toc_max_heading_level: 4 diff --git a/docs/dev-guide/python/schedules.mdx b/docs/dev-guide/python/schedules.mdx index e28f6351a1..d9161bcb56 100644 --- a/docs/dev-guide/python/schedules.mdx +++ b/docs/dev-guide/python/schedules.mdx @@ -2,7 +2,6 @@ id: schedules title: Schedules sidebar_label: Schedules -sidebar_position: 12 description: Discover how to effectively Schedule Workflows in Temporal Python, covering creation, management, and operations like backfilling, deleting, and triggering Scheduled Workflows for precise automation timing. slug: /dev-guide/python/schedules toc_max_heading_level: 2 @@ -12,13 +11,17 @@ tags: - schedules --- -## How to Schedule a Workflow {#schedule-a-workflow} +## Schedule a Workflow {#schedule-a-workflow} + +**How to Schedule a Workflow Execution** Scheduling Workflows is a crucial aspect of any automation process, especially when dealing with time-sensitive tasks. By scheduling a Workflow, you can automate repetitive tasks, reduce the need for manual intervention, and ensure timely execution of your business processes Use any of the following action to help Schedule a Workflow Execution and take control over your automation process. -### How to Create a Scheduled Workflow {#create} +### Create a Scheduled Workflow {#create} + +**How to create a Scheduled Workflow** The create action enables you to create a new Schedule. When you create a new Schedule, a unique Schedule ID is generated, which you can use to reference the Schedule in other Schedule commands. @@ -59,7 +62,9 @@ async def main(): ) ``` -### How to Backfill a Scheduled Workflow {#backfill} +### Backfill a Scheduled Workflow {#backfill} + +**How to backfill a Scheduled Workflow** The backfill action executes Actions ahead of their specified time range. This command is useful when you need to execute a missed or delayed Action, or when you want to test the Workflow before its scheduled time. @@ -99,7 +104,9 @@ async def main(): ) ``` -### How to Delete a Scheduled Workflow {#delete} +### Delete a Scheduled Workflow {#delete} + +**How to delete a Scheduled Workflow** The delete action enables you to delete a Schedule. When you delete a Schedule, it does not affect any Workflows that were started by the Schedule. @@ -125,7 +132,9 @@ async def main(): await handle.delete() ``` -### How to Describe a Scheduled Workflow {#describe} +### Describe a Scheduled Workflow {#describe} + +**How to describe a Scheduled Workflow** The describe action shows the current Schedule configuration, including information about past, current, and future Workflow Runs. This command is helpful when you want to get a detailed view of the Schedule and its associated Workflow Runs. @@ -153,7 +162,9 @@ async def main(): print(f"Returns the note: {desc.schedule.state.note}") ``` -### How to List a Scheduled Workflow {#list} +### List a Scheduled Workflow {#list} + +**How to list a Scheduled Workflow** The list action lists all the available Schedules. This command is useful when you want to view a list of all the Schedules and their respective Schedule IDs. @@ -176,7 +187,9 @@ async def main() -> None: print(f"List Schedule Info: {schedule.info}.") ``` -### How to Pause a Scheduled Workflow {#pause} +### Pause a Scheduled Workflow {#pause} + +**How to pause a Scheduled Workflow** The pause action enables you to pause and unpause a Schedule. When you pause a Schedule, all the future Workflow Runs associated with the Schedule are temporarily stopped. This command is useful when you want to temporarily halt a Workflow due to maintenance or any other reason. @@ -202,7 +215,9 @@ async def main(): await handle.pause(note="Pausing the schedule for now") ``` -### How to Trigger a Scheduled Workflow {#trigger} +### Trigger a Scheduled Workflow {#trigger} + +**How to trigger a Scheduled Workflow** The trigger action triggers an immediate action with a given Schedule. By default, this action is subject to the Overlap Policy of the Schedule. This command is helpful when you want to execute a Workflow outside of its scheduled time. @@ -227,7 +242,9 @@ async def main(): await handle.trigger() ``` -### How to Update a Scheduled Workflow {#update} +### Update a Scheduled Workflow {#update} + +**How to update a Scheduled Workflow** The update action enables you to update an existing Schedule. This command is useful when you need to modify the Schedule's configuration, such as changing the start time, end time, or interval. @@ -253,7 +270,9 @@ The following example updates the Schedule to use a new argument. return ScheduleUpdate(schedule=input.description.schedule) ``` -## How to use Temporal Cron Jobs {#temporal-cron-jobs} +## Temporal Cron Jobs {#temporal-cron-jobs} + +**How to use Temporal Cron Jobs** A [Temporal Cron Job](/workflows#temporal-cron-job) is the series of Workflow Executions that occur when a Cron Schedule is provided in the call to spawn a Workflow Execution. @@ -280,7 +299,9 @@ You can set each Workflow to repeat on a schedule with the `cron_schedule` optio print(f"Results: {result}") ``` -## How to use Start Delay {#start-delay} +## Start Delay {#start-delay} + +**How to use Start Delay** Use the `start_delay` to schedule a Workflow Execution at a specific one-time future point rather than on a recurring schedule. diff --git a/docs/dev-guide/python/temporal-clients.mdx b/docs/dev-guide/python/temporal-clients.mdx index 332e439bb1..fa2397f53c 100644 --- a/docs/dev-guide/python/temporal-clients.mdx +++ b/docs/dev-guide/python/temporal-clients.mdx @@ -1,18 +1,42 @@ --- id: temporal-clients -title: Temporal Clients -sidebar_label: Temporal Clients -sidebar_position: 2 -description: Explore how to utilize Temporal Clients to connect to and interact with Temporal, including initiating Workflow Executions and handling Workflow results, with specific instructions for both local and Temporal Cloud environments. -slug: /dev-guide/python/temporal_clients -toc_max_heading_level: 2 +title: Temporal Client - Python SDK feature guide +sidebar_label: Temporal Client +toc_max_heading_level: 4 +description: Master the Temporal Python Client with our comprehensive guide that covers everything from initialization to Workflow Execution. keywords: - - temporal-clients + - temporal python client + - connect python client to temporal service + - initialize temporal client + - temporal SDK python guide + - start workflow execution python + - temporal cloud connection + - python client for temporal cli + - custom namespace configuration + - temporal workflow management + - temporal client setup + - python workflow execution + - temporal cloud integration + - temporal client options + - managing temporal namespaces tags: - - temporal-clients + - python + - python-sdk + - temporal-client --- -## How to connect a Temporal Client to a Temporal Cluster {#connect-to-a-dev-cluster} +This guide introduces Temporal Clients. +It explains the role and use of Clients and shows you how to configure your Python Client code to connect to the Temporal Service. + +The pages shows how to do the following: + +- [Connect to a local development Temporal Service](#connect-to-development-service) +- [Connect to Temporal Cloud](#connect-to-temporal-cloud) +- [Start a Workflow Execution](#start-workflow-execution) + +## Connect to development Temporal Service {#connect-to-development-service} + +**How to connect to the local Temporal CLI development Temporal Service using the Python SDK** A [Temporal Client](/encyclopedia/temporal-sdks#temporal-client) enables you to communicate with the [Temporal Cluster](/clusters). Communication with a Temporal Cluster includes, but isn't limited to, the following: @@ -62,7 +86,9 @@ if __name__ == "__main__": asyncio.run(main()) ``` -## How to connect to Temporal Cloud {#connect-to-temporal-cloud} +## Connect to Temporal Cloud {#connect-to-temporal-cloud} + +**How to connect to Temporal Cloud using the Python SDK** When you connect to [Temporal Cloud](/cloud), you need to provide additional connection and client options that include the following: @@ -110,13 +136,14 @@ async def main(): ) ``` +## Start a Workflow Execution {#start-workflow-execution} -## How to start a Workflow Execution {#start-workflow-execution} +**How to start a Workflow Execution using the Python SDK** [Workflow Execution](/workflows#workflow-execution) semantics rely on several parameters—that is, to start a Workflow Execution you must supply a Task Queue that will be used for the Tasks (one that a Worker is polling), the Workflow Type, language-specific contextual data, and Workflow Function parameters. In the examples below, all Workflow Executions are started using a Temporal Client. -To spawn Workflow Executions from within another Workflow Execution, use either the [Child Workflow](features#child-workflows) or External Workflow APIs. +To spawn Workflow Executions from within another Workflow Execution, use either the [Child Workflow](#child-workflows) or External Workflow APIs. See the [Customize Workflow Type](#workflow-type) section to see how to customize the name of the Workflow Type. @@ -152,7 +179,9 @@ if __name__ == "__main__": asyncio.run(main()) ``` -### How to set a Workflow's Task Queue {#set-task-queue} +### Set a Workflow's Task Queue {#set-task-queue} + +**How to set a Workflow's Task Queue using the Python SDK** In most SDKs, the only Workflow Option that must be set is the name of the [Task Queue](/workers#task-queue). @@ -187,7 +216,9 @@ if __name__ == "__main__": asyncio.run(main()) ``` -### How to set a Workflow Id {#workflow-id} +### Set a Workflow Id {#workflow-id} + +**How to set a Workflow Id using the Python SDK** You must set a [Workflow Id](/workflows#workflow-id). @@ -224,7 +255,9 @@ if __name__ == "__main__": asyncio.run(main()) ``` -### How to get the results of a Workflow Execution {#get-workflow-results} +### Get the results of a Workflow Execution {#get-workflow-results} + +**How to get the results of a Workflow Execution using the Python SDK** If the call to start a Workflow Execution is successful, you will gain access to the Workflow Execution's Run Id. @@ -264,4 +297,4 @@ async def main(): if __name__ == "__main__": asyncio.run(main()) -``` +``` \ No newline at end of file diff --git a/docs/dev-guide/python/test-suites.mdx b/docs/dev-guide/python/test-suites.mdx index 6af99367d2..cdf7596233 100644 --- a/docs/dev-guide/python/test-suites.mdx +++ b/docs/dev-guide/python/test-suites.mdx @@ -2,7 +2,6 @@ id: test-suites title: Test suites sidebar_label: Test suites -sidebar_position: 3 description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. slug: /dev-guide/python/test_suites toc_max_heading_level: 2 diff --git a/docs/dev-guide/python/timers.mdx b/docs/dev-guide/python/timers.mdx index 1364586eea..f56abdbf84 100644 --- a/docs/dev-guide/python/timers.mdx +++ b/docs/dev-guide/python/timers.mdx @@ -2,7 +2,6 @@ id: timers title: Timers sidebar_label: Timers -sidebar_position: 17 description: Learn how to use timers within Temporal Workflows to delay execution, enabling durable and long-term scheduling of tasks that can persist even if the worker or cluster goes down. slug: /dev-guide/python/timers toc_max_heading_level: 2 @@ -12,7 +11,7 @@ tags: - timers --- -## What is a Timer? {#timers} +## What is a Timer {#timers} A Workflow can set a durable timer for a fixed time period. In some SDKs, the function is called `sleep()`, and in others, it's called `timer()`. diff --git a/docs/dev-guide/python/versioning.mdx b/docs/dev-guide/python/versioning.mdx index 3327498af8..a5f7347f76 100644 --- a/docs/dev-guide/python/versioning.mdx +++ b/docs/dev-guide/python/versioning.mdx @@ -2,7 +2,6 @@ id: versioning title: Versioning sidebar_label: Versioning -sidebar_position: 9 description: The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. slug: /dev-guide/python/versioning toc_max_heading_level: 2 diff --git a/docs/dev-guide/tscript/debugging.mdx b/docs/dev-guide/tscript/debugging.mdx index f227191fbb..cfa6a1e821 100644 --- a/docs/dev-guide/tscript/debugging.mdx +++ b/docs/dev-guide/tscript/debugging.mdx @@ -2,7 +2,7 @@ id: debugging title: Debugging - TypeScript SDK feature guide sidebar_label: Debugging -sidebar_position: 7 + description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. slug: /dev-guide/typescript/debugging toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/features.mdx b/docs/dev-guide/tscript/features.mdx index 2b81d7a95b..9ef1c74a9d 100644 --- a/docs/dev-guide/tscript/features.mdx +++ b/docs/dev-guide/tscript/features.mdx @@ -2,7 +2,7 @@ id: features title: Features - TypeScript SDK feature guide sidebar_label: Features -sidebar_position: 4 + description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. slug: /dev-guide/typescript/features toc_max_heading_level: 3 diff --git a/docs/dev-guide/tscript/foundations.mdx b/docs/dev-guide/tscript/foundations.mdx index 58f1d9e662..eae7b1e911 100644 --- a/docs/dev-guide/tscript/foundations.mdx +++ b/docs/dev-guide/tscript/foundations.mdx @@ -2,7 +2,7 @@ id: foundations title: Foundations - TypeScript SDK feature guide sidebar_label: Foundations -sidebar_position: 3 + description: The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application – that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/typescript/foundations toc_max_heading_level: 2 diff --git a/docs/dev-guide/tscript/index.mdx b/docs/dev-guide/tscript/index.mdx index dda498d116..c3d95cfd4d 100644 --- a/docs/dev-guide/tscript/index.mdx +++ b/docs/dev-guide/tscript/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal TypeScript SDK development documentation sidebar_label: TypeScript SDK -sidebar_position: 6 + description: Learn how to use the Temporal TypeScript SDK. slug: /dev-guide/typescript toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/introduction.mdx b/docs/dev-guide/tscript/introduction.mdx index 755e04d6fe..298e11c87c 100644 --- a/docs/dev-guide/tscript/introduction.mdx +++ b/docs/dev-guide/tscript/introduction.mdx @@ -2,7 +2,7 @@ id: introduction title: Introduction to the Temporal TypeScript SDK sidebar_label: Introduction -sidebar_position: 1 + description: Learn more about the Temporal TypeScript SDK. slug: /dev-guide/typescript/introduction toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/observability.mdx b/docs/dev-guide/tscript/observability.mdx index ba3c21c76c..a6bc87cbb8 100644 --- a/docs/dev-guide/tscript/observability.mdx +++ b/docs/dev-guide/tscript/observability.mdx @@ -2,7 +2,7 @@ id: observability title: Observability - TypeScript SDK feature guide sidebar_label: Observability -sidebar_position: 5 + description: Improve observability in your TypeScript-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. slug: /dev-guide/typescript/observability toc_max_heading_level: 3 diff --git a/docs/dev-guide/tscript/project-setup.mdx b/docs/dev-guide/tscript/project-setup.mdx index 733156182c..704e71e7a6 100644 --- a/docs/dev-guide/tscript/project-setup.mdx +++ b/docs/dev-guide/tscript/project-setup.mdx @@ -2,7 +2,7 @@ id: project-setup title: Set up a Temporal Application project - TypeScript SDK dev guide sidebar_label: Project setup -sidebar_position: 2 + description: The project setup section of the Temporal TypeScript SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in TypeScript—that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/typescript/project-setup toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/testing.mdx b/docs/dev-guide/tscript/testing.mdx index 9ad85c3063..61c7d46d4f 100644 --- a/docs/dev-guide/tscript/testing.mdx +++ b/docs/dev-guide/tscript/testing.mdx @@ -2,7 +2,7 @@ id: testing title: Testing - TypeScript SDK feature guide sidebar_label: Testing -sidebar_position: 6 + description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. slug: /dev-guide/typescript/testing toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/versioning.mdx b/docs/dev-guide/tscript/versioning.mdx index b13c44c930..cebb87f76d 100644 --- a/docs/dev-guide/tscript/versioning.mdx +++ b/docs/dev-guide/tscript/versioning.mdx @@ -2,7 +2,7 @@ id: versioning title: Versioning - TypeScript SDK feature guide sidebar_label: Versioning -sidebar_position: 8 + description: The Versioning section of the Temporal TypeScript SDK developer's guide explains how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. slug: /dev-guide/typescript/versioning toc_max_heading_level: 4 diff --git a/docs/encyclopedia/activities.mdx b/docs/encyclopedia/activities.mdx index e72b185f6c..2ea2a7e69e 100644 --- a/docs/encyclopedia/activities.mdx +++ b/docs/encyclopedia/activities.mdx @@ -2,7 +2,7 @@ id: activities title: What is a Temporal Activity? sidebar_label: Activities -sidebar_position: 3 + description: This guide provides a comprehensive overview of Temporal Activities. slug: /activities toc_max_heading_level: 4 diff --git a/docs/encyclopedia/clusters.mdx b/docs/encyclopedia/clusters.mdx index c2e6a6d5c8..beb07b8653 100644 --- a/docs/encyclopedia/clusters.mdx +++ b/docs/encyclopedia/clusters.mdx @@ -2,7 +2,7 @@ id: clusters title: What is a Temporal Service? sidebar_label: Temporal Service -sidebar_position: 8 + description: This guide provides a comprehensive overview of the Temporal Service. slug: /clusters toc_max_heading_level: 4 diff --git a/docs/encyclopedia/dataconversion.mdx b/docs/encyclopedia/dataconversion.mdx index ac113e6b05..da86527f5b 100644 --- a/docs/encyclopedia/dataconversion.mdx +++ b/docs/encyclopedia/dataconversion.mdx @@ -2,7 +2,7 @@ id: dataconversion title: How does Temporal handle application data? sidebar_label: Data conversion -sidebar_position: 10 + description: This guide provides an overview of data handling using a Data Converter on the Temporal Platform. slug: /dataconversion toc_max_heading_level: 4 diff --git a/docs/encyclopedia/namespaces.mdx b/docs/encyclopedia/namespaces.mdx index 2ef81fc9eb..0fb4264216 100644 --- a/docs/encyclopedia/namespaces.mdx +++ b/docs/encyclopedia/namespaces.mdx @@ -2,7 +2,7 @@ id: namespaces title: What is a Temporal Namespace? sidebar_label: Namespaces -sidebar_position: 9 + description: This guide provides a comprehensive overview of Namespaces. slug: /namespaces toc_max_heading_level: 4 diff --git a/docs/encyclopedia/retry-policies.mdx b/docs/encyclopedia/retry-policies.mdx index 2b349831bb..08d260a308 100644 --- a/docs/encyclopedia/retry-policies.mdx +++ b/docs/encyclopedia/retry-policies.mdx @@ -2,7 +2,7 @@ id: retry-policies title: What is a Temporal Retry Policy? sidebar_label: Retry Policies -sidebar_position: 4 + description: A Retry Policy works in cooperation with the timeouts to provide fine controls to optimize the execution experience. slug: /retry-policies toc_max_heading_level: 4 diff --git a/docs/encyclopedia/temporal-sdks.mdx b/docs/encyclopedia/temporal-sdks.mdx index dda96a559d..6498198234 100644 --- a/docs/encyclopedia/temporal-sdks.mdx +++ b/docs/encyclopedia/temporal-sdks.mdx @@ -2,7 +2,7 @@ id: temporal-sdks title: About Temporal SDKs sidebar_label: About the SDKs -sidebar_position: 1 + description: Explore the components that make up a Temporal SDK and how they work to create a durable execution. toc_max_heading_level: 4 keywords: diff --git a/docs/encyclopedia/temporal.mdx b/docs/encyclopedia/temporal.mdx index e3822023ff..532b3f076a 100644 --- a/docs/encyclopedia/temporal.mdx +++ b/docs/encyclopedia/temporal.mdx @@ -2,7 +2,7 @@ id: temporal title: What is Temporal? sidebar_label: Temporal -sidebar_position: 1 + description: Discover the Temporal Platform, a runtime for durable executions that consists of a Temporal Cluster and Worker Processes, plus SDKs in multiple languages. slug: /temporal toc_max_heading_level: 4 diff --git a/docs/encyclopedia/visibility.mdx b/docs/encyclopedia/visibility.mdx index 1d0b5095ad..7ac738040a 100644 --- a/docs/encyclopedia/visibility.mdx +++ b/docs/encyclopedia/visibility.mdx @@ -2,7 +2,7 @@ id: visibility title: What is the Temporal Visibility feature? sidebar_label: Visibility -sidebar_position: 7 + description: This guide provides a comprehensive overview of Temporal Visibility. slug: /visibility toc_max_heading_level: 4 diff --git a/docs/encyclopedia/workers.mdx b/docs/encyclopedia/workers.mdx index a826933a8b..6443eaac5e 100644 --- a/docs/encyclopedia/workers.mdx +++ b/docs/encyclopedia/workers.mdx @@ -2,7 +2,7 @@ id: workers title: What is a Temporal Worker? sidebar_label: Workers -sidebar_position: 5 + description: There is a tight coupling between Temporal Task Queues and Worker Processes. slug: /workers toc_max_heading_level: 4 diff --git a/docs/encyclopedia/workflows.mdx b/docs/encyclopedia/workflows.mdx index 7ae186cd1d..26b129e7db 100644 --- a/docs/encyclopedia/workflows.mdx +++ b/docs/encyclopedia/workflows.mdx @@ -2,7 +2,7 @@ id: workflows title: What is a Temporal Workflow? sidebar_label: Workflows -sidebar_position: 2 + description: This guide provides a comprehensive overview of Temporal Workflows. slug: /workflows toc_max_heading_level: 4 diff --git a/docs/evaluate/index.mdx b/docs/evaluate/index.mdx index 01bcf53b1b..f04df57997 100644 --- a/docs/evaluate/index.mdx +++ b/docs/evaluate/index.mdx @@ -2,7 +2,7 @@ id: index title: Evaluate Temporal sidebar_label: Evaluate -sidebar_position: 2 + description: Learn more about how to deploy a Temporal Application to production. collapsed: false toc_max_heading_level: 4 diff --git a/docs/evaluate/release-stages.mdx b/docs/evaluate/release-stages.mdx index 723bc227df..81d99e1e59 100644 --- a/docs/evaluate/release-stages.mdx +++ b/docs/evaluate/release-stages.mdx @@ -2,7 +2,7 @@ id: release-stages title: Temporal product release stages guide sidebar_label: Release stages -sidebar_position: 11 + description: Learn more about Temporal product release stages toc_max_heading_level: 4 keywords: diff --git a/docs/evaluate/why-temporal.mdx b/docs/evaluate/why-temporal.mdx index 9bfce5ff7d..bbc5cc2922 100644 --- a/docs/evaluate/why-temporal.mdx +++ b/docs/evaluate/why-temporal.mdx @@ -2,7 +2,7 @@ id: why-temporal title: Why Temporal? sidebar_label: Why Temporal -sidebar_position: 1 + description: This guide provides a short overview of Why Temporal. toc_max_heading_level: 4 keywords: diff --git a/docs/getting-started.mdx b/docs/getting-started.mdx index 3ab86f4faa..c54288fdd3 100644 --- a/docs/getting-started.mdx +++ b/docs/getting-started.mdx @@ -3,7 +3,7 @@ id: getting-started title: Getting started with Temporal description: Learn how to get started using Temporal sidebar_label: Get started -sidebar_position: 2 + tags: - getting-started --- diff --git a/docs/index.mdx b/docs/index.mdx index 24711eea2d..df4b8bafaf 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -2,7 +2,7 @@ id: index title: Documentation sidebar_label: Home -sidebar_position: 1 + --- import {Intro} from '/docs/components/Intro.js' diff --git a/docs/production-deployment/cloud/account-setup/certificates.mdx b/docs/production-deployment/cloud/account-setup/certificates.mdx index 810d1ac23e..44706f4901 100644 --- a/docs/production-deployment/cloud/account-setup/certificates.mdx +++ b/docs/production-deployment/cloud/account-setup/certificates.mdx @@ -2,7 +2,7 @@ id: certificates title: Certificate management - Temporal Cloud feature guide sidebar_label: Certificates -sidebar_position: 1 + description: Create certificates and use them to control access to Namespaces. slug: /cloud/certificates toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/account-setup/index.mdx b/docs/production-deployment/cloud/account-setup/index.mdx index 2c9caee918..19568db68f 100644 --- a/docs/production-deployment/cloud/account-setup/index.mdx +++ b/docs/production-deployment/cloud/account-setup/index.mdx @@ -4,7 +4,7 @@ slug: /cloud/account-setup title: How to set up and manage your Temporal Cloud account description: Learn more about how to set up and manage your Temporal Cloud account, including certificates and users. sidebar_label: Account setup -sidebar_position: 3 + tags: - temporal cloud - temporal cloud account diff --git a/docs/production-deployment/cloud/account-setup/namespaces.mdx b/docs/production-deployment/cloud/account-setup/namespaces.mdx index e94208199d..cfe2dfe043 100644 --- a/docs/production-deployment/cloud/account-setup/namespaces.mdx +++ b/docs/production-deployment/cloud/account-setup/namespaces.mdx @@ -2,7 +2,7 @@ id: namespaces title: Namespace management - Temporal Cloud feature guide sidebar_label: Namespaces -sidebar_position: 2 + description: Create Namespaces, use Namespace endpoints for access, and obtain Namespace information. slug: /cloud/namespaces toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/account-setup/users.mdx b/docs/production-deployment/cloud/account-setup/users.mdx index 5da95201f0..8d6f96b618 100644 --- a/docs/production-deployment/cloud/account-setup/users.mdx +++ b/docs/production-deployment/cloud/account-setup/users.mdx @@ -2,7 +2,7 @@ id: users title: User management - Temporal Cloud feature guide sidebar_label: Users -sidebar_position: 3 + description: Invite users, set account level roles, and set Namespace-level positions for users. slug: /cloud/users toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/api-keys.mdx b/docs/production-deployment/cloud/api-keys.mdx index 6ced0d70f7..35a2803c44 100644 --- a/docs/production-deployment/cloud/api-keys.mdx +++ b/docs/production-deployment/cloud/api-keys.mdx @@ -2,7 +2,7 @@ id: api-keys title: API Keys - Temporal Cloud feature guide sidebar_label: API Keys -sidebar_position: 4 + description: Temporal Cloud documentation, including explanations and usage. slug: /cloud/api-keys toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/audit-logging.mdx b/docs/production-deployment/cloud/audit-logging.mdx index e2670530da..0d7ffe7884 100644 --- a/docs/production-deployment/cloud/audit-logging.mdx +++ b/docs/production-deployment/cloud/audit-logging.mdx @@ -2,7 +2,7 @@ id: audit-logging title: Audit Logging - Temporal Cloud feature guide sidebar_label: Audit Logging -sidebar_position: 8 + description: Audit Logging provides forensic access information at the account, user, and Namespace level. Configure, consume, troubleshoot, and delete audit logs. slug: /cloud/audit-logging toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/export.mdx b/docs/production-deployment/cloud/export.mdx index 20a0e44553..73e94d9d37 100644 --- a/docs/production-deployment/cloud/export.mdx +++ b/docs/production-deployment/cloud/export.mdx @@ -2,7 +2,7 @@ id: export title: Export - Temporal Cloud feature guide sidebar_label: Export -sidebar_position: 9 + description: Workflow History export allows users to export Closed Workflow Histories to a user's Cloud Storage Sink. slug: /cloud/export toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/get-started.mdx b/docs/production-deployment/cloud/get-started.mdx index 3228273021..6596af5b1a 100644 --- a/docs/production-deployment/cloud/get-started.mdx +++ b/docs/production-deployment/cloud/get-started.mdx @@ -2,7 +2,7 @@ id: get-started title: Get started with Temporal Cloud sidebar_label: Get started -sidebar_position: 2 + description: Create an account, issue certificates, create a Namespace, invite users, and connect. slug: /cloud/get-started toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/index.mdx b/docs/production-deployment/cloud/index.mdx index 8b206a4418..ffd8bc229a 100644 --- a/docs/production-deployment/cloud/index.mdx +++ b/docs/production-deployment/cloud/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal Cloud guide sidebar_label: Temporal Cloud guide -sidebar_position: 3 + description: Temporal Cloud documentation, including explanations and usage. slug: /cloud toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/index.mdx b/docs/production-deployment/cloud/introduction/index.mdx index 19575a5efa..a0f0bb815c 100644 --- a/docs/production-deployment/cloud/introduction/index.mdx +++ b/docs/production-deployment/cloud/introduction/index.mdx @@ -2,7 +2,7 @@ id: index title: Introduction to Temporal Cloud sidebar_label: Introduction -sidebar_position: 1 + description: Learn more about Temporal Cloud. slug: /cloud/introduction toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/limits.mdx b/docs/production-deployment/cloud/introduction/limits.mdx index 1781c647c9..f5ba8eb9df 100644 --- a/docs/production-deployment/cloud/introduction/limits.mdx +++ b/docs/production-deployment/cloud/introduction/limits.mdx @@ -2,7 +2,7 @@ id: limits title: System limits - Temporal Cloud sidebar_label: Limits -sidebar_position: 4 + description: Learn more about Temporal Cloud defaults, limits, and configurable settings. slug: /cloud/limits toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/overview.mdx b/docs/production-deployment/cloud/introduction/overview.mdx index d3b89847bb..4fe7c909c0 100644 --- a/docs/production-deployment/cloud/introduction/overview.mdx +++ b/docs/production-deployment/cloud/introduction/overview.mdx @@ -2,7 +2,7 @@ id: overview title: Overview - Temporal Cloud sidebar_label: Overview -sidebar_position: 1 + description: Learn more about Temporal Cloud. slug: /cloud/overview toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/pricing.mdx b/docs/production-deployment/cloud/introduction/pricing.mdx index 99f7271131..2a22f739d5 100644 --- a/docs/production-deployment/cloud/introduction/pricing.mdx +++ b/docs/production-deployment/cloud/introduction/pricing.mdx @@ -2,7 +2,7 @@ id: pricing title: Pricing - Temporal Cloud sidebar_label: Pricing -sidebar_position: 6 + description: Temporal Cloud pricing information slug: /cloud/pricing toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/security.mdx b/docs/production-deployment/cloud/introduction/security.mdx index 5893cf1827..1f08d098fe 100644 --- a/docs/production-deployment/cloud/introduction/security.mdx +++ b/docs/production-deployment/cloud/introduction/security.mdx @@ -2,7 +2,7 @@ id: security title: Security model - Temporal Cloud sidebar_label: Security model -sidebar_position: 2 + description: The security model of Temporal Cloud encompasses applications, data, and the Temporal Cloud platform. slug: /cloud/security toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/service-availability.mdx b/docs/production-deployment/cloud/introduction/service-availability.mdx index d54ad28457..ee762a2a36 100644 --- a/docs/production-deployment/cloud/introduction/service-availability.mdx +++ b/docs/production-deployment/cloud/introduction/service-availability.mdx @@ -2,7 +2,7 @@ id: service-availability title: Service availability - Temporal Cloud sidebar_label: Availability -sidebar_position: 3 + description: The operating envelope of Temporal Cloud includes availability, regions, throughput, and latency. slug: /cloud/service-availability toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/sla.mdx b/docs/production-deployment/cloud/introduction/sla.mdx index e5625fd181..f35b1f6f14 100644 --- a/docs/production-deployment/cloud/introduction/sla.mdx +++ b/docs/production-deployment/cloud/introduction/sla.mdx @@ -2,7 +2,7 @@ id: sla title: Service Level Agreement (SLA) - Temporal Cloud sidebar_label: SLA -sidebar_position: 5 + description: Learn more about Temporal Cloud's Sevice Level Agreement (SLA). slug: /cloud/sla toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/support.mdx b/docs/production-deployment/cloud/introduction/support.mdx index a48485346a..7eb34d3da3 100644 --- a/docs/production-deployment/cloud/introduction/support.mdx +++ b/docs/production-deployment/cloud/introduction/support.mdx @@ -2,7 +2,7 @@ id: support title: Services, support, and training - Temporal Cloud sidebar_label: Support -sidebar_position: 7 + description: Temporal Cloud users can reach out for help through our community Slack channel, or file a support ticket through Zendesk. slug: /cloud/support toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/metrics/index.mdx b/docs/production-deployment/cloud/metrics/index.mdx index 5471e4b6d0..27d4e6a249 100644 --- a/docs/production-deployment/cloud/metrics/index.mdx +++ b/docs/production-deployment/cloud/metrics/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal Cloud observability through metrics sidebar_label: Metrics -sidebar_position: 5 + description: Configure and track performance metrics for Temporal Cloud. slug: /cloud/metrics/ toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/operation-api.mdx b/docs/production-deployment/cloud/operation-api.mdx index 36ece5edb4..f7b63958a4 100644 --- a/docs/production-deployment/cloud/operation-api.mdx +++ b/docs/production-deployment/cloud/operation-api.mdx @@ -2,7 +2,7 @@ id: operation-api title: Operations API - Temporal Cloud feature guide sidebar_label: Cloud Ops API -sidebar_position: 7 + description: Temporal Cloud Operations API. slug: /ops toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/saml.mdx b/docs/production-deployment/cloud/saml.mdx index 725bf00fca..92990adcea 100644 --- a/docs/production-deployment/cloud/saml.mdx +++ b/docs/production-deployment/cloud/saml.mdx @@ -2,7 +2,7 @@ id: saml title: SAML authentication - Temporal Cloud feature guide sidebar_label: SAML -sidebar_position: 6 + description: Integrate a SAML identity provider with your Temporal Cloud account. slug: /cloud/saml toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/terraform-provider.mdx b/docs/production-deployment/cloud/terraform-provider.mdx index de30d1ad0e..e32681e260 100644 --- a/docs/production-deployment/cloud/terraform-provider.mdx +++ b/docs/production-deployment/cloud/terraform-provider.mdx @@ -3,7 +3,7 @@ id: terraform-provider title: Temporal Cloud Terraform provider sidebar_label: Terraform provider description: Use the Temporal Cloud Terraform provider to manage Temporal Cloud resources. -sidebar_position: 7 + tags: - temporal cloud - terraform diff --git a/docs/production-deployment/data-encryption.mdx b/docs/production-deployment/data-encryption.mdx index fa3ec05348..00be6db1bd 100644 --- a/docs/production-deployment/data-encryption.mdx +++ b/docs/production-deployment/data-encryption.mdx @@ -2,7 +2,7 @@ id: data-encryption title: Codec Server - Temporal Platform feature guide sidebar_label: Codecs and Encryption -sidebar_position: 3 + description: This guide explains how to create and deploy a Codec Server to encrypt data with Temporal. slug: /production-deployment/data-encryption toc_max_heading_level: 4 diff --git a/docs/production-deployment/index.mdx b/docs/production-deployment/index.mdx index d7f4c4feae..193317239c 100644 --- a/docs/production-deployment/index.mdx +++ b/docs/production-deployment/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal Platform production deployments sidebar_label: Production deployments -sidebar_position: 5 + description: Learn more about how to deploy a Temporal Application to production. slug: /production-deployment toc_max_heading_level: 4 diff --git a/docs/production-deployment/migration.mdx b/docs/production-deployment/migration.mdx index 158560a129..a35e714871 100644 --- a/docs/production-deployment/migration.mdx +++ b/docs/production-deployment/migration.mdx @@ -2,7 +2,7 @@ id: migration title: Migrate to Cloud sidebar_label: Migrate to Cloud -sidebar_position: 3 + description: Migrate to Temporal Cloud from a Self-hosted Cluster. slug: /production-deployments/migration toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/archival.mdx b/docs/production-deployment/self-hosted-guide/archival.mdx index d866d46ef5..5b175dd325 100644 --- a/docs/production-deployment/self-hosted-guide/archival.mdx +++ b/docs/production-deployment/self-hosted-guide/archival.mdx @@ -2,7 +2,7 @@ id: archival title: Self-hosted Archival setup sidebar_label: Archival -sidebar_position: 9 + description: Learn how to setup the self-hosted Cluster Archival feature. slug: /self-hosted-guide/archival toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/checklist.mdx b/docs/production-deployment/self-hosted-guide/checklist.mdx index 44cb095910..c047d8d255 100644 --- a/docs/production-deployment/self-hosted-guide/checklist.mdx +++ b/docs/production-deployment/self-hosted-guide/checklist.mdx @@ -2,7 +2,7 @@ id: checklist title: Temporal Platform's production readiness checklist sidebar_label: Prod checklist -sidebar_position: 3 + description: Discover all the production level steps you can take to ensure a smooth deployment. slug: /self-hosted-guide/production-checklist toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/defaults.mdx b/docs/production-deployment/self-hosted-guide/defaults.mdx index 6e13ea4c53..78d1b2236a 100644 --- a/docs/production-deployment/self-hosted-guide/defaults.mdx +++ b/docs/production-deployment/self-hosted-guide/defaults.mdx @@ -2,7 +2,7 @@ id: defaults title: Self-hosted Temporal Cluster defaults sidebar_label: Defaults -sidebar_position: 2 + description: Learn about the default limits for self-hosted Temporal Clusters. slug: /self-hosted-guide/defaults toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/index.mdx b/docs/production-deployment/self-hosted-guide/index.mdx index 4ccba31ba4..3a901a0e98 100644 --- a/docs/production-deployment/self-hosted-guide/index.mdx +++ b/docs/production-deployment/self-hosted-guide/index.mdx @@ -2,7 +2,7 @@ id: index title: Self-hosted Temporal Cluster guide sidebar_label: Self-hosted guide -sidebar_position: 5 + description: This guide provides a comprehensive overview to deploy and operate a Temporal Cluster in a live environment. slug: /self-hosted-guide toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/monitoring.mdx b/docs/production-deployment/self-hosted-guide/monitoring.mdx index 5d91cef8c9..94555a46a4 100644 --- a/docs/production-deployment/self-hosted-guide/monitoring.mdx +++ b/docs/production-deployment/self-hosted-guide/monitoring.mdx @@ -2,7 +2,7 @@ id: monitoring title: Monitor Temporal Platform metrics sidebar_label: Monitoring -sidebar_position: 4 + description: Learn how to monitor metrics and health check a self-hosted Temporal Platform. slug: /self-hosted-guide/monitoring toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx b/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx index 1e05403fe1..2f86965a57 100644 --- a/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx +++ b/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx @@ -2,7 +2,7 @@ id: multi-cluster-replication title: Self-hosted Multi-Cluster Replication sidebar_label: Multi-Cluster Replication -sidebar_position: 10 + description: Learn how to setup Multi-Cluster Replication. slug: /self-hosted-guide/multi-cluster-replication toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/security.mdx b/docs/production-deployment/self-hosted-guide/security.mdx index 8909d67183..d384a4b625 100644 --- a/docs/production-deployment/self-hosted-guide/security.mdx +++ b/docs/production-deployment/self-hosted-guide/security.mdx @@ -2,7 +2,7 @@ id: security title: Temporal Platform security features sidebar_label: Security -sidebar_position: 3 + description: This guide is an overview of the Temporal Platform security features. slug: /self-hosted-guide/security toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx index 06f8ea0c26..4985a7ca36 100644 --- a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx +++ b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx @@ -2,7 +2,7 @@ id: server-frontend-api-reference title: Server Frontend API Reference sidebar_label: Server API -sidebar_position: 11 + description: You can interact with Temporal Server via one of its APIs. slug: /self-hosted-guide/server-frontend-api-reference toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/setup.mdx b/docs/production-deployment/self-hosted-guide/setup.mdx index 96f930768e..f78b74fc06 100644 --- a/docs/production-deployment/self-hosted-guide/setup.mdx +++ b/docs/production-deployment/self-hosted-guide/setup.mdx @@ -2,7 +2,7 @@ id: setup title: Introduction to the Self-hosted Temporal Cluster deployment guide sidebar_label: Setup -sidebar_position: 1 + description: This guide provides a comprehensive overview to deploy and operate a Temporal Cluster in a live environment. slug: /self-hosted-guide/setup toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/upgrade-server.mdx b/docs/production-deployment/self-hosted-guide/upgrade-server.mdx index 1389561bb4..4406c54d95 100644 --- a/docs/production-deployment/self-hosted-guide/upgrade-server.mdx +++ b/docs/production-deployment/self-hosted-guide/upgrade-server.mdx @@ -2,7 +2,7 @@ id: upgrade-server title: Upgrade the Temporal Server sidebar_label: Upgrade server -sidebar_position: 8 + description: Learn how to keep your Temporal Server up to date. slug: /self-hosted-guide/upgrade-server toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/visibility.mdx b/docs/production-deployment/self-hosted-guide/visibility.mdx index 673b7ecff1..87d45b382f 100644 --- a/docs/production-deployment/self-hosted-guide/visibility.mdx +++ b/docs/production-deployment/self-hosted-guide/visibility.mdx @@ -2,7 +2,7 @@ id: visibility title: Self-hosted Visibility feature setup sidebar_label: Visibility -sidebar_position: 6 + description: Learn how to set up the Temporal self-hosted Cluster Visibility feature. slug: /self-hosted-guide/visibility toc_max_heading_level: 4 diff --git a/docs/references/index.mdx b/docs/references/index.mdx index c404455588..d2a88c5edf 100644 --- a/docs/references/index.mdx +++ b/docs/references/index.mdx @@ -2,7 +2,7 @@ id: index title: Temporal Platform references sidebar_label: References -sidebar_position: 10 + description: Consult the Temporal Platform references for details about configurations, Commands, Events, metrics, and APIs. --- diff --git a/docs/security.mdx b/docs/security.mdx index c2138559c5..7a37fe3ade 100644 --- a/docs/security.mdx +++ b/docs/security.mdx @@ -2,7 +2,7 @@ id: security title: Temporal Platform security sidebar_label: Security -sidebar_position: 6 + description: Find resources about the security features of the Temporal Platform. slug: /security toc_max_heading_level: 4 diff --git a/docs/tctl-v1/index.mdx b/docs/tctl-v1/index.mdx index 41a65d4a5c..25c2ced34e 100644 --- a/docs/tctl-v1/index.mdx +++ b/docs/tctl-v1/index.mdx @@ -2,7 +2,7 @@ id: index title: tctl v1.17 command reference sidebar_label: CLI (tctl) -sidebar_position: 9 + description: The Temporal CLI (tctl) is a legacy command-line tool that you can use to interact with a Temporal Cluster. slug: /tctl-v1 toc_max_heading_level: 4 diff --git a/docs/troubleshooting/index.mdx b/docs/troubleshooting/index.mdx index 6227fc4cb5..03f49ad742 100644 --- a/docs/troubleshooting/index.mdx +++ b/docs/troubleshooting/index.mdx @@ -2,7 +2,7 @@ id: index title: Error Handling and Troubleshooting sidebar_label: Troubleshooting -sidebar_position: 10 + description: This guide contains error handling and troubleshooting solutuions for Temporal edge cases. toc_max_heading_level: 4 keywords: diff --git a/docs/web-ui.mdx b/docs/web-ui.mdx index 2aec21719a..0b5b093aef 100644 --- a/docs/web-ui.mdx +++ b/docs/web-ui.mdx @@ -2,7 +2,7 @@ id: web-ui title: Temporal Web UI sidebar_label: Web UI -sidebar_position: 9 + description: Explore the intuitive web user interface (Web UI) for Temporal. Seamlessly monitor and manage your Namespaces, Workflows, Schedules, and other settings. toc_max_heading_level: 4 keywords: From 85e14797fc1361078cdf103a5d563405cc3a3735 Mon Sep 17 00:00:00 2001 From: rachfop Date: Wed, 8 May 2024 11:40:43 -0700 Subject: [PATCH 05/26] Fix yarn format --- docs/cli/activity.mdx | 34 +- docs/cli/batch.mdx | 34 +- docs/cli/cmd-options.mdx | 430 +++++++++-------- docs/cli/env.mdx | 42 +- docs/cli/operator.mdx | 86 ++-- docs/cli/schedule.mdx | 58 ++- docs/cli/server.mdx | 22 +- docs/cli/task-queue.mdx | 26 +- docs/dev-guide/activity-retry-simulator.mdx | 2 +- docs/dev-guide/golang/cancellation.mdx | 9 +- docs/dev-guide/golang/converters.mdx | 34 +- docs/dev-guide/golang/debugging.mdx | 54 +-- docs/dev-guide/golang/durable-execution.mdx | 6 +- docs/dev-guide/golang/features.mdx | 30 +- docs/dev-guide/golang/foundations.mdx | 46 +- docs/dev-guide/golang/introduction.mdx | 14 +- docs/dev-guide/golang/project-setup.mdx | 219 +++++---- docs/dev-guide/golang/versioning.mdx | 30 +- docs/dev-guide/index.mdx | 3 +- docs/dev-guide/javalang/converters.mdx | 16 +- docs/dev-guide/javalang/debugging.mdx | 6 +- docs/dev-guide/javalang/durable-execution.mdx | 24 +- docs/dev-guide/javalang/foundations.mdx | 24 +- docs/dev-guide/javalang/introduction.mdx | 18 +- docs/dev-guide/javalang/observability.mdx | 28 +- docs/dev-guide/javalang/project-setup.mdx | 302 +++++++----- docs/dev-guide/javalang/testing.mdx | 20 +- docs/dev-guide/javalang/versioning.mdx | 22 +- docs/dev-guide/phplang/debugging.mdx | 8 +- docs/dev-guide/phplang/features.mdx | 6 + docs/dev-guide/phplang/foundations.mdx | 36 +- docs/dev-guide/phplang/index.mdx | 10 +- docs/dev-guide/phplang/testing.mdx | 24 +- docs/dev-guide/python/cancellation.mdx | 1 + docs/dev-guide/python/child-workflows.mdx | 4 +- docs/dev-guide/python/continue-as-new.mdx | 2 +- docs/dev-guide/python/core-application.mdx | 26 +- docs/dev-guide/python/data-encryption.mdx | 1 - docs/dev-guide/python/debugging.mdx | 3 - docs/dev-guide/python/durable-execution.mdx | 4 +- docs/dev-guide/python/failure-detection.mdx | 10 +- docs/dev-guide/python/foundations.mdx | 24 +- docs/dev-guide/python/interrupt-workflow.mdx | 1 - docs/dev-guide/python/introduction.mdx | 6 +- docs/dev-guide/python/messages.mdx | 25 +- docs/dev-guide/python/observability.mdx | 47 +- docs/dev-guide/python/project-setup.mdx | 26 +- docs/dev-guide/python/schedules.mdx | 18 +- docs/dev-guide/python/temporal-clients.mdx | 14 +- docs/dev-guide/python/test-suites.mdx | 32 +- docs/dev-guide/python/timers.mdx | 2 +- docs/dev-guide/python/versioning.mdx | 112 +++-- docs/dev-guide/tscript/debugging.mdx | 24 +- docs/dev-guide/tscript/features.mdx | 446 ++++++++++++------ docs/dev-guide/tscript/foundations.mdx | 222 ++++++--- docs/dev-guide/tscript/index.mdx | 10 +- docs/dev-guide/tscript/introduction.mdx | 6 +- docs/dev-guide/tscript/observability.mdx | 70 +-- docs/dev-guide/tscript/project-setup.mdx | 130 ++--- docs/dev-guide/tscript/testing.mdx | 159 ++++--- docs/dev-guide/tscript/versioning.mdx | 34 +- docs/dev-guide/worker-performance.mdx | 3 +- docs/develop/go/temporal-client.mdx | 6 + docs/develop/java/temporal-client.mdx | 12 + docs/encyclopedia/activities.mdx | 131 ++++- docs/encyclopedia/child-workflows.mdx | 11 +- docs/encyclopedia/clusters.mdx | 28 +- docs/encyclopedia/dataconversion.mdx | 7 +- docs/encyclopedia/temporal-sdks.mdx | 35 +- docs/encyclopedia/temporal.mdx | 12 +- docs/encyclopedia/visibility.mdx | 19 +- docs/encyclopedia/workers.mdx | 10 +- docs/encyclopedia/workflows.mdx | 45 +- docs/evaluate/major-components.mdx | 4 +- docs/evaluate/why-temporal.mdx | 3 +- docs/getting-started.mdx | 5 - docs/index.mdx | 5 +- .../cloud/account-setup/users.mdx | 258 +++++----- .../cloud/audit-logging.mdx | 29 +- docs/production-deployment/cloud/index.mdx | 6 +- .../cloud/introduction/index.mdx | 10 +- .../cloud/introduction/limits.mdx | 51 +- .../cloud/introduction/overview.mdx | 6 +- .../introduction/service-availability.mdx | 19 +- .../cloud/introduction/sla.mdx | 14 +- .../cloud/introduction/support.mdx | 24 +- .../cloud/metrics/prometheus-grafana.mdx | 2 +- docs/production-deployment/cloud/saml.mdx | 18 +- .../cloud/tcld/account.mdx | 10 +- .../cloud/tcld/apikey.mdx | 10 +- .../cloud/tcld/feature.mdx | 10 +- .../cloud/tcld/generate-certificates.mdx | 10 +- .../cloud/tcld/index.mdx | 10 +- .../cloud/tcld/login.mdx | 10 +- .../cloud/tcld/logout.mdx | 10 +- .../cloud/tcld/namespace.mdx | 10 +- .../cloud/tcld/request.mdx | 10 +- .../production-deployment/cloud/tcld/user.mdx | 10 +- .../cloud/tcld/version.mdx | 10 +- .../cloud/terraform-provider.mdx | 115 +++-- .../production-deployment/data-encryption.mdx | 18 +- docs/production-deployment/index.mdx | 34 +- docs/production-deployment/migration.mdx | 14 +- .../self-hosted-guide/archival.mdx | 27 +- .../self-hosted-guide/checklist.mdx | 4 +- .../self-hosted-guide/defaults.mdx | 16 +- .../self-hosted-guide/index.mdx | 6 +- .../self-hosted-guide/monitoring.mdx | 2 +- .../multi-cluster-replication.mdx | 21 +- .../self-hosted-guide/security.mdx | 26 +- .../server-frontend-api-reference.mdx | 12 +- .../self-hosted-guide/upgrade-server.mdx | 6 +- .../self-hosted-guide/visibility.mdx | 143 +++--- docs/references/configuration.mdx | 78 ++- docs/references/dynamic-configuration.mdx | 44 +- docs/references/failures.mdx | 14 +- docs/references/server-options.mdx | 10 +- docs/references/web-ui-configuration.mdx | 12 +- .../web-ui-environment-variables.mdx | 18 +- docs/references/web-ui-server-env-vars.mdx | 14 +- .../troubleshooting/blob-size-limit-error.mdx | 10 +- .../deadline-exceeded-error.mdx | 10 +- .../troubleshooting/last-connection-error.mdx | 9 +- docs/web-ui.mdx | 10 +- dprint.json | 3 +- 125 files changed, 2716 insertions(+), 2025 deletions(-) diff --git a/docs/cli/activity.mdx b/docs/cli/activity.mdx index eb83b98480..e19fb1383e 100644 --- a/docs/cli/activity.mdx +++ b/docs/cli/activity.mdx @@ -5,26 +5,25 @@ sidebar_label: activity description: Explore the Temporal CLI Activity commands for efficient management of Activities. Register, inspect, and interact with Activities in your Workflows. toc_max_heading_level: 4 keywords: -- activity -- activity complete -- activity execution -- activity fail -- cli reference -- cli-feature -- command-line-interface-cli -- temporal cli + - activity + - activity complete + - activity execution + - activity fail + - cli reference + - cli-feature + - command-line-interface-cli + - temporal cli tags: -- activity -- activity-complete -- activity-execution -- activity-fail -- cli-reference -- cli-feature -- command-line-interface-cli -- temporal-cli + - activity + - activity-complete + - activity-execution + - activity-fail + - cli-reference + - cli-feature + - command-line-interface-cli + - temporal-cli --- - Activity commands operate on [Activity Executions](/activities#activity-execution). Activity commands follow this syntax: @@ -125,4 +124,3 @@ Use the following options to change the behavior of this command. - [--tls-server-name](/cli/cmd-options#tls-server-name) - [--workflow-id](/cli/cmd-options#workflow-id) - diff --git a/docs/cli/batch.mdx b/docs/cli/batch.mdx index 038de51eb4..7afc450a10 100644 --- a/docs/cli/batch.mdx +++ b/docs/cli/batch.mdx @@ -5,26 +5,25 @@ sidebar_label: batch description: Efficiently execute batch operations with the Temporal CLI. Automate and manage bulk operations seamlessly. toc_max_heading_level: 4 keywords: -- batch -- batch describe -- batch list -- batch terminate -- cli reference -- cli-feature -- command-line-interface-cli -- temporal cli + - batch + - batch describe + - batch list + - batch terminate + - cli reference + - cli-feature + - command-line-interface-cli + - temporal cli tags: -- batch -- batch-describe -- batch-list -- batch-terminate -- cli-reference -- cli-feature -- command-line-interface-cli -- temporal-cli + - batch + - batch-describe + - batch-list + - batch-terminate + - cli-reference + - cli-feature + - command-line-interface-cli + - temporal-cli --- - Batch commands change multiple [Workflow Executions](/workflows#workflow-execution) by providing a [List Filter](/clusters#visibility) and the type of Batch Job to execute. The List Filter identifies the Workflow Executions in the Batch Job; the Batch type determines what will happen to the Workflow Executions. @@ -209,4 +208,3 @@ Use the following options to change the behavior of this command. - [--tls-key-path](/cli/cmd-options#tls-key-path) - [--tls-server-name](/cli/cmd-options#tls-server-name) - diff --git a/docs/cli/cmd-options.mdx b/docs/cli/cmd-options.mdx index 264fd84ded..205210a856 100644 --- a/docs/cli/cmd-options.mdx +++ b/docs/cli/cmd-options.mdx @@ -5,224 +5,223 @@ sidebar_label: cmd options description: Explore the command-line options available in the Temporal CLI. Customize and configure various aspects of the Temporal CLI tool for seamless Workflow management. toc_max_heading_level: 4 keywords: -- actions -- active cluster -- activity -- activity execution -- activity id -- address -- archival -- backfill -- batch job -- build -- build id -- ca-certificate -- calendar -- certificate key -- child workflows -- cli reference -- cluster -- codec server -- command-line-interface-cli -- command-line-interface-cli, -- concurrency control -- configuration -- context -- continue-as-new -- cron -- cross-cluster-connection -- data converters -- endpoint -- environment -- event -- event id -- event type -- events -- external temporal and state events -- failures -- frontend -- frontend address -- frontend service -- goroutine -- grpc -- history -- http -- interval -- ip address -- job id -- log-feature -- logging -- logging and metrics -- memo -- metrics -- namespace -- namespace description -- namespace id -- namespace management -- nondeterministic -- notes -- operation -- operator -- options-feature -- overlap policy -- pager -- port -- pragma -- queries-feature -- query -- requests -- reset point -- resets-feature -- retention policy -- retries -- reuse policy -- schedule -- schedule backfill -- schedule id -- schedule pause -- schedule unpause -- schedules -- search attribute -- search attributes -- server -- server options and configurations -- sqlite -- start-to-close -- task queue -- task queue type -- temporal cli -- temporal ui -- time -- time zone -- timeout -- timeouts and heartbeats -- tls -- tls server -- uri -- verification -- visibility -- web ui -- workflow -- workflow execution -- workflow id -- workflow run -- workflow state -- workflow task -- workflow task failure -- workflow type -- workflow visibility -- x509-certificate + - actions + - active cluster + - activity + - activity execution + - activity id + - address + - archival + - backfill + - batch job + - build + - build id + - ca-certificate + - calendar + - certificate key + - child workflows + - cli reference + - cluster + - codec server + - command-line-interface-cli + - command-line-interface-cli, + - concurrency control + - configuration + - context + - continue-as-new + - cron + - cross-cluster-connection + - data converters + - endpoint + - environment + - event + - event id + - event type + - events + - external temporal and state events + - failures + - frontend + - frontend address + - frontend service + - goroutine + - grpc + - history + - http + - interval + - ip address + - job id + - log-feature + - logging + - logging and metrics + - memo + - metrics + - namespace + - namespace description + - namespace id + - namespace management + - nondeterministic + - notes + - operation + - operator + - options-feature + - overlap policy + - pager + - port + - pragma + - queries-feature + - query + - requests + - reset point + - resets-feature + - retention policy + - retries + - reuse policy + - schedule + - schedule backfill + - schedule id + - schedule pause + - schedule unpause + - schedules + - search attribute + - search attributes + - server + - server options and configurations + - sqlite + - start-to-close + - task queue + - task queue type + - temporal cli + - temporal ui + - time + - time zone + - timeout + - timeouts and heartbeats + - tls + - tls server + - uri + - verification + - visibility + - web ui + - workflow + - workflow execution + - workflow id + - workflow run + - workflow state + - workflow task + - workflow task failure + - workflow type + - workflow visibility + - x509-certificate tags: -- actions -- active-cluster -- activity -- activity-execution -- activity-id -- address -- archival -- backfill -- batch-job -- build -- build-id -- ca-certificate -- calendar -- certificate-key -- child-workflows -- cli-reference -- cluster -- codec-server -- command-line-interface-cli -- command-line-interface-cli, -- concurrency-control -- configuration -- context -- continue-as-new -- cron -- cross-cluster-connection -- data-converters -- endpoint -- environment -- event -- event-id -- event-type -- events -- external-temporal-and-state-events -- failures -- frontend -- frontend-address -- frontend-service -- goroutine -- grpc -- history -- http -- interval -- ip-address -- job-id -- log-feature -- logging -- logging-and-metrics -- memo -- metrics -- namespace -- namespace-description -- namespace-id -- namespace-management -- nondeterministic -- notes -- operation -- operator -- options-feature -- overlap-policy -- pager -- port -- pragma -- queries-feature -- query -- requests -- reset-point -- resets-feature -- retention-policy -- retries -- reuse-policy -- schedule -- schedule-backfill -- schedule-id -- schedule-pause -- schedule-unpause -- schedules -- search-attribute -- search-attributes -- server -- server-options-and-configurations -- sqlite -- start-to-close -- task-queue -- task-queue-type -- temporal-cli -- temporal-ui -- time -- time-zone -- timeout -- timeouts-and-heartbeats -- tls -- tls-server -- uri -- verification -- visibility -- web-ui -- workflow -- workflow-execution -- workflow-id -- workflow-run -- workflow-state -- workflow-task -- workflow-task-failure -- workflow-type -- workflow-visibility -- x509-certificate + - actions + - active-cluster + - activity + - activity-execution + - activity-id + - address + - archival + - backfill + - batch-job + - build + - build-id + - ca-certificate + - calendar + - certificate-key + - child-workflows + - cli-reference + - cluster + - codec-server + - command-line-interface-cli + - command-line-interface-cli, + - concurrency-control + - configuration + - context + - continue-as-new + - cron + - cross-cluster-connection + - data-converters + - endpoint + - environment + - event + - event-id + - event-type + - events + - external-temporal-and-state-events + - failures + - frontend + - frontend-address + - frontend-service + - goroutine + - grpc + - history + - http + - interval + - ip-address + - job-id + - log-feature + - logging + - logging-and-metrics + - memo + - metrics + - namespace + - namespace-description + - namespace-id + - namespace-management + - nondeterministic + - notes + - operation + - operator + - options-feature + - overlap-policy + - pager + - port + - pragma + - queries-feature + - query + - requests + - reset-point + - resets-feature + - retention-policy + - retries + - reuse-policy + - schedule + - schedule-backfill + - schedule-id + - schedule-pause + - schedule-unpause + - schedules + - search-attribute + - search-attributes + - server + - server-options-and-configurations + - sqlite + - start-to-close + - task-queue + - task-queue-type + - temporal-cli + - temporal-ui + - time + - time-zone + - timeout + - timeouts-and-heartbeats + - tls + - tls-server + - uri + - verification + - visibility + - web-ui + - workflow + - workflow-execution + - workflow-id + - workflow-run + - workflow-state + - workflow-task + - workflow-task-failure + - workflow-type + - workflow-visibility + - x509-certificate --- - ## active-cluster Active cluster name. @@ -749,4 +748,3 @@ Workflow type name. ## yes Confirm all prompts. - diff --git a/docs/cli/env.mdx b/docs/cli/env.mdx index d9b655f5fe..a5b2bb4ffe 100644 --- a/docs/cli/env.mdx +++ b/docs/cli/env.mdx @@ -5,30 +5,29 @@ sidebar_label: env description: Discover the Temporal CLI environment configuration documentation. Set up and customize various aspects of your environment. toc_max_heading_level: 4 keywords: -- cli reference -- command-line-interface-cli -- configuration -- env -- env delete -- env get -- env list -- env set -- environment -- temporal cli + - cli reference + - command-line-interface-cli + - configuration + - env + - env delete + - env get + - env list + - env set + - environment + - temporal cli tags: -- cli-reference -- command-line-interface-cli -- configuration -- env -- env-delete -- env-get -- env-list -- env-set -- environment -- temporal-cli + - cli-reference + - command-line-interface-cli + - configuration + - env + - env-delete + - env-get + - env-list + - env-set + - environment + - temporal-cli --- - Environment (or 'env') commands let the user configure the properties for the environment in use. Use `env ` alongside other commands to point the Temporal CLI at a different Temporal Server instance. @@ -188,4 +187,3 @@ List all environments. - [--tls-key-path](/cli/cmd-options#tls-key-path) - [--tls-server-name](/cli/cmd-options#tls-server-name) - diff --git a/docs/cli/operator.mdx b/docs/cli/operator.mdx index 92478ce65d..6ad6644a79 100644 --- a/docs/cli/operator.mdx +++ b/docs/cli/operator.mdx @@ -5,52 +5,51 @@ sidebar_label: operator description: Efficiently use the Temporal CLI to manage operator actions on Namespaces, Search Attributes, and Temporal Clusters. Create, update, list, and remove resources. toc_max_heading_level: 4 keywords: -- cli reference -- cluster -- cluster health -- cluster list -- cluster remove -- cluster upsert -- command-line-interface-cli -- describe -- namespace -- namespace create -- namespace delete -- namespace describe -- namespace list -- operator -- search attribute -- search attribute create -- search attribute list -- search attribute remove -- system -- temporal cli -- update + - cli reference + - cluster + - cluster health + - cluster list + - cluster remove + - cluster upsert + - command-line-interface-cli + - describe + - namespace + - namespace create + - namespace delete + - namespace describe + - namespace list + - operator + - search attribute + - search attribute create + - search attribute list + - search attribute remove + - system + - temporal cli + - update tags: -- cli-reference -- cluster -- cluster-health -- cluster-list -- cluster-remove -- cluster-upsert -- command-line-interface-cli -- describe -- namespace -- namespace-create -- namespace-delete -- namespace-describe -- namespace-list -- operator -- search-attribute -- search-attribute-create -- search-attribute-list -- search-attribute-remove -- system -- temporal-cli -- update + - cli-reference + - cluster + - cluster-health + - cluster-list + - cluster-remove + - cluster-upsert + - command-line-interface-cli + - describe + - namespace + - namespace-create + - namespace-delete + - namespace-describe + - namespace-list + - operator + - search-attribute + - search-attribute-create + - search-attribute-list + - search-attribute-remove + - system + - temporal-cli + - update --- - Operator commands enable actions on [Namespaces](/namespaces), [Search Attributes](/visibility#search-attribute), and [Temporal Clusters](/clusters). These actions are performed through subcommands. @@ -688,4 +687,3 @@ Use the following options to change this command's behavior. - [--tls-server-name](/cli/cmd-options#tls-server-name) - [--yes](/cli/cmd-options#yes) - diff --git a/docs/cli/schedule.mdx b/docs/cli/schedule.mdx index 78dae9e5b1..0dc056b012 100644 --- a/docs/cli/schedule.mdx +++ b/docs/cli/schedule.mdx @@ -5,38 +5,37 @@ sidebar_label: schedule description: Create, update, trigger, and delete Schedules in Temporal Workflows by using these commands and options in the Temporal CLI. toc_max_heading_level: 4 keywords: -- backfill -- cli reference -- command-line-interface-cli -- schedule -- schedule backfill -- schedule create -- schedule delete -- schedule describe -- schedule list -- schedule toggle -- schedule trigger -- schedule update -- temporal cli -- updates + - backfill + - cli reference + - command-line-interface-cli + - schedule + - schedule backfill + - schedule create + - schedule delete + - schedule describe + - schedule list + - schedule toggle + - schedule trigger + - schedule update + - temporal cli + - updates tags: -- backfill -- cli-reference -- command-line-interface-cli -- schedule -- schedule-backfill -- schedule-create -- schedule-delete -- schedule-describe -- schedule-list -- schedule-toggle -- schedule-trigger -- schedule-update -- temporal-cli -- updates + - backfill + - cli-reference + - command-line-interface-cli + - schedule + - schedule-backfill + - schedule-create + - schedule-delete + - schedule-describe + - schedule-list + - schedule-toggle + - schedule-trigger + - schedule-update + - temporal-cli + - updates --- - Schedule commands allow the user to create, use, and update [Schedules](/workflows#schedule). Schedules control when certain Actions for a [Workflow Execution](/workflows#workflow-execution) are performed, making it a useful tool for automation. @@ -555,4 +554,3 @@ Use the following options to change the command's behavior. - [--workflow-id](/cli/cmd-options#workflow-id) - [--workflow-type](/cli/cmd-options#workflow-type) - diff --git a/docs/cli/server.mdx b/docs/cli/server.mdx index 096fc7860a..28057fb266 100644 --- a/docs/cli/server.mdx +++ b/docs/cli/server.mdx @@ -5,20 +5,19 @@ sidebar_label: server description: Effectively manage the Temporal Server by using the Temporal command-line interface (CLI). Explore documentation about administration and configuration. toc_max_heading_level: 4 keywords: -- cli reference -- command-line-interface-cli -- server -- server start-dev -- temporal cli + - cli reference + - command-line-interface-cli + - server + - server start-dev + - temporal cli tags: -- cli-reference -- command-line-interface-cli -- server -- server-start-dev -- temporal-cli + - cli-reference + - command-line-interface-cli + - server + - server-start-dev + - temporal-cli --- - Server commands allow you to start and manage the [Temporal Server](/clusters#temporal-server) from the command line. Currently, `cli` server functionality extends to starting the Server. @@ -58,4 +57,3 @@ Use the following options to change the behavior of this command. - [--ui-ip](/cli/cmd-options#ui-ip) - [--ui-port](/cli/cmd-options#ui-port) - diff --git a/docs/cli/task-queue.mdx b/docs/cli/task-queue.mdx index 084c4b279f..1a52c5a445 100644 --- a/docs/cli/task-queue.mdx +++ b/docs/cli/task-queue.mdx @@ -5,22 +5,21 @@ sidebar_label: task-queue description: Efficiently manage Task Queues with the Temporal CLI. Create, configure, and monitor Task Queues to optimize Workflow Execution and Task processing. toc_max_heading_level: 4 keywords: -- cli reference -- command-line-interface-cli -- list partitions -- task queue -- task queue describe -- temporal cli + - cli reference + - command-line-interface-cli + - list partitions + - task queue + - task queue describe + - temporal cli tags: -- cli-reference -- command-line-interface-cli -- list-partitions -- task-queue -- task-queue-describe -- temporal-cli + - cli-reference + - command-line-interface-cli + - list-partitions + - task-queue + - task-queue-describe + - temporal-cli --- - Task Queue commands allow operations to be performed on [Task Queues](/workers#task-queue). To run a Task Queue command, run `temporal task-queue [command] [command options]` @@ -195,4 +194,3 @@ If a Task Queue isn't provided, reachability for the provided Build IDs is check Provides various commands for adding or changing the sets of compatible build IDs associated with a Task Queue. See the help text provided for each sub-command for more. - diff --git a/docs/dev-guide/activity-retry-simulator.mdx b/docs/dev-guide/activity-retry-simulator.mdx index 25dbc041bf..e7ede5798d 100644 --- a/docs/dev-guide/activity-retry-simulator.mdx +++ b/docs/dev-guide/activity-retry-simulator.mdx @@ -19,6 +19,6 @@ The _Task Time in Queue_ simulates the time the Activity Task might be waiting i Use the Activity Timeouts and Retry Policy settings to see how they impact the success or failure of an Activity Execution. -import RetrySimulator from "/docs/components/RetrySimulator/RetrySimulator"; +import RetrySimulator from '/docs/components/RetrySimulator/RetrySimulator'; diff --git a/docs/dev-guide/golang/cancellation.mdx b/docs/dev-guide/golang/cancellation.mdx index d4f650c4ed..c5220557a2 100644 --- a/docs/dev-guide/golang/cancellation.mdx +++ b/docs/dev-guide/golang/cancellation.mdx @@ -34,7 +34,9 @@ If the Workflow receives a Cancellation Request, but all Activities gracefully h It is completely up to the needs of the business process and your use case which determines whether you want to return the Cancellation error to show a Canceled status or Complete status regardless of whether a Cancellation has propagated to and/or skipped Activities. + [sample-apps/go/features/cancellation/workflow.go](https://github.com/temporalio/documentation/blob/main/sample-apps/go/features/cancellation/workflow.go) + ```go // ... // YourWorkflow is a Workflow Definition that shows how it can be canceled. @@ -73,11 +75,11 @@ func YourWorkflow(ctx workflow.Context) error { return err } ``` + ## Handle Cancellation in an Activity {#handle-cancellation-in-an-activity} - **How to handle a Cancellation in an Activity in Go.** Ensure that the Activity is Heartbeating to receive the Cancellation request and stop execution. @@ -85,7 +87,7 @@ Ensure that the Activity is Heartbeating to receive the Cancellation request and
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -112,7 +114,6 @@ func (a *Activities) ActivityToBeCanceled(ctx context.Context) (string, error) { ## Request Cancellation {#request-cancellation} - **How to request Cancellation of a Workflow and Activities in Go.** Use the `CancelWorkflow` API to cancel a Workflow Execution using its Id. @@ -120,7 +121,7 @@ Use the `CancelWorkflow` API to cancel a Workflow Execution using its Id.
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/golang/converters.mdx b/docs/dev-guide/golang/converters.mdx index 575b584ce1..1064b96003 100644 --- a/docs/dev-guide/golang/converters.mdx +++ b/docs/dev-guide/golang/converters.mdx @@ -7,26 +7,25 @@ description: The Converters and Codecs section of the Temporal Developer's guide slug: /dev-guide/go/converters toc_max_heading_level: 4 keywords: -- data converter -- developer-guide -- developer-guide-doc-type -- go -- go sdk -- how-to-doc-type -- payload conversion -- payload converter + - data converter + - developer-guide + - developer-guide-doc-type + - go + - go sdk + - how-to-doc-type + - payload conversion + - payload converter tags: -- data-converter -- developer-guide -- developer-guide-doc-type -- go -- go-sdk -- how-to-doc-type -- payload-conversion -- payload-converter + - data-converter + - developer-guide + - developer-guide-doc-type + - go + - go-sdk + - how-to-doc-type + - payload-conversion + - payload-converter --- - ## How to use a custom Payload Codec in Go {#custom-payload-codec} **Create a custom Payload Codec** @@ -169,4 +168,3 @@ To set your custom Payload Converter, use [`NewCompositeDataConverter`](https:// converter.NewJSONPayloadConverter(), ) ``` - diff --git a/docs/dev-guide/golang/debugging.mdx b/docs/dev-guide/golang/debugging.mdx index 2772b14958..97a4498c48 100644 --- a/docs/dev-guide/golang/debugging.mdx +++ b/docs/dev-guide/golang/debugging.mdx @@ -7,36 +7,35 @@ description: The Debugging section of the Temporal Go SDK Developer's guide cove slug: /dev-guide/go/debugging toc_max_heading_level: 4 keywords: -- debugging -- developer-guide-doc-type -- go sdk -- how-to-doc-type -- introduction-doc-type -- logging and metrics -- production -- temporal cli -- testing -- web ui -- workflow -- workflow definition -- workflows + - debugging + - developer-guide-doc-type + - go sdk + - how-to-doc-type + - introduction-doc-type + - logging and metrics + - production + - temporal cli + - testing + - web ui + - workflow + - workflow definition + - workflows tags: -- debugging -- developer-guide-doc-type -- go-sdk -- how-to-doc-type -- introduction-doc-type -- logging-and-metrics -- production -- temporal CLI -- testing -- web-ui -- workflow -- workflow-definition -- workflows + - debugging + - developer-guide-doc-type + - go-sdk + - how-to-doc-type + - introduction-doc-type + - logging-and-metrics + - production + - temporal CLI + - testing + - web-ui + - workflow + - workflow-definition + - workflows --- - You can use a debugger tool provided by your favorite IDE to debug your Workflow Definitions prior to testing or executing them. The Temporal Go SDK includes deadlock detection which fails a Workflow Task in case the code blocks over a second without relinquishing execution control. @@ -336,4 +335,3 @@ To alleviate this issue, you can set the `TEMPORAL_DEBUG` environment variable t Make sure to set `TEMPORAL_DEBUG` to true only during debugging. ::: - diff --git a/docs/dev-guide/golang/durable-execution.mdx b/docs/dev-guide/golang/durable-execution.mdx index 31395b5816..744b35dffa 100644 --- a/docs/dev-guide/golang/durable-execution.mdx +++ b/docs/dev-guide/golang/durable-execution.mdx @@ -174,7 +174,7 @@ If the Workflow Definition and the Event History are incompatible then the test
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -238,7 +238,7 @@ One way to produce a non-deterministic error is to use a random number to determ
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -442,7 +442,7 @@ Use the `workflow.GetLogger` API to log from Workflows to avoid seeing repeated
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/golang/features.mdx b/docs/dev-guide/golang/features.mdx index 8c7650f676..c5a379d4cc 100644 --- a/docs/dev-guide/golang/features.mdx +++ b/docs/dev-guide/golang/features.mdx @@ -415,7 +415,7 @@ Ensure that every Workflow listening to the same Update name can handle the same
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -449,7 +449,7 @@ Update handlers, unlike Query handlers, can change Workflow state.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -487,7 +487,7 @@ The platform treats a panic in the Validator function as a rejection of the Upda
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -539,7 +539,7 @@ If you supply only the Workflow Id (and provide an empty string as the Run Id pa
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1039,7 +1039,7 @@ Schedules must be initialized with a Schedule ID, [Spec](/workflows#spec), and [
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1075,7 +1075,7 @@ Specify the start and end times to execute the Workflow, along with the overlap
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1115,7 +1115,7 @@ To delete a Schedule, use `Delete()` on the `ScheduleHandle`.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1143,7 +1143,7 @@ To describe a Schedule, use `Describe()` on the ScheduleHandle.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1164,7 +1164,7 @@ To return information on all Schedules, use `ScheduleClient.List()`.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1195,7 +1195,7 @@ To unpause a Schedule, use `Unpause()` on `ScheduleHandle`.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1222,7 +1222,7 @@ To trigger a Scheduled Workflow Execution, use `trigger()` on `ScheduleHandle`.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1249,7 +1249,7 @@ Use `Update()` on the ScheduleHandle to modify a Schedule.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1541,7 +1541,7 @@ Set `EnableSessionWorker` to `true` in the Worker options.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1576,7 +1576,7 @@ If the session can't be created within `CreationTimeout`, `CreateSession()` retu
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1624,7 +1624,7 @@ If not, you get a `workflow.ErrSessionFailed` error when the next call of `workf
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/golang/foundations.mdx b/docs/dev-guide/golang/foundations.mdx index 012c65bae6..76edcd94fc 100644 --- a/docs/dev-guide/golang/foundations.mdx +++ b/docs/dev-guide/golang/foundations.mdx @@ -130,8 +130,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Darwin amd64 - - Download for Darwin arm64 + - + Download for Darwin amd64 + + - + Download for Darwin arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -146,8 +150,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Linux amd64 - - Download for Linux arm64 + - + Download for Linux amd64 + + - + Download for Linux arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -156,8 +164,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed and download the binary. - - Download for Windows amd64 - - Download for Windows arm64 + - + Download for Windows amd64 + + - + Download for Windows arm64 + 2. Extract the downloaded archive. 3. Add the `temporal.exe` binary to your PATH. @@ -240,7 +252,7 @@ Below is an example of a basic Workflow Definition.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -285,7 +297,7 @@ All Workflow Definition parameters must be serializable and can't be channels, f
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -328,7 +340,7 @@ Returning a non-nil `error` from a Workflow indicates that an error was encounte
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -374,7 +386,7 @@ To customize the Workflow Type, set the `Name` parameter with `RegisterOptions`
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -451,7 +463,7 @@ Because this is such a common need, the rest of this guide shows Activities writ
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -512,7 +524,7 @@ However, all parameters must be serializable (parameters can’t be channels, fu
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -543,7 +555,7 @@ You may wish to use a `struct` type to hold all custom values, just keep in mind
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -577,7 +589,7 @@ To customize the Activity Type, set the `Name` parameter with `RegisterOptions`
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -625,7 +637,7 @@ Otherwise, no additional limitations exist on Activity implementations.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -962,7 +974,7 @@ gow run worker/main.go # automatically reloads when file changes
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -1474,7 +1486,7 @@ For more information about configuring TLS to secure inter- and intra-network co
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/golang/introduction.mdx b/docs/dev-guide/golang/introduction.mdx index a8ff12a239..c9fa4c45ca 100644 --- a/docs/dev-guide/golang/introduction.mdx +++ b/docs/dev-guide/golang/introduction.mdx @@ -7,16 +7,15 @@ description: Learn more about Temporal Go SDK. slug: /dev-guide/go/introduction toc_max_heading_level: 4 keywords: -- dev guide -- go -- temporal sdk + - dev guide + - go + - temporal sdk tags: -- dev-guide -- go -- temporal-sdk + - dev-guide + - go + - temporal-sdk --- - Welcome to the Temporal Go SDK developer’s guide. :::info Temporal Go SDK API reference @@ -172,4 +171,3 @@ For intricate and vast use cases, having some experience with the following coul The Temporal Go SDK is MIT licensed, and contributions are welcome. Please review our [contribution guidelines](https://github.com/temporalio/sdk-go/blob/master/CONTRIBUTING.md). - diff --git a/docs/dev-guide/golang/project-setup.mdx b/docs/dev-guide/golang/project-setup.mdx index 629d5287e7..540741c250 100644 --- a/docs/dev-guide/golang/project-setup.mdx +++ b/docs/dev-guide/golang/project-setup.mdx @@ -7,46 +7,45 @@ description: The project setup section of the Temporal Go SDK Developer's guide slug: /dev-guide/go/project-setup toc_max_heading_level: 4 keywords: -- activity -- cloud certificate -- code sample -- dev guide -- developer guide -- docker -- go -- go sdk -- introduction -- project setup -- self-hosted -- temporal cli -- temporal client -- temporal cloud -- test framework -- testing -- worker -- workflow + - activity + - cloud certificate + - code sample + - dev guide + - developer guide + - docker + - go + - go sdk + - introduction + - project setup + - self-hosted + - temporal cli + - temporal client + - temporal cloud + - test framework + - testing + - worker + - workflow tags: -- activity -- cloud-certificate -- code-sample -- dev-guide -- developer-guide -- docker -- go -- go-sdk -- introduction -- project-setup -- self-hosted -- temporal-cli -- temporal-client -- temporal-cloud -- test-framework -- testing -- worker -- workflow + - activity + - cloud-certificate + - code-sample + - dev-guide + - developer-guide + - docker + - go + - go-sdk + - introduction + - project-setup + - self-hosted + - temporal-cli + - temporal-client + - temporal-cloud + - test-framework + - testing + - worker + - workflow --- - The first step to creating a new Temporal Application is to set up your development environment. This chapter walks through the steps to do that using the Go SDK. @@ -370,11 +369,15 @@ go get go.temporal.io/sdk ### Boilerplate Workflow code {#workflow-code} - In the Temporal Go SDK programming model, a [Workflow Definition](/workflows#workflow-definition) is an exportable function. The `BackgroundCheck` function below is an example of a basic Workflow Definition. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```go @@ -408,8 +411,6 @@ func BackgroundCheck(ctx workflow.Context, param string) (string, error) { } ``` - - The first parameter of a Go-based Workflow Definition must be of the [`workflow.Context`](https://pkg.go.dev/go.temporal.io/sdk/workflow#Context) type. It is used by the Temporal Go SDK to pass around Workflow Execution context, and virtually all the Go SDK APIs that are callable from the Workflow require it. It is acquired from the [`go.temporal.io/sdk/workflow`](https://pkg.go.dev/go.temporal.io/sdk/workflow) package. @@ -433,11 +434,15 @@ For example, in a small project like this, it is still a best practice to have a ### Boilerplate Activity code {#activity-code} - In the Temporal Go SDK programming model, an Activity is an exportable function or a `struct` method. Below is an example of an Activity defined as a function. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```go @@ -457,8 +462,6 @@ func SSNTraceActivity(ctx context.Context, param string) (*string, error) { } ``` - - The first parameter of an Activity Definition is `context.Context`. This parameter is optional for an Activity Definition, though it is recommended, especially if the Activity is expected to use other Go SDK APIs. @@ -468,7 +471,6 @@ For example, parameters can’t be channels, functions, variadic, or unsafe poin ### Run a dev server Worker {#dev-server-worker} - To run a Worker Process with a local development server, define the following steps in code: - Initialize a Temporal Client. @@ -478,7 +480,12 @@ To run a Worker Process with a local development server, define the following st In regards to organization, we recommend keeping Worker code separate from Workflow and Activity code. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```go @@ -520,7 +527,6 @@ func main() { } ``` - :::info Auto restart worker when code changes Use [`gow`](https://github.com/mitranim/gow) to automatically restart the Worker Process whenever any of the Go code files in your project change. @@ -534,14 +540,18 @@ gow worker/main.go # automatically restarts when the project files change ### Run a Temporal Cloud Worker {#cloud-worker} - A Temporal Cloud Worker requires that you specify the following in the Client connection options: - Temporal Cloud Namespace - Temporal Cloud Address - Certificate and private key associated with the Namespace -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```go @@ -607,17 +617,15 @@ func main() { } ``` +To run a Temporal Cloud Worker, you'll change some parameters in your Client connection code, such as updating the namespace and gRPC endpoint. +You'll use: +- The [Temporal Cloud Namespace Id](https://docs.temporal.io/cloud/namespaces#temporal-cloud-namespace-id). +- The [Namespace's gRPC endpoint](https://docs.temporal.io/cloud/namespaces#temporal-cloud-grpc-endpoint). + The endpoint uses this format `(namespace.unique_id.tmprl.cloud:port)`. +- [Paths to the SSL certificate (.pem) and private key (.key)](https://docs.temporal.io/cloud/saml#integrate-saml-with-your-temporal-cloud-account) registered to your Namespace and stored on your Worker's file system. - To run a Temporal Cloud Worker, you'll change some parameters in your Client connection code, such as updating the namespace and gRPC endpoint. - You'll use: - - - The [Temporal Cloud Namespace Id](https://docs.temporal.io/cloud/namespaces#temporal-cloud-namespace-id). - - The [Namespace's gRPC endpoint](https://docs.temporal.io/cloud/namespaces#temporal-cloud-grpc-endpoint). - The endpoint uses this format `(namespace.unique_id.tmprl.cloud:port)`. - - [Paths to the SSL certificate (.pem) and private key (.key)](https://docs.temporal.io/cloud/saml#integrate-saml-with-your-temporal-cloud-account) registered to your Namespace and stored on your Worker's file system. - - Copy the Namespace Id and the gRPC endpoint from the Namespace detail Web page on [Temporal Cloud Namespaces](https://cloud.temporal.io/namespaces). Click on a Namespace name to open the Namespace details. +Copy the Namespace Id and the gRPC endpoint from the Namespace detail Web page on [Temporal Cloud Namespaces](https://cloud.temporal.io/namespaces). Click on a Namespace name to open the Namespace details. ### Run a Self-hosted Worker {#dockerfile} @@ -685,10 +693,14 @@ Copy the IP address part. #### Customize Client options {#self-hosted-client-options} - Set IP address, port, and Namespace in the Temporal Client options. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```go @@ -731,7 +743,6 @@ func main() { } ``` - #### Build and deploy Docker image {#dockerfile} Add a Docker file to the root of your Background Check application project. @@ -831,7 +842,18 @@ When you visit for the first time, the Web UI directs you to [http://localhost:8 Use the Namespace dropdown to select the project Namespace you created earlier. -

Web UI Namespace selection

Web UI Namespace selection
+
+
+

Web UI Namespace selection

+
+
+ Web UI Namespace selection +
+
You should now be at [http://localhost:8233/namespaces/backgroundcheck_namespace/workflows](http://localhost:8233/namespaces/backgroundcheck_namespace/workflows). @@ -839,12 +861,34 @@ You should now be at [http://localhost:8233/namespaces/backgroundcheck_namespace If you ever want to confirm that a Worker is polling on the Task Queue that the Workflow started on, you can visit the Workflow Execution's details page and click on the Task Queue name. -

Click on the Task Queue name to view polling Workers

Click on the Task Queue name to view polling Workers
+
+
+

Click on the Task Queue name to view polling Workers

+
+
+ Click on the Task Queue name to view polling Workers +
+
This will direct you to a page where you can view the Workers polling that Task Queue. If there are none, the application won't run. -

Confirm Workers polling Task Queue

Confirm Workers polling Task Queue
+
+
+

Confirm Workers polling Task Queue

+
+
+ Confirm Workers polling Task Queue +
+
### Temporal Cloud @@ -914,7 +958,18 @@ The URL will look something like the following: https://cloud.temporal.io/namespaces/./workflows ``` -

View Workflows in the Cloud UI

View Workflows in the Cloud UI
+
+
+

View Workflows in the Cloud UI

+
+
+ View Workflows in the Cloud UI +
+
### Self-hosted @@ -951,13 +1006,17 @@ You should now be at [http://localhost:8080/namespaces/backgroundcheck_namespace ## Add a testing framework {#test-framework} - **How to add a Testing Framework and Tests for the Workflow and Activity.** Each Temporal SDK has a testing suite that can be used in conjunction with a typical language specific testing framework. -In the Temporal Go SDK, the `testsuite` package (https://pkg.go.dev/go.temporal.io/sdk/testsuite) provides a test environment in which the Workflow and Activity code may be run for test purposes. +In the Temporal Go SDK, the `testsuite` package (https://pkg.go.dev/go.temporal.io/sdk/testsuite) provides a test environment in which the Workflow and Activity code may be run for test purposes. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```go @@ -990,14 +1049,11 @@ func Test_BackgroundCheckApplication(t *testing.T) { } ``` - - In this example, we use a custom struct that absorbs both the testing functionality from testify (https://pkg.go.dev/github.com/stretchr/testify/suite) via `suite.Suite` and the testing functionality from the Temporal test framework via `testsuite.WorkflowTestSuite`. Next we create a regular test function recognized by the `go test` command, and pass an instance of the struct to `suite.Run`. ### Add Workflow function tests {#test-workflow-code} - We can test Workflow code for the following conditions: - Workflow status. For example, did the Workflow reach a completed status? @@ -1007,7 +1063,12 @@ We can test Workflow code for the following conditions: We can also perform a Workflow Replay test, and we'll provide detailed coverage of this topic in another section. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```go @@ -1037,8 +1098,6 @@ func (s *UnitTestSuite) Test_BackgroundCheckWorkflow() { } ``` - - Calling `env.ExecuteWorkflow(...)` executes the Workflow logic and any invoked Activities inside the test process. The first parameter of `env.ExecuteWorkflow(...)` contains a reference to Workflow function and any parameters that the Workflow needs. @@ -1051,14 +1110,18 @@ If our Workflow returned a value, we could have retrieved that value via a call ### Add Activity function tests {#test-activity-code} - We can test Activity code for the following conditions: - Error when invoking the Activity Execution. - Error when checking for the result of the Activity Execution. - Activity return values. Check to ensure the return value is expected. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```go @@ -1080,5 +1143,3 @@ func (s *UnitTestSuite) Test_SSNTraceActivity() { s.Equal("pass", result) } ``` - - diff --git a/docs/dev-guide/golang/versioning.mdx b/docs/dev-guide/golang/versioning.mdx index 386828f48d..e5cf508875 100644 --- a/docs/dev-guide/golang/versioning.mdx +++ b/docs/dev-guide/golang/versioning.mdx @@ -7,24 +7,23 @@ description: The Versioning section of the Temporal Developer's guide covers how slug: /dev-guide/go/versioning toc_max_heading_level: 4 keywords: -- determinism -- developer-guide-doc-type -- go sdk -- how-to-doc-type -- patching -- versioning -- workflows + - determinism + - developer-guide-doc-type + - go sdk + - how-to-doc-type + - patching + - versioning + - workflows tags: -- determinism -- developer-guide-doc-type -- go-sdk -- how-to-doc-type -- patching -- versioning -- workflows + - determinism + - developer-guide-doc-type + - go-sdk + - how-to-doc-type + - patching + - versioning + - workflows --- - The Temporal Platform requires that Workflow code is [deterministic](/workflows#deterministic-constraints). Because of that requirement, the Temporal Go SDK offers two dedicated versioning features. @@ -309,4 +308,3 @@ err := workflow.NewContinueAsNewError(ctx, "WorkflowName") ``` If you're migrating Workflows between incompatible Worker Build IDs and you want your continued Workflows to start using the Task Queue's latest default version, use `WithWorkflowVersioningIntent` as shown earlier before calling `NewContinueAsNewError`. - diff --git a/docs/dev-guide/index.mdx b/docs/dev-guide/index.mdx index 2f190bb342..db0eb1ddbf 100644 --- a/docs/dev-guide/index.mdx +++ b/docs/dev-guide/index.mdx @@ -3,10 +3,9 @@ id: index title: Build durable applications with Temporal description: The Temporal developer's guide provides a comprehensive overview of the structures, primitives, and features used in Temporal Application development. sidebar_label: Development - --- -import { SdkLogos } from "../components/SdkLogos"; +import { SdkLogos } from '../components/SdkLogos'; The Temporal SDK developer's guides are meant to provide a comprehensive overview of the structures, primitives, and features used in [Temporal Application](/temporal#temporal-application) development. diff --git a/docs/dev-guide/javalang/converters.mdx b/docs/dev-guide/javalang/converters.mdx index c36508c263..95695078b6 100644 --- a/docs/dev-guide/javalang/converters.mdx +++ b/docs/dev-guide/javalang/converters.mdx @@ -7,16 +7,15 @@ description: The Converters and Codecs section of the Temporal Developer's guide slug: /dev-guide/java/converters toc_max_heading_level: 4 keywords: -- Java -- developer-guide -- guide-context + - Java + - developer-guide + - guide-context tags: -- java -- developer-guide -- guide-context + - java + - developer-guide + - guide-context --- - ## How to use a custom Payload Codec in Java {#custom-payload-codec} **Create a custom Payload Codec** @@ -205,7 +204,7 @@ private static JacksonJsonPayloadConverter yourCustomJacksonJsonPayloadConverter //... ``` -To set your custom Payload Converter, use it with [withPayloadConverterOverrides](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/common/converter/DefaultDataConverter.html#withPayloadConverterOverrides(io.temporal.common.converter.PayloadConverter...)) with a new instance of `DefaultDataConverter` in your `WorkflowClient` options that you use in your Worker process and to start your Workflow Executions. +To set your custom Payload Converter, use it with [withPayloadConverterOverrides]() with a new instance of `DefaultDataConverter` in your `WorkflowClient` options that you use in your Worker process and to start your Workflow Executions. The following example shows how to set a custom `YourCustomPayloadConverter` Payload Converter. @@ -219,4 +218,3 @@ DefaultDataConverter ddc = WorkflowClientOptions.newBuilder().setDataConverter(ddc).build(); //... ``` - diff --git a/docs/dev-guide/javalang/debugging.mdx b/docs/dev-guide/javalang/debugging.mdx index 32f07a08db..ba3d0b48ce 100644 --- a/docs/dev-guide/javalang/debugging.mdx +++ b/docs/dev-guide/javalang/debugging.mdx @@ -7,12 +7,11 @@ description: The Debugging section of the Temporal Developer's guide covers the slug: /dev-guide/java/debugging toc_max_heading_level: 4 keywords: -- guide-context + - guide-context tags: -- guide-context + - guide-context --- - In addition to writing unit and integration tests, debugging your Workflows is also a very valuable testing tool. You can debug your Workflow code using a debugger provided by your favorite Java IDE. @@ -39,4 +38,3 @@ You can debug and tune Worker performance with metrics and the [Worker performan For more information, see [Observability ▶️ Metrics](/dev-guide/java/observability#metrics) for setting up SDK metrics. Debug Server performance with [Cloud metrics](/cloud/metrics/) or [self-hosted Server metrics](/self-hosted-guide/production-checklist#scaling-and-metrics). - diff --git a/docs/dev-guide/javalang/durable-execution.mdx b/docs/dev-guide/javalang/durable-execution.mdx index bc29f9d999..dd0ff8e3cd 100644 --- a/docs/dev-guide/javalang/durable-execution.mdx +++ b/docs/dev-guide/javalang/durable-execution.mdx @@ -166,7 +166,7 @@ From the Workflow details page you can copy the Event History from the JSON tab
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -223,7 +223,7 @@ One way to produce a non-deterministic error is to use a random number to determ
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -353,7 +353,7 @@ Use the `Workflow.getLogger` API to log from Workflows to suppress repeated logs
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -463,7 +463,11 @@ in the top right.

Select the Workflow Reset Option

- Select the Workflow Reset Option + Select the Workflow Reset Option
@@ -479,7 +483,11 @@ Workflow was reset.

Workflow Reset Points

- Workflow Reset Points + Workflow Reset Points
@@ -492,7 +500,11 @@ the point you chose was copied over and executed.

Workflow Terminated and Reset

- Workflow Terminated and Reset + Workflow Terminated and Reset
diff --git a/docs/dev-guide/javalang/foundations.mdx b/docs/dev-guide/javalang/foundations.mdx index 7a71d365bd..e7cd9587e1 100644 --- a/docs/dev-guide/javalang/foundations.mdx +++ b/docs/dev-guide/javalang/foundations.mdx @@ -79,8 +79,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Darwin amd64 - - Download for Darwin arm64 + - + Download for Darwin amd64 + + - + Download for Darwin arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -95,8 +99,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Linux amd64 - - Download for Linux arm64 + - + Download for Linux amd64 + + - + Download for Linux arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -105,8 +113,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed and download the binary. - - Download for Windows amd64 - - Download for Windows arm64 + - + Download for Windows amd64 + + - + Download for Windows arm64 + 2. Extract the downloaded archive. 3. Add the `temporal.exe` binary to your PATH. diff --git a/docs/dev-guide/javalang/introduction.mdx b/docs/dev-guide/javalang/introduction.mdx index fa11cdaef2..56b3303f46 100644 --- a/docs/dev-guide/javalang/introduction.mdx +++ b/docs/dev-guide/javalang/introduction.mdx @@ -7,16 +7,15 @@ description: Learn more about Temporal Java SDK. slug: /dev-guide/java/introduction toc_max_heading_level: 4 keywords: -- dev guide -- java -- temporal sdk + - dev guide + - java + - temporal sdk tags: -- dev-guide -- java -- temporal-sdk + - dev-guide + - java + - temporal-sdk --- - Welcome to Temporal Java SDK developer’s guide. :::info Temporal Java SDK API reference @@ -42,7 +41,7 @@ Developing applications with the Temporal Java SDK requires Java 1.8+. [Find the latest release](https://search.maven.org/artifact/io.temporal/temporal-sdk) of the Temporal Java SDK at Maven Central. -Add _`temporal-sdk`_ as a dependency to your _`pom.xml`_: +Add *`temporal-sdk`* as a dependency to your *`pom.xml`*: ``` @@ -52,7 +51,7 @@ Add _`temporal-sdk`_ as a dependency to your _`pom.xml`_: ``` -or to _`build.gradle`_: +or to *`build.gradle`*: ``` compile group: 'io.temporal', name: 'temporal-sdk', version: 'N.N.N' @@ -178,4 +177,3 @@ For complex and large-scale use cases, having at least some experience with a va The Temporal Java SDK is an Apache 2.0 licensed, and contributions are welcome. Please review our [contribution guidelines](https://github.com/temporalio/sdk-java/blob/master/CONTRIBUTING.md). - diff --git a/docs/dev-guide/javalang/observability.mdx b/docs/dev-guide/javalang/observability.mdx index 7c50e89cf9..f92be15f1e 100644 --- a/docs/dev-guide/javalang/observability.mdx +++ b/docs/dev-guide/javalang/observability.mdx @@ -7,20 +7,19 @@ description: Improve observability in your Java-based Temporal Workflows. View w slug: /dev-guide/java/observability toc_max_heading_level: 4 keywords: -- developer-guide -- guide-context -- how-to -- java -- sdk + - developer-guide + - guide-context + - how-to + - java + - sdk tags: -- developer-guide -- guide-context -- how-to -- java -- sdk + - developer-guide + - guide-context + - how-to + - java + - sdk --- - The observability section of the Temporal Developer's guide covers the many ways to view the current state of your [Temporal Application](/temporal#temporal-application)—that is, ways to view which [Workflow Executions](/workflows#workflow-execution) are tracked by the [Temporal Platform](/temporal#temporal-platform) and the state of any specified Workflow Execution, either currently or at points of an execution. This section covers features related to viewing the state of the application, including: @@ -130,7 +129,7 @@ To get a standard `slf4j` logger in your Workflow code, use the [`Workflow.getLo private static final Logger logger = Workflow.getLogger(DynamicDslWorkflow.class); ``` -Logs in replay mode are omitted unless the [`WorkerFactoryOptions.Builder.setEnableLoggingInReplay(boolean)`](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/worker/WorkerFactoryOptions.Builder.html#setEnableLoggingInReplay(boolean)) method is set to true. +Logs in replay mode are omitted unless the [`WorkerFactoryOptions.Builder.setEnableLoggingInReplay(boolean)`]() method is set to true. ### How to provide a custom logger {#custom-logger} @@ -173,7 +172,7 @@ Here is how to query Workflow Executions: After you've created custom Search Attributes in your Cluster (using `temporal operator search-attribute create` or the Cloud UI), you can set the values of the custom Search Attributes when starting a Workflow. -To set a custom Search Attribute, call the [`setSearchAttributes()`](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/client/WorkflowOptions.Builder.html#setSearchAttributes(java.util.Map)) method. +To set a custom Search Attribute, call the [`setSearchAttributes()`]() method. ```java WorkflowOptions workflowOptions = @@ -195,7 +194,7 @@ WorkflowOptions workflowOptions = You can upsert Search Attributes to add or update Search Attributes from within Workflow code. -In your Workflow code, call the [`upsertSearchAttributes(Map searchAttributes)`](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/workflow/Workflow.html#upsertSearchAttributes(java.util.Map)) method. +In your Workflow code, call the [`upsertSearchAttributes(Map searchAttributes)`]() method. ```java Map attr1 = new HashMap<>(); @@ -224,4 +223,3 @@ The results of `upsertSearchAttributes()` output the following search attributes To remove a Search Attribute that was previously set, set it to an empty array: `[]`. To remove a Search Attribute, call the `upsertSearchAttributes()` method and set it to an empty map. - diff --git a/docs/dev-guide/javalang/project-setup.mdx b/docs/dev-guide/javalang/project-setup.mdx index 253949c9ed..f60b875469 100644 --- a/docs/dev-guide/javalang/project-setup.mdx +++ b/docs/dev-guide/javalang/project-setup.mdx @@ -7,48 +7,47 @@ description: The project setup section of the Temporal Java SDK Developer's guid slug: /dev-guide/java/project-setup toc_max_heading_level: 4 keywords: -- activity -- cloud certificate -- code sample -- dev guide -- developer guide -- docker -- go sdk -- introduction -- java -- java sdk -- project setup -- self-hosted -- temporal cli -- temporal client -- temporal cloud -- test framework -- testing -- worker -- workflow + - activity + - cloud certificate + - code sample + - dev guide + - developer guide + - docker + - go sdk + - introduction + - java + - java sdk + - project setup + - self-hosted + - temporal cli + - temporal client + - temporal cloud + - test framework + - testing + - worker + - workflow tags: -- activity -- cloud-certificate -- code-sample -- dev-guide -- developer-guide -- docker -- go-sdk -- introduction -- java -- java-sdk -- project-setup -- self-hosted -- temporal-cli -- temporal-client -- temporal-cloud -- test-framework -- testing -- worker -- workflow + - activity + - cloud-certificate + - code-sample + - dev-guide + - developer-guide + - docker + - go-sdk + - introduction + - java + - java-sdk + - project-setup + - self-hosted + - temporal-cli + - temporal-client + - temporal-cloud + - test-framework + - testing + - worker + - workflow --- - This section covers how to use a terminal, a code editor, and a development Cluster to create a Namespace, write a single Activity Workflow, run a Worker that talks to your development Cluster, run a Workflow using the Temporal CLI, add a testing framework, and view Workflows in the Web UI. :::competency Construct a new Temporal Application project @@ -414,9 +413,12 @@ In the Temporal Java SDK programming model, a [Workflow Definition](/workflows#w #### Boilerplate Workflow Interface {#workflow-code} - - -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -435,8 +437,6 @@ public interface BackgroundCheckReplayNonDeterministicWorkflow { } ``` - - To designate an interface as a Workflow, annotate the interface declaration with `@WorkflowInterface`. Then designate a method within the interface as the Workflow Method by annotating its method signature with `@WorkflowMethod`. @@ -445,10 +445,14 @@ There can only be one Workflow Method per Workflow Definition. #### Boilerplate Workflow Implementation {#workflow-code} - Now that you've defined your Workflow Interface you can define its implementation. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -479,8 +483,6 @@ public class BackgroundCheckBoilerplateWorkflowImpl implements BackgroundCheckBo } ``` - - You define your Workflow Implementation by defining a class that `implements` the Workflow Interface. @@ -490,21 +492,21 @@ time, but Temporal requires that you set _either_ `StartToCloseTimeout` or `Sche when creating your Activities stub. You can read more about these options [in our documentation](/activities#start-to-close-timeout) As with regular Java methods, Workflow Methods support the passing of parameters. -However, all Workflow Definition parameters must be serializable (using the Jackson JSON +However, all Workflow Definition parameters must be serializable (using the Jackson JSON Payload Converter). -To request the execution of an Activity, also referred to as an [Activity Execution](/activities#activity-execution), +To request the execution of an Activity, also referred to as an [Activity Execution](/activities#activity-execution), call the Activity Method from within the Workflow Method. Use the `activities` -object that was created in the Workflow Definition to call the Activity Method -along with the any parameters that need to be passed. +object that was created in the Workflow Definition to call the Activity Method +along with the any parameters that need to be passed. -A Java-based Workflow Definition can return any serializable output, or raise an +A Java-based Workflow Definition can return any serializable output, or raise an exception if one was encountered. -We get into the best practices around Workflow parameters, return values, and +We get into the best practices around Workflow parameters, return values, and exceptions in the one of the next sections. In regards to code organization, we recommend organizing Workflow code the same -way you'd organize your standard Java code. +way you'd organize your standard Java code. ### Boilerplate Activity Code {#boilerplate-activity-code} @@ -512,10 +514,14 @@ In the Temporal Java SDK programming model, an Activity is defined as an interfa #### Boilerplate Activity Interface {#activity-code} - The `BackgroundCheckActivity` interface below is an example of a the first part defining an Activity -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -533,8 +539,6 @@ public interface BackgroundCheckBoilerplateActivities { } ``` - - To designate an interface as a Activity, annotate the interface declaration with `@ActivityInterface`. Then designate a method within the interface as the Activity Method by annotating its method signature with `@ActivityMethod`. @@ -543,10 +547,14 @@ Activity. There can multiple Activity Methods per Activity Definition. #### Boilerplate Activity Implementation {#activity-code} - Now that you've defined your Activity Interface you can define its implementation. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -555,7 +563,7 @@ public class BackgroundCheckBoilerplateActivitiesImpl implements BackgroundCheck @Override public String ssnTraceActivity(String socialSecurityNumber){ - + // This is where a call to another service would be made to perform the trace // We are simulating that the service that does SSNTrace executed successfully // with a passing value being returned @@ -567,22 +575,20 @@ public class BackgroundCheckBoilerplateActivitiesImpl implements BackgroundCheck } ``` - - You define your Activity Implementation by defining a class that `implements` the Activity Interface. As with regular Java methods, Activity Methods support the passing of parameters. -However, all Activity parameters must be serializable (using the Jackson JSON +However, all Activity parameters must be serializable (using the Jackson JSON Payload Converter). -A Java-based Activity Definition can return any serializable output, or raise an +A Java-based Activity Definition can return any serializable output, or raise an exception if one was encountered. -We get into the best practices around Activity parameters, return values, and +We get into the best practices around Activity parameters, return values, and exceptions in the one of the next sections. In regards to code organization, we recommend organizing Activity code the same -way you'd organize your standard Java code. +way you'd organize your standard Java code. ### Run your Workflow and Activities using a Worker {#run-workers} @@ -597,8 +603,8 @@ no progress unless at least one Worker is running. #### Run a dev server Worker {#dev-server-worker} - To run a Worker Process with a local development server, define the following steps in code: + - Generate the gRPC stubs necessary to configure a connection to a Temporal Cluster running on localhost using the 'default' namespace - Initialize a Temporal Client (`WorkflowClient`), passing in the gRPC stubs. - Initialize a WorkerFactory, passing in the Temporal Client (`WorkflowClient`) @@ -608,7 +614,12 @@ To run a Worker Process with a local development server, define the following st Temporal recommends keeping Worker code separate from Workflow and Activity code. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -647,17 +658,20 @@ public class DevServerWorker { factory.start(); ``` - #### Run a Temporal Cloud Worker {#cloud-worker} - A Temporal Cloud Worker requires that you specify the following in the Client connection options: - Temporal Cloud Namespace - Temporal Cloud Address - Certificate and private key associated with the Namespace -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -734,22 +748,19 @@ public class CloudWorker { } ``` +To run a Temporal Cloud Worker, you'll change some parameters in your Client connection code, such as updating the namespace and gRPC endpoint. +You'll use: +- The [Temporal Cloud Namespace Id](https://docs.temporal.io/cloud/namespaces#temporal-cloud-namespace-id). +- The [Namespace's gRPC endpoint](https://docs.temporal.io/cloud/namespaces#temporal-cloud-grpc-endpoint). + The endpoint uses this format `(namespace.unique_id.tmprl.cloud:port)`. +- [Paths to the SSL certificate (.pem) and private key (.key)](https://docs.temporal.io/cloud/saml#integrate-saml-with-your-temporal-cloud-account) registered to your Namespace and stored on your Worker's file system. -To run a Temporal Cloud Worker, you'll change some parameters in your Client connection code, such as updating the namespace and gRPC endpoint. - You'll use: - - - The [Temporal Cloud Namespace Id](https://docs.temporal.io/cloud/namespaces#temporal-cloud-namespace-id). - - The [Namespace's gRPC endpoint](https://docs.temporal.io/cloud/namespaces#temporal-cloud-grpc-endpoint). - The endpoint uses this format `(namespace.unique_id.tmprl.cloud:port)`. - - [Paths to the SSL certificate (.pem) and private key (.key)](https://docs.temporal.io/cloud/saml#integrate-saml-with-your-temporal-cloud-account) registered to your Namespace and stored on your Worker's file system. - - Copy the Namespace Id and the gRPC endpoint from the Namespace detail Web page on [Temporal Cloud Namespaces](https://cloud.temporal.io/namespaces). Click on a Namespace name to open the Namespace details. - - For information about managing and generating client certificates for Temporal Cloud, see [How to manage certificates in Temporal Cloud](https://docs.temporal.io/cloud/certificates#issue-certificates). - - For information about configuring TLS to secure inter- and intra-network communication for a Temporal Cluster, see [Temporal Customization Samples](https://github.com/temporalio/samples-server). - +Copy the Namespace Id and the gRPC endpoint from the Namespace detail Web page on [Temporal Cloud Namespaces](https://cloud.temporal.io/namespaces). Click on a Namespace name to open the Namespace details. + +For information about managing and generating client certificates for Temporal Cloud, see [How to manage certificates in Temporal Cloud](https://docs.temporal.io/cloud/certificates#issue-certificates). + +For information about configuring TLS to secure inter- and intra-network communication for a Temporal Cluster, see [Temporal Customization Samples](https://github.com/temporalio/samples-server). #### Run a Self-hosted Worker {#dockerfile} @@ -815,11 +826,15 @@ Example output: Copy the IP address part. - -Set IP address and port in the Service Stubs Options and the Namespace in the +Set IP address and port in the Service Stubs Options and the Namespace in the Temporal Client options. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -870,7 +885,6 @@ public class SelfHostedWorker { } ``` - Add a Docker file to the root of your Background Check application project. Name the file `dockerfile`, with no extensions, and add the following configuration: @@ -957,7 +971,18 @@ When you visit for the first time, the Web UI directs you to [http://localhost:8 Use the Namespace dropdown to select the project Namespace you created earlier. -

Web UI Namespace selection

Web UI Namespace selection
+
+
+

Web UI Namespace selection

+
+
+ Web UI Namespace selection +
+
You should now be at [http://localhost:8233/namespaces/backgroundcheck_namespace/workflows](http://localhost:8233/namespaces/backgroundcheck_namespace/workflows). @@ -1028,7 +1053,18 @@ The URL will look something like the following: https://cloud.temporal.io/namespaces/./workflows ``` -

View Workflows in the Cloud UI

View Workflows in the Cloud UI
+
+
+

View Workflows in the Cloud UI

+
+
+ View Workflows in the Cloud UI +
+
### Self-hosted @@ -1119,19 +1155,24 @@ Make sure to set the version that matches your dependency version of the [Tempor ### Testing Activities {#test-framework} - Temporal provides the `TestActivityEnvironment` and `TestActivityExtension` classes to allow for testing Activities outside the scope of a Workflow. Testing Activities is similar to testing non-Temporal java code. Some examples of things an Activity can be tested for are: + - Exceptions thrown when invoking the Activity Execution. - Exceptions thrown when checking for the result of the Activity Execution. - Activity return values. Check to ensure the return value is expected. This example asserts that the expected value was returned by the invocation of the Activity. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -1166,12 +1207,10 @@ public class BackgroundCheckBoilerplateActivitiesTest { } ``` - - -Temporal provides the `TestActivityExtension` class to simplify the creation of -the test environment. Using this extension you provide your Activity -to register with a Worker created by the testing framework to be used during testing. -The extension provides a a stubbed Activity object to each test as well as +Temporal provides the `TestActivityExtension` class to simplify the creation of +the test environment. Using this extension you provide your Activity +to register with a Worker created by the testing framework to be used during testing. +The extension provides a a stubbed Activity object to each test as well as manage the lifecycle of the test environment. If you require more granular control of the test environments, you can manually create and destroy all these parts in methods annotated with `@BeforeEach` and `@AfterEach` @@ -1181,29 +1220,34 @@ You annotate the method with @Test and test the results of the Activity via asse ### Testing Workflows {#test-framework-details} - Temporal provides the `TestWorkflowEnvironment` and `TestWorkflowExtension` classes to allow for testing Workflows. There are two ways to test Workflows; the first is to test the Workflow code without invoking the real Activities by mocking the Workflow's Activities and the second is to test the Workflow and its Activities in their entirety. This section will focus on the first scenario while a following -section will cover the later. +section will cover the later. -Testing your Workflows without invoking your Activities can be useful for testing -Workflow specific logic without having to worry about the Activity invocation -producing a side-effect or having any Activity downstream dependency, such as a +Testing your Workflows without invoking your Activities can be useful for testing +Workflow specific logic without having to worry about the Activity invocation +producing a side-effect or having any Activity downstream dependency, such as a microservice, be available during the duration of your testing. As for the actual testing code, testing Workflows is similar to testing non-Temporal java code. Some examples of things an Workflow can be tested for are: + - Exceptions thrown when invoking the Workflow Execution. - Exceptions thrown when checking for the result of the Workflow Execution. - Workflow return values. Check to ensure the return value is expected. We can also perform a Workflow Replay test, and we'll provide detailed coverage of this topic in another section. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -1231,7 +1275,7 @@ public class BackgroundCheckBoilerplateWorkflowTest { @Test public void testSuccessfulBackgroundCheckBoilerplateWithMocks(TestWorkflowEnvironment testEnv, Worker worker, BackgroundCheckBoilerplateWorkflow workflow) { - + // Create a mock object of your Activities BackgroundCheckBoilerplateActivities mockedActivities = mock(BackgroundCheckBoilerplateActivities.class, withSettings().withoutAnnotations()); @@ -1250,25 +1294,23 @@ public class BackgroundCheckBoilerplateWorkflowTest { // This will execute your Workflow, calling the Mocked Activities in place // of your actual implementation of the Activities. String pass_output = workflow.backgroundCheck("555-55-5555"); - + assertEquals("pass", pass_output); - + } } ``` - - As for the code, first you register your Workflow with the `TestWorkflowExtension`. -This extension allows you to pass in a `TestWorklowEnvironment`, `Worker`, and -an instance of your Workflow into your tests. To test your Workflow using mocked -activities you then create a mocked object of your Activity class to be used for -testing. Then you mock the Activity method, in this case `ssNTraceAcvitity`, so -that when when a specific value is passed to the Activity it returns a specific result. +This extension allows you to pass in a `TestWorklowEnvironment`, `Worker`, and +an instance of your Workflow into your tests. To test your Workflow using mocked +activities you then create a mocked object of your Activity class to be used for +testing. Then you mock the Activity method, in this case `ssNTraceAcvitity`, so +that when when a specific value is passed to the Activity it returns a specific result. Then the mocked object is used to register the mocked Activities with the Worker -being used in the test environment. Then you start the test environment, invoke -your Workflow as usual, passing in the specific value for your Activity so that -the Activity returns the result you are expecting. Then you assert that the +being used in the test environment. Then you start the test environment, invoke +your Workflow as usual, passing in the specific value for your Activity so that +the Activity returns the result you are expecting. Then you assert that the results are what you expected. Doiong this allows you to test the Workflow code without having to worry @@ -1276,24 +1318,29 @@ about actually invoking the Activity. ### Testing Workflow and Activity together (Integration Testing) {#test-framework} - Temporal provides the `TestWorkflowEnvironment` and `TestWorkflowExtension` classes to allow for testing Workflows. There are two ways to test Workflows; the first is to test the Workflow code without invoking the real Activities by mocking the Workflow's Activities and the second is to test the Workflow and its Activities in their entirety. This section will focus on the second scenario while a previous -section will cover the first. +section will cover the first. As for the actual testing code, testing Workflows is similar to testing non-Temporal java code. Some examples of things an Workflow can be tested for are: + - Exceptions thrown when invoking the Workflow Execution. - Exceptions thrown when checking for the result of the Workflow Execution. - Workflow return values. Check to ensure the return value is expected. We can also perform a Workflow Replay test, and we'll provide detailed coverage of this topic in another section. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```java @@ -1336,8 +1383,6 @@ public class BackgroundCheckBoilerplateWorkflowIntegrationTest { } ``` - - This example tests a complete Workflow by invoking the Activities the Workflow calls. This is, in reality, an integration test. Integration testing is useful for ensuring the complete success of your entire Workflow. However, note that @@ -1346,11 +1391,10 @@ must be online for the testing. Furthermore, any mutations the Activity would ty perform as part of its regular execution will be performed as part of testing. We recommend either having an entirely separate testing environment for testing your Workflows, or testing your Workflow and Activity code in isolation, as -detailed in prior sections in this guide. +detailed in prior sections in this guide. As for the code, first you register your Workflow with the `TestWorkflowExtension`. -This extension allows you to pass in a `TestWorkflowEnvironment`, `Worker`, and +This extension allows you to pass in a `TestWorkflowEnvironment`, `Worker`, and an instance of your Workflow into your tests. From there you register your Activities -with the Worker, start the test environment, and invoke your Workflow as you would +with the Worker, start the test environment, and invoke your Workflow as you would typically. Then you assert that the results are what you expected. - diff --git a/docs/dev-guide/javalang/testing.mdx b/docs/dev-guide/javalang/testing.mdx index 12d9011442..84b25c7b86 100644 --- a/docs/dev-guide/javalang/testing.mdx +++ b/docs/dev-guide/javalang/testing.mdx @@ -7,18 +7,17 @@ description: The Testing section of the Temporal Developer's guide covers the ma slug: /dev-guide/java/testing toc_max_heading_level: 4 keywords: -- developer-guide -- guide-context -- java -- sdk + - developer-guide + - guide-context + - java + - sdk tags: -- developer-guide -- guide-context -- java -- sdk + - developer-guide + - guide-context + - java + - sdk --- - The Testing section of the Temporal Application development guide describes the frameworks that facilitate Workflow and integration testing. In the context of Temporal, you can create these types of automated tests: @@ -272,8 +271,6 @@ Activity cancellation lets Activities know they don't need to continue work and ## Testing Workflows {#test-workflows} - - ### How to mock Activities {#mock-activities} Mock the Activity invocation when unit testing your Workflows. @@ -371,4 +368,3 @@ WorkflowReplayer.replayWorkflowExecution(file, MyWorkflow.class); In both examples, if Event History is non-deterministic, an error is thrown. You can choose to wait until all histories have been replayed with `replayWorkflowExecutions` by setting the `failFast` argument to `false`. - diff --git a/docs/dev-guide/javalang/versioning.mdx b/docs/dev-guide/javalang/versioning.mdx index f3e37dc3eb..db1596a8e4 100644 --- a/docs/dev-guide/javalang/versioning.mdx +++ b/docs/dev-guide/javalang/versioning.mdx @@ -7,20 +7,19 @@ description: The Versioning section of the Temporal Developer's guide covers how slug: /dev-guide/java/versioning toc_max_heading_level: 4 keywords: -- how-to -- java -- patching -- versioning -- workflow code + - how-to + - java + - patching + - versioning + - workflow code tags: -- how-to -- java -- patching -- versioning -- workflow-code + - how-to + - java + - patching + - versioning + - workflow-code --- - The Temporal Platform requires that Workflow code is [deterministic](/workflows#deterministic-constraints). Because of that requirement, the Temporal Java SDK offers two dedicated versioning features. @@ -214,4 +213,3 @@ private final MyActivity activity = ); // ... ``` - diff --git a/docs/dev-guide/phplang/debugging.mdx b/docs/dev-guide/phplang/debugging.mdx index 51fcf1198e..7e9c3dfda6 100644 --- a/docs/dev-guide/phplang/debugging.mdx +++ b/docs/dev-guide/phplang/debugging.mdx @@ -7,16 +7,13 @@ description: The Debugging section of the Temporal Developer's guide covers the slug: /dev-guide/php/debugging toc_max_heading_level: 4 keywords: -- guide-context + - guide-context tags: -- guide-context + - guide-context --- - ## Debugging {#debug} - - ### How to debug in a development environment {#debug-in-a-development-environment} In addition to the normal development tools of logging and a debugger, you can also see what’s happening in your Workflow by using the [Web UI](/web-ui) or [Temporal CLI](/cli). @@ -31,4 +28,3 @@ You can debug production Workflows using: You can debug and tune Worker performance with metrics and the [Worker performance guide](/dev-guide/worker-performance). Debug Server performance with [Cloud metrics](/cloud/metrics/) or [self-hosted Server metrics](/self-hosted-guide/production-checklist#scaling-and-metrics). - diff --git a/docs/dev-guide/phplang/features.mdx b/docs/dev-guide/phplang/features.mdx index a35ce6b935..ab725c6ee2 100644 --- a/docs/dev-guide/phplang/features.mdx +++ b/docs/dev-guide/phplang/features.mdx @@ -785,7 +785,9 @@ There are two parts to implementing an asynchronously completed Activity: The following example demonstrates the first part: + [app/src/AsyncActivityCompletion/GreetingActivity.php](https://github.com/temporalio/samples-php/blob/main/app/src/AsyncActivityCompletion/GreetingActivity.php) + ```php class GreetingActivity implements GreetingActivityInterface { @@ -813,12 +815,15 @@ class GreetingActivity implements GreetingActivityInterface } } ``` + The following code demonstrates how to complete the Activity successfully using `WorkflowClient`: + [app/src/AsyncActivityCompletion/CompleteCommand.php](https://github.com/temporalio/samples-php/blob/main/app/src/AsyncActivityCompletion/CompleteCommand.php) + ```php $client = $this->workflowClient->newActivityCompletionClient(); // Complete the Activity. @@ -827,6 +832,7 @@ The following code demonstrates how to complete the Activity successfully using $input->getArgument('message') ); ``` + To fail the Activity, you would do the following: diff --git a/docs/dev-guide/phplang/foundations.mdx b/docs/dev-guide/phplang/foundations.mdx index 734bf8921b..add345a3f7 100644 --- a/docs/dev-guide/phplang/foundations.mdx +++ b/docs/dev-guide/phplang/foundations.mdx @@ -111,8 +111,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Darwin amd64 - - Download for Darwin arm64 + - + Download for Darwin amd64 + + - + Download for Darwin arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -127,8 +131,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Linux amd64 - - Download for Linux arm64 + - + Download for Linux amd64 + + - + Download for Linux arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -137,8 +145,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed and download the binary. - - Download for Windows amd64 - - Download for Windows arm64 + - + Download for Windows amd64 + + - + Download for Windows arm64 + 2. Extract the downloaded archive. 3. Add the `temporal.exe` binary to your PATH. @@ -252,11 +264,11 @@ To provide the client options as an environmental variable, add the `tls` option temporal: # . . . tls: - key: "certs/client.key" - cert: "certs/client.pem" - root_ca: "certs/ca.cert" + key: 'certs/client.key' + cert: 'certs/client.pem' + root_ca: 'certs/ca.cert' client_auth_type: require_and_verify_client_cert - server_name: "tls-sample" + server_name: 'tls-sample' ``` Then update your application and use the SSL connection for `ServiceClient`. @@ -712,10 +724,10 @@ rpc: listen: tcp://127.0.0.1:6001 server: - command: "php worker.php" + command: 'php worker.php' temporal: - address: "temporal:7233" + address: 'temporal:7233' activities: num_workers: 10 ``` diff --git a/docs/dev-guide/phplang/index.mdx b/docs/dev-guide/phplang/index.mdx index 9a872ec536..45c3f72c8b 100644 --- a/docs/dev-guide/phplang/index.mdx +++ b/docs/dev-guide/phplang/index.mdx @@ -7,14 +7,13 @@ description: Learn how to use the Temporal PHP SDK. slug: /dev-guide/php toc_max_heading_level: 4 keywords: -- dev guide -- php + - dev guide + - php tags: -- dev-guide -- php + - dev-guide + - php --- - This guide is meant to provide a comprehensive overview of the structures, primitives, and features used in [Temporal Application](/temporal#temporal-application) development. ## Foundations @@ -67,4 +66,3 @@ The Testing section of the Temporal Developer's guide covers the many ways to te The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. - [Debugging](/dev-guide/php/debugging#debug): Testing provides a framework to facilitate Workflow and integration testing. - diff --git a/docs/dev-guide/phplang/testing.mdx b/docs/dev-guide/phplang/testing.mdx index 7400187396..d28df880c1 100644 --- a/docs/dev-guide/phplang/testing.mdx +++ b/docs/dev-guide/phplang/testing.mdx @@ -7,20 +7,19 @@ description: The Testing section of the Temporal Developer's guide covers the ma slug: /dev-guide/php/testing toc_max_heading_level: 4 keywords: -- PHP -- developer-guide -- guide-context -- php -- sdk + - PHP + - developer-guide + - guide-context + - php + - sdk tags: -- php -- developer-guide -- guide-context -- php -- sdk + - php + - developer-guide + - guide-context + - php + - sdk --- - The Testing section of the Temporal Application development guide describes the frameworks that facilitate Workflow and integration testing. In the context of Temporal, you can create these types of automated tests: @@ -43,8 +42,6 @@ This behavior allows you to test the Activity in isolation by calling it directl ## Testing Workflows {#test-workflows} - - ### How to mock Activities {#mock-activities} Mock the Activity invocation when unit testing your Workflows. @@ -261,4 +258,3 @@ $history = $this->workflowClient->getWorkflowHistory( (new WorkflowReplayer())->replayHistory($history); ``` - diff --git a/docs/dev-guide/python/cancellation.mdx b/docs/dev-guide/python/cancellation.mdx index c6ab6232bb..3add76edb9 100644 --- a/docs/dev-guide/python/cancellation.mdx +++ b/docs/dev-guide/python/cancellation.mdx @@ -10,6 +10,7 @@ keywords: tags: - cancellation --- + ## Cancel an Activity from a Workflow {#cancel-an-activity} **How to cancel an Activity from a Workflow** diff --git a/docs/dev-guide/python/child-workflows.mdx b/docs/dev-guide/python/child-workflows.mdx index 4556b015e5..67a55dee10 100644 --- a/docs/dev-guide/python/child-workflows.mdx +++ b/docs/dev-guide/python/child-workflows.mdx @@ -39,7 +39,7 @@ This is useful if you want to do something after it has only started, or to get
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -78,7 +78,7 @@ Set the `parent_close_policy` parameter inside the [`start_child_workflow`](http
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/python/continue-as-new.mdx b/docs/dev-guide/python/continue-as-new.mdx index fc4eb73502..379fbc2797 100644 --- a/docs/dev-guide/python/continue-as-new.mdx +++ b/docs/dev-guide/python/continue-as-new.mdx @@ -23,7 +23,7 @@ To Continue-As-New in Python, call the [`continue_as_new()`](https://python.temp
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/python/core-application.mdx b/docs/dev-guide/python/core-application.mdx index de2a700e0b..dc54acc0b0 100644 --- a/docs/dev-guide/python/core-application.mdx +++ b/docs/dev-guide/python/core-application.mdx @@ -26,7 +26,7 @@ Use the `@workflow.run` to mark the entry point method to be invoked. This must
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -61,7 +61,7 @@ Technically this can be multiple parameters, but Temporal strongly encourages a
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -91,7 +91,7 @@ To return the results of a Workflow Execution, use either `start_workflow()` or
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -124,7 +124,7 @@ You can customize the Workflow name with a custom name in the decorator argument
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -196,7 +196,7 @@ If you must use a blocking library, consider using a synchronous Activity instea
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -236,7 +236,7 @@ Technically this can be multiple parameters, but Temporal strongly encourages a
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -267,7 +267,7 @@ The following example defines an Activity that takes a string as input and retur
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -292,7 +292,7 @@ If the name parameter is not specified, the Activity name defaults to the functi
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -334,7 +334,7 @@ A single argument to the Activity is positional. Multiple arguments are not supp
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -373,7 +373,7 @@ Available timeouts are:
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -406,7 +406,7 @@ You must provide either `schedule_to_close_timeout` or `start_to_close_timeout`.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -450,7 +450,7 @@ When a Worker is created, it accepts a list of Workflows in the workflows parame
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -489,7 +489,7 @@ When a `Worker` is created, it accepts a list of Workflows in the `workflows` pa
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/python/data-encryption.mdx b/docs/dev-guide/python/data-encryption.mdx index a29ae648b4..3fd7ca81c9 100644 --- a/docs/dev-guide/python/data-encryption.mdx +++ b/docs/dev-guide/python/data-encryption.mdx @@ -11,7 +11,6 @@ tags: - data-encryption --- - This page shows the following: - How to use a custom Payload Codec diff --git a/docs/dev-guide/python/debugging.mdx b/docs/dev-guide/python/debugging.mdx index b047aa6bbd..52a4dc2468 100644 --- a/docs/dev-guide/python/debugging.mdx +++ b/docs/dev-guide/python/debugging.mdx @@ -11,10 +11,8 @@ tags: - debugging --- - ## Debugging {#debug} - ### How to debug in a development environment {#debug-in-a-development-environment} In addition to the normal development tools of logging and a debugger, you can also see what’s happening in your Workflow by using the [Web UI](/web-ui) or [Temporal CLI](/cli). @@ -33,4 +31,3 @@ You can debug and tune Worker performance with metrics and the [Worker performan For more information, see [Observability ▶️ Metrics](/dev-guide/python/observability#metrics) for setting up SDK metrics. Debug Server performance with [Cloud metrics](/cloud/metrics/) or [self-hosted Server metrics](/self-hosted-guide/production-checklist#scaling-and-metrics). - diff --git a/docs/dev-guide/python/durable-execution.mdx b/docs/dev-guide/python/durable-execution.mdx index 85f7028b92..e95e974889 100644 --- a/docs/dev-guide/python/durable-execution.mdx +++ b/docs/dev-guide/python/durable-execution.mdx @@ -181,7 +181,7 @@ If the Workflow Definition and the Event History are incompatible, then the test
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -328,7 +328,7 @@ Use the `workflow.logger` API to log from Workflows to avoid seeing repeated log
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/python/failure-detection.mdx b/docs/dev-guide/python/failure-detection.mdx index 37b6be4c3e..45a58de4cb 100644 --- a/docs/dev-guide/python/failure-detection.mdx +++ b/docs/dev-guide/python/failure-detection.mdx @@ -32,7 +32,7 @@ Available timeouts are:
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -64,7 +64,7 @@ Set the Retry Policy to either the [`start_workflow()`](https://python.temporal.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -105,7 +105,7 @@ Available timeouts are:
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -135,7 +135,7 @@ To create an Activity Retry Policy in Python, set the [RetryPolicy](https://pyth
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -158,8 +158,6 @@ from temporalio.common import RetryPolicy ) ``` - - ## Heartbeat an Activity {#activity-heartbeats} **How to Heartbeat an Activity** diff --git a/docs/dev-guide/python/foundations.mdx b/docs/dev-guide/python/foundations.mdx index 75fb163d03..6ef778db25 100644 --- a/docs/dev-guide/python/foundations.mdx +++ b/docs/dev-guide/python/foundations.mdx @@ -103,8 +103,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Darwin amd64 - - Download for Darwin arm64 + - + Download for Darwin amd64 + + - + Download for Darwin arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -119,8 +123,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Linux amd64 - - Download for Linux arm64 + - + Download for Linux amd64 + + - + Download for Linux arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -129,8 +137,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed and download the binary. - - Download for Windows amd64 - - Download for Windows arm64 + - + Download for Windows amd64 + + - + Download for Windows arm64 + 2. Extract the downloaded archive. 3. Add the `temporal.exe` binary to your PATH. diff --git a/docs/dev-guide/python/interrupt-workflow.mdx b/docs/dev-guide/python/interrupt-workflow.mdx index a4108ff478..b19604efd5 100644 --- a/docs/dev-guide/python/interrupt-workflow.mdx +++ b/docs/dev-guide/python/interrupt-workflow.mdx @@ -75,4 +75,3 @@ To terminate a Workflow Execution in Python, use the [terminate()](https://pytho ```python await client.get_workflow_handle("your_workflow_id").terminate() ``` - diff --git a/docs/dev-guide/python/introduction.mdx b/docs/dev-guide/python/introduction.mdx index 19038d089d..b99d84a44a 100644 --- a/docs/dev-guide/python/introduction.mdx +++ b/docs/dev-guide/python/introduction.mdx @@ -7,12 +7,11 @@ description: Learn more about Temporal Python SDK. slug: /dev-guide/python/introduction toc_max_heading_level: 4 keywords: -- guide-context + - guide-context tags: -- guide-context + - guide-context --- - Welcome to Temporal Python SDK developer's guide! :::info Temporal Python SDK API reference @@ -138,4 +137,3 @@ Additional Python code samples are in the [temporalio/samples-python](https://gi The Temporal Python SDK is MIT licensed, and contributions are welcome. Please review our [contribution guidelines](https://github.com/temporalio/sdk-python#development). - diff --git a/docs/dev-guide/python/messages.mdx b/docs/dev-guide/python/messages.mdx index aaea5ddae4..ce03565b6c 100644 --- a/docs/dev-guide/python/messages.mdx +++ b/docs/dev-guide/python/messages.mdx @@ -38,7 +38,7 @@ You can have a name parameter to customize the Signal's name, otherwise it defau
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -66,7 +66,7 @@ To send a Signal to the Workflow, use the [signal](https://python.temporal.io/te
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -95,7 +95,7 @@ To get the Workflow handle, you can use any of the following options.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -136,7 +136,7 @@ The Workflow Type passed is only for type annotations and not for validation.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -165,7 +165,7 @@ To send a Signal-With-Start in Python, use the [`start_workflow()`](https://pyth
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -211,7 +211,7 @@ You can either set the `name` or the `dynamic` parameter in a Query's decorator,
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -237,7 +237,7 @@ To send a Query to the Workflow, use the [`query`](https://python.temporal.io/te
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -259,7 +259,7 @@ To send a Query to a Workflow Execution from Client code, use the `query()` meth
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -344,7 +344,7 @@ The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#pa
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -377,7 +377,7 @@ The [payload_converter()](https://python.temporal.io/temporalio.activity.html#pa
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -406,7 +406,6 @@ class GreetingWorkflow: **How to set a Dynamic Signal** - A Dynamic Signal in Temporal is a Signal that is invoked dynamically at runtime if no other Signal with the same input is registered. A Signal can be made dynamic by adding `dynamic=True` to the `@signal.defn` decorator. @@ -416,7 +415,7 @@ The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#pa
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -441,7 +440,7 @@ The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#pa
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/python/observability.mdx b/docs/dev-guide/python/observability.mdx index 7fe444eb78..5dfca80acd 100644 --- a/docs/dev-guide/python/observability.mdx +++ b/docs/dev-guide/python/observability.mdx @@ -11,7 +11,6 @@ tags: - observability --- - The observability section of the Temporal Developer's guide covers the many ways to view the current state of your [Temporal Application](/temporal#temporal-application)—that is, ways to view which [Workflow Executions](/workflows#workflow-execution) are tracked by the [Temporal Platform](/temporal#temporal-platform) and the state of any specified Workflow Execution, either currently or at points of an execution. This section covers features related to viewing the state of the application, including: @@ -74,7 +73,6 @@ Send logs and errors to a logging service, so that when things go wrong, you can The SDK core uses `WARN` for its default logging level. - You can log from a Workflow using Python's standard library, by importing the logging module `logging`. Set your logging configuration to a level you want to expose logs to. @@ -86,7 +84,12 @@ logging.basicConfig(level=logging.INFO) Then in your Workflow, set your [`logger`](https://python.temporal.io/temporalio.workflow.html#logger) and level on the Workflow. The following example logs the Workflow. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -94,7 +97,6 @@ Then in your Workflow, set your [`logger`](https://python.temporal.io/temporalio workflow.logger.info("Workflow input parameter: %s" % name) ``` - ### How to provide a custom logger {#custom-logger} Use a custom logger for logging. @@ -135,10 +137,14 @@ The steps to using custom Search Attributes are: Here is how to query Workflow Executions: - Use the [list_workflows()](https://python.temporal.io/temporalio.client.Client.html#list_workflows) method on the Client handle and pass a [List Filter](/visibility#list-filter) as an argument to filter the listed Workflows. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -147,15 +153,18 @@ Use the [list_workflows()](https://python.temporal.io/temporalio.client.Client.h print(f"Workflow: {workflow.id}") ``` - ### How to set custom Search Attributes {#custom-search-attributes} After you've created custom Search Attributes in your Cluster (using `temporal operator search-attribute create`or the Cloud UI), you can set the values of the custom Search Attributes when starting a Workflow. - To set custom Search Attributes, use the `search_attributes` parameter of the ['start_workflow()'](https://python.temporal.io/temporalio.client.Client.html#start_workflow) method. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -168,17 +177,20 @@ To set custom Search Attributes, use the `search_attributes` parameter of the [' ) ``` - ### How to upsert Search Attributes {#upsert-search-attributes} You can upsert Search Attributes to add or update Search Attributes from within Workflow code. - To upsert custom Search Attributes, use the [`upsert_search_attributes()`](https://python.temporal.io/temporalio.workflow.html#upsert_search_attributes) method. The keys are added to or replace the existing Search Attributes, similar to [`dict.update()`](https://docs.python.org/3/library/stdtypes.html#dict.update). -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -186,20 +198,21 @@ The keys are added to or replace the existing Search Attributes, similar to [`di workflow.upsert_search_attributes({"CustomKeywordField": ["new-value"]}) ``` - ### How to remove a Search Attribute from a Workflow {#remove-search-attribute} To remove a Search Attribute that was previously set, set it to an empty array: `[]`. - To remove a Search Attribute, use the [`upsert_search_attributes()`](https://python.temporal.io/temporalio.workflow.html#upsert_search_attributes) function with an empty list as its value. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python # ... workflow.upsert_search_attributes({"CustomKeywordField": []}) ``` - - diff --git a/docs/dev-guide/python/project-setup.mdx b/docs/dev-guide/python/project-setup.mdx index 48f1b91f84..f37c8d8544 100644 --- a/docs/dev-guide/python/project-setup.mdx +++ b/docs/dev-guide/python/project-setup.mdx @@ -357,7 +357,7 @@ The `BackgroundCheck class` below is an example of a basic Workflow Definition.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -402,7 +402,7 @@ Below is an example of an Activity defined as a function.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -453,7 +453,7 @@ In regards to organization, we recommend keeping Worker code separate from Workf
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -498,7 +498,7 @@ A Temporal Cloud Worker requires that you specify the following in the Client co
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -624,7 +624,7 @@ Set IP address, port, and Namespace in the Temporal Client options.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -752,7 +752,11 @@ Use the Namespace dropdown to select the project Namespace you created earlier.

Web UI Namespace selection

- Web UI Namespace selection + Web UI Namespace selection
@@ -830,7 +834,11 @@ https://cloud.temporal.io/namespaces/./workflows

View Workflows in the Cloud UI

- View Workflows in the Cloud UI + View Workflows in the Cloud UI
@@ -896,7 +904,7 @@ The test is marked with `@pytest.mark.asyncio` to indicate that it is an asynchr
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -940,7 +948,7 @@ The test checks if the function returns "pass" when given the SSN "55-55-555".
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/python/schedules.mdx b/docs/dev-guide/python/schedules.mdx index d9161bcb56..f43470e03f 100644 --- a/docs/dev-guide/python/schedules.mdx +++ b/docs/dev-guide/python/schedules.mdx @@ -35,7 +35,7 @@ Other options include: `cron_expressions`, `skip`, `start_at`, and `jitter`.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -74,7 +74,7 @@ method on the Schedule Handle.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -115,7 +115,7 @@ To delete a Scheduled Workflow Execution in Python, use the [delete()](https://p
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -144,7 +144,7 @@ You can get a complete list of the attributes of the Scheduled Workflow Executio
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -174,7 +174,7 @@ If a schedule is added or deleted, it may not be available in the list immediate
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -199,7 +199,7 @@ You can pass a `note` to the `pause()` method to provide a reason for pausing th
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -226,7 +226,7 @@ To trigger a Scheduled Workflow Execution in Python, use the [trigger()](https:/
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -255,7 +255,7 @@ The following example updates the Schedule to use a new argument.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -283,7 +283,7 @@ You can set each Workflow to repeat on a schedule with the `cron_schedule` optio
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/python/temporal-clients.mdx b/docs/dev-guide/python/temporal-clients.mdx index fa2397f53c..925c37eaf4 100644 --- a/docs/dev-guide/python/temporal-clients.mdx +++ b/docs/dev-guide/python/temporal-clients.mdx @@ -62,7 +62,7 @@ Use the `connect()` method on the Client class to create and connect to a Tempor
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -110,7 +110,7 @@ The `client_cert` must be combined with `client_private_key` to authenticate the
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -155,7 +155,7 @@ To start a Workflow Execution in Python, use either the [`start_workflow()`](htt
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -192,7 +192,7 @@ To set a Task Queue in Python, specify the `task_queue` argument when executing
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -231,7 +231,7 @@ The `id` argument should be a unique identifier for the Workflow Execution.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -278,7 +278,7 @@ If the Workflow does not exist, this call fails.
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -297,4 +297,4 @@ async def main(): if __name__ == "__main__": asyncio.run(main()) -``` \ No newline at end of file +``` diff --git a/docs/dev-guide/python/test-suites.mdx b/docs/dev-guide/python/test-suites.mdx index cdf7596233..60f8047f9a 100644 --- a/docs/dev-guide/python/test-suites.mdx +++ b/docs/dev-guide/python/test-suites.mdx @@ -6,24 +6,23 @@ description: The Testing section of the Temporal Developer's guide covers the ma slug: /dev-guide/python/test_suites toc_max_heading_level: 2 keywords: -- developer-guide -- guide-context -- how-to -- python -- sdk -- testing -- time-skipping + - developer-guide + - guide-context + - how-to + - python + - sdk + - testing + - time-skipping tags: -- developer-guide -- guide-context -- how-to -- python -- sdk -- testing -- time-skipping + - developer-guide + - guide-context + - how-to + - python + - sdk + - testing + - time-skipping --- - The Testing section of the Temporal Application development guide describes the frameworks that facilitate Workflow and integration testing. In the context of Temporal, you can create these types of automated tests: @@ -84,8 +83,6 @@ assert heartbeats == ["param: test", "second heartbeat"] ## Testing Workflows {#test-workflows} - - ### How to mock Activities {#mock-activities} Mock the Activity invocation when unit testing your Workflows. @@ -227,4 +224,3 @@ You can choose to wait until all histories have been replayed with `replay_workf If the Workflow History is exported by [Temporal Web UI](/web-ui) or through [Temporal CLI](/cli), you can pass the JSON file history object as a JSON string or as a Python dictionary through the `json.load()` function, which takes a file object and returns the JSON object. ::: - diff --git a/docs/dev-guide/python/timers.mdx b/docs/dev-guide/python/timers.mdx index f56abdbf84..5ae8cf65f2 100644 --- a/docs/dev-guide/python/timers.mdx +++ b/docs/dev-guide/python/timers.mdx @@ -26,7 +26,7 @@ To set a Timer in Python, call the [`asyncio.sleep()`](https://docs.python.org/3
View the source code - {" "} + {' '} in the context of the rest of the application code.
diff --git a/docs/dev-guide/python/versioning.mdx b/docs/dev-guide/python/versioning.mdx index a5f7347f76..5671d32517 100644 --- a/docs/dev-guide/python/versioning.mdx +++ b/docs/dev-guide/python/versioning.mdx @@ -6,38 +6,37 @@ description: The Versioning section of the Temporal Developer's guide covers how slug: /dev-guide/python/versioning toc_max_heading_level: 2 keywords: -- best practices -- code sample -- deployment -- deployment safety -- deprecated patches -- how-to -- patching -- python -- python sdk -- version -- versioning -- workflow completion -- workflow history -- workflow transition + - best practices + - code sample + - deployment + - deployment safety + - deprecated patches + - how-to + - patching + - python + - python sdk + - version + - versioning + - workflow completion + - workflow history + - workflow transition tags: -- best-practices -- code-sample -- deployment -- deployment-safety -- deprecated-patches -- how-to -- patching -- python -- python-sdk -- version -- versioning -- workflow-completion -- workflow-history -- workflow-transition + - best-practices + - code-sample + - deployment + - deployment-safety + - deprecated-patches + - how-to + - patching + - python + - python-sdk + - version + - versioning + - workflow-completion + - workflow-history + - workflow-transition --- - The definition code of a Temporal Workflow must be deterministic because Temporal uses event sourcing to reconstruct the Workflow state by replaying the saved history event data on the Workflow definition code. This means that any incompatible update to the Workflow Definition code could cause @@ -49,7 +48,6 @@ Because we design for potentially long running Workflows at scale, versioning wi ## How to use the Python SDK Patching API {#python-sdk-patching-api} - In principle, the Python SDK's patching mechanism operates similarly to other SDKs in a "feature-flag" fashion. However, the "versioning" API now uses the concept of "patching in" code. To understand this, you can break it down into three steps, which reflect three stages of migration: @@ -62,7 +60,12 @@ Let's walk through this process in sequence. Suppose you have an initial Workflow version called `pre_patch_activity`: -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -83,11 +86,14 @@ class MyWorkflow: ) ``` - - Now, you want to update your code to run `post_patch_activity` instead. This represents your desired end state. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -108,8 +114,6 @@ class MyWorkflow: ) ``` - - **Problem: You cannot deploy `post_patch_activity` directly until you're certain there are no more running Workflows created using the `pre_patch_activity` code, otherwise you are likely to cause a non-deterministic error.** Instead, you'll need to deploy `post_patched_activity` and use the [patched](https://python.temporal.io/temporalio.workflow.html#patched) function to determine which version of the code to execute. @@ -120,7 +124,12 @@ Implementing patching involves three steps: 2. Remove the old code and apply [deprecate_patch](https://python.temporal.io/temporalio.workflow.html#deprecate_patch). 3. Once you're confident that all old Workflows have finished executing, remove `deprecate_patch`. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -135,17 +144,20 @@ class MyWorkflow: ) ``` - ### Patching in new code {#using-patched-for-workflow-history-markers} - Using `patched` inserts a marker into the Workflow History. ![image](https://user-images.githubusercontent.com/6764957/139673361-35d61b38-ab94-401e-ae7b-feaa52eae8c6.png) During replay, if a Worker encounters a history with that marker, it will fail the Workflow task when the Workflow code doesn't produce the same patch marker (in this case, `my-patch`). This ensures you can safely deploy code from `post_patch_activity` as a "feature flag" alongside the original version (`pre_patch_activity`). -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -166,17 +178,20 @@ class MyWorkflow: ) ``` - ### Understanding deprecated Patches in the Python SDK {#deprecated-patches} - After ensuring that all Workflows started with `pre_patch_activity` code have finished, you can [deprecate the patch](https://python.temporal.io/temporalio.workflow.html#deprecate_patch). Deprecated patches serve as a bridge between `pre_patch_activity` and `post_patch_activity`. They function similarly to regular patches by adding a marker to the Workflow History. However, this marker won't cause a replay failure when the Workflow code doesn't produce it. If, during the deployment of `post_patch_activity`, there are still live Workers running `pre_patch_activity` code and these Workers pick up Workflow histories generated by `post_patch_activity`, they will safely use the patched branch. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -192,13 +207,16 @@ class MyWorkflow: ) ``` - ### Safe Deployment of post_patch_activity {#deploy-new-code} - You can safely deploy `post_patch_activity` once all Workflows labeled my-patch or earlier are finished, based on the previously mentioned assertion. -
View the source code in the context of the rest of the application code.
+
+ + View the source code + {' '} + in the context of the rest of the application code. +
```python @@ -213,7 +231,6 @@ class MyWorkflow: ) ``` - ## How to use Worker Versioning in Python {#worker-versioning} :::caution @@ -320,4 +337,3 @@ await workflow.execute_activity( ) # ... ``` - diff --git a/docs/dev-guide/tscript/debugging.mdx b/docs/dev-guide/tscript/debugging.mdx index cfa6a1e821..3284beea47 100644 --- a/docs/dev-guide/tscript/debugging.mdx +++ b/docs/dev-guide/tscript/debugging.mdx @@ -112,9 +112,9 @@ Some common examples that will **not** work in the Workflow isolate: :::danger Antipattern ```ts -import fs from "fs"; +import fs from 'fs'; -const config = fs.readFileSync("config.json", "utf8"); +const config = fs.readFileSync('config.json', 'utf8'); ``` ::: @@ -141,10 +141,10 @@ You'll typically see an error in this form in the Webpack output: :::danger Antipattern ```ts -import { makeHTTPRequest } from "./activities"; +import { makeHTTPRequest } from './activities'; export async function yourWorkflow(): Promise { - return await makeHTTPRequest("https://temporal.io"); + return await makeHTTPRequest('https://temporal.io'); } ``` @@ -173,13 +173,13 @@ You'll typically see an error in this form in the Webpack output: To properly call your Activities from Workflow code use `proxyActivities` and make sure to only import the Activity types. ```ts -import { proxyActivities } from "@temporalio/workflow"; +import { proxyActivities } from '@temporalio/workflow'; -import type * as activities from "./activities"; +import type * as activities from './activities'; const { makeHTTPRequest } = proxyActivities(); export async function yourWorkflow(): Promise { - return await makeHTTPRequest("https://temporal.io"); + return await makeHTTPRequest('https://temporal.io'); } ``` @@ -199,8 +199,8 @@ Error: 3 INVALID_ARGUMENT: WorkflowType is not set on request. This is due to your bundler stripping out Workflow function names, which we rely on to set the "Workflow Type" in Temporal. Turn it off and it should work. -import Tabs from "@theme/Tabs"; -import TabItem from "@theme/TabItem"; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; ```js -require("esbuild").buildSync({ - entryPoints: ["app.js"], +require('esbuild').buildSync({ + entryPoints: ['app.js'], minify: true, keepNames: true, - outfile: "out.js", + outfile: 'out.js', }); ``` diff --git a/docs/dev-guide/tscript/features.mdx b/docs/dev-guide/tscript/features.mdx index 9ef1c74a9d..8a8120f6e2 100644 --- a/docs/dev-guide/tscript/features.mdx +++ b/docs/dev-guide/tscript/features.mdx @@ -61,14 +61,14 @@ A Signal has a name and can have arguments. [`defineSignal`](https://typescript.temporal.io/api/namespaces/workflow/#definesignal) ```ts -import { defineSignal } from "@temporalio/workflow"; +import { defineSignal } from '@temporalio/workflow'; interface JoinInput { userId: string; groupId: string; } -export const joinSignal = defineSignal<[JoinInput]>("join"); +export const joinSignal = defineSignal<[JoinInput]>('join'); ``` ### How to handle a Signal {#handle-signal} @@ -78,7 +78,7 @@ Workflows listen for Signals by the Signal's name. [`setHandler`](https://typescript.temporal.io/api/namespaces/workflow/#sethandler) ```ts -import { setHandler } from "@temporalio/workflow"; +import { setHandler } from '@temporalio/workflow'; export async function yourWorkflow() { const groups = new Map>(); @@ -101,14 +101,14 @@ When a Signal is sent successfully from the Temporal Client, the [WorkflowExecut [`WorkflowHandle.signal`](https://typescript.temporal.io/api/interfaces/client.WorkflowHandle#signal) ```typescript -import { Client } from "@temporalio/client"; -import { joinSignal } from "./workflows"; +import { Client } from '@temporalio/client'; +import { joinSignal } from './workflows'; const client = new Client(); -const handle = client.workflow.getHandle("workflow-id-123"); +const handle = client.workflow.getHandle('workflow-id-123'); -await handle.signal(joinSignal, { userId: "user-1", groupId: "group-1" }); +await handle.signal(joinSignal, { userId: 'user-1', groupId: 'group-1' }); ``` ### How to send a Signal from a Workflow {#send-signal-from-workflow} @@ -123,12 +123,12 @@ When an External Signal is sent: [`getExternalWorkflowHandle`](https://typescript.temporal.io/api/namespaces/workflow#getexternalworkflowhandle) ```typescript -import { getExternalWorkflowHandle } from "@temporalio/workflow"; -import { joinSignal } from "./other-workflow"; +import { getExternalWorkflowHandle } from '@temporalio/workflow'; +import { joinSignal } from './other-workflow'; export async function yourWorkflowThatSignals() { - const handle = getExternalWorkflowHandle("workflow-id-123"); - await handle.signal(joinSignal, { userId: "user-1", groupId: "group-1" }); + const handle = getExternalWorkflowHandle('workflow-id-123'); + await handle.signal(joinSignal, { userId: 'user-1', groupId: 'group-1' }); } ``` @@ -142,17 +142,17 @@ If there's a Workflow running with the given Workflow Id, it will be signaled. I [`Client.workflow.signalWithStart`](https://typescript.temporal.io/api/classes/client.WorkflowClient#signalwithstart) ```typescript -import { Client } from "@temporalio/client"; -import { joinSignal, yourWorkflow } from "./workflows"; +import { Client } from '@temporalio/client'; +import { joinSignal, yourWorkflow } from './workflows'; const client = new Client(); await client.workflow.signalWithStart(yourWorkflow, { - workflowId: "workflow-id-123", - taskQueue: "my-taskqueue", + workflowId: 'workflow-id-123', + taskQueue: 'my-taskqueue', args: [{ foo: 1 }], signal: joinSignal, - signalArgs: [{ userId: "user-1", groupId: "group-1" }], + signalArgs: [{ userId: 'user-1', groupId: 'group-1' }], }); ``` @@ -170,12 +170,17 @@ A Query has a name and can have arguments. Use [`defineQuery`](https://typescript.temporal.io/api/namespaces/workflow/#definequery) to define the name, parameters, and return value of a Query. + [state/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/state/src/workflows.ts) + ```ts import { defineQuery } from '@temporalio/workflow'; -export const getValueQuery = defineQuery('getValue'); +export const getValueQuery = defineQuery( + 'getValue' +); ``` + ### How to handle a Query {#handle-query} @@ -190,7 +195,9 @@ Use [`handleQuery`](https://typescript.temporal.io/api/interfaces/workflow.Workf You make a Query with `handle.query(query, ...args)`. A Query needs a return value, but can also take arguments. + [state/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/state/src/workflows.ts) + ```ts export async function trackState(): Promise { const state = new Map(); @@ -199,6 +206,7 @@ export async function trackState(): Promise { await CancellationScope.current().cancelRequested; } ``` + ### How to send a Query {#send-query} @@ -208,7 +216,9 @@ Queries are sent from a Temporal Client. Use [`WorkflowHandle.query`](https://typescript.temporal.io/api/interfaces/client.WorkflowHandle/#query) to query a running or completed Workflow. + [state/src/query-workflow.ts](https://github.com/temporalio/samples-typescript/blob/main/state/src/query-workflow.ts) + ```ts import { Client } from '@temporalio/client'; import { getValueQuery } from './workflows'; @@ -220,6 +230,7 @@ async function run(): Promise { console.log({ meaning }); } ``` + ## How to define Signals and Queries statically or dynamically {#static-and-dynamic-signals-and-queries} @@ -232,7 +243,9 @@ async function run(): Promise { If you know the name of your Signals and Queries upfront, we recommend declaring them outside the Workflow Definition. + [signals-queries/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/signals-queries/src/workflows.ts) + ```ts import * as wf from '@temporalio/workflow'; @@ -255,6 +268,7 @@ export async function unblockOrCancel(): Promise { } } ``` + This technique helps provide type safety because you can export the type signature of the Signal or Query to be called by the Client. @@ -268,7 +282,7 @@ You can handle it in two ways: - Actually make the Signal name dynamic by inlining the Signal definition per handler. ```ts -import * as wf from "@temporalio/workflow"; +import * as wf from '@temporalio/workflow'; // "fat handler" solution wf.setHandler(`genericSignal`, (payload) => { @@ -280,7 +294,7 @@ wf.setHandler(`genericSignal`, (payload) => { // do task B things break; default: - throw new Error("Unexpected task."); + throw new Error('Unexpected task.'); } }); @@ -293,7 +307,8 @@ wf.setHandler(wf.defineSignal(`task-${taskBId}`), (payload) => { }); // utility "inline definition" helper -const inlineSignal = (signalName, handler) => wf.setHandler(wf.defineSignal(signalName), handler); +const inlineSignal = (signalName, handler) => + wf.setHandler(wf.defineSignal(signalName), handler); inlineSignal(`task-${taskBId}`, (payload) => { /* do task B things */ }); @@ -314,9 +329,11 @@ The following is their [entire source code](https://github.com/temporalio/sdk-ty /** * Define a signal method for a Workflow. */ -export function defineSignal(name: string): SignalDefinition { +export function defineSignal( + name: string +): SignalDefinition { return { - type: "signal", + type: 'signal', name, }; } @@ -324,9 +341,11 @@ export function defineSignal(name: string): SignalDefin /** * Define a query method for a Workflow. */ -export function defineQuery(name: string): QueryDefinition { +export function defineQuery( + name: string +): QueryDefinition { return { - type: "query", + type: 'query', name, }; } @@ -369,36 +388,45 @@ Available timeouts are: - [`workflowTaskTimeout`](https://typescript.temporal.io/api/interfaces/client.WorkflowOptions/#workflowtasktimeout) + [snippets/src/client.ts](https://github.com/temporalio/samples-typescript/blob/main/snippets/src/client.ts) + ```ts - await client.workflow.start(example, { - taskQueue, - workflowId, - workflowExecutionTimeout: '1 day', - }); +await client.workflow.start(example, { + taskQueue, + workflowId, + workflowExecutionTimeout: '1 day', +}); ``` + + [snippets/src/client.ts](https://github.com/temporalio/samples-typescript/blob/main/snippets/src/client.ts) + ```ts - await client.workflow.start(example, { - taskQueue, - workflowId, - workflowRunTimeout: '1 minute', - }); +await client.workflow.start(example, { + taskQueue, + workflowId, + workflowRunTimeout: '1 minute', +}); ``` + + [snippets/src/client.ts](https://github.com/temporalio/samples-typescript/blob/main/snippets/src/client.ts) + ```ts - await client.workflow.start(example, { - taskQueue, - workflowId, - workflowTaskTimeout: '1 minute', - }); +await client.workflow.start(example, { + taskQueue, + workflowId, + workflowTaskTimeout: '1 minute', +}); ``` + ### Workflow retries {#workflow-retries} @@ -412,16 +440,19 @@ Workflow Executions do not retry by default, and Retry Policies should be used w Create an instance of the Retry Policy, known as [`retry`](https://typescript.temporal.io/api/interfaces/client.WorkflowOptions/#retry) in TypeScript, from the [`WorkflowOptions`](https://typescript.temporal.io/api/interfaces/client.WorkflowOptions) of the Client interface. + [snippets/src/client.ts](https://github.com/temporalio/samples-typescript/blob/main/snippets/src/client.ts) + ```ts - const handle = await client.workflow.start(example, { - taskQueue, - workflowId, - retry: { - maximumAttempts: 3, - }, - }); +const handle = await client.workflow.start(example, { + taskQueue, + workflowId, + retry: { + maximumAttempts: 3, + }, +}); ``` + ## How to set Activity timeouts {#activity-timeouts} @@ -447,13 +478,13 @@ Available timeouts are: ```typescript // Sample of typical options you can set const { greet } = proxyActivities({ - scheduleToCloseTimeout: "5m", + scheduleToCloseTimeout: '5m', // startToCloseTimeout: "30s", // recommended // scheduleToStartTimeout: "60s", retry: { // default retry policy if not specified - initialInterval: "1s", + initialInterval: '1s', backoffCoefficient: 2, maximumAttempts: Infinity, maximumInterval: 100 * initialInterval, @@ -476,7 +507,7 @@ const { yourActivity } = proxyActivities({ // ... retry: { // default retry policy if not specified - initialInterval: "1s", + initialInterval: '1s', backoffCoefficient: 2, maximumAttempts: Infinity, maximumInterval: 100 * initialInterval, @@ -517,8 +548,8 @@ export async function example(sleepIntervalMs = 1000): Promise { // workflow code calling activity const { example } = proxyActivities({ - startToCloseTimeout: "1 hour", - heartbeatTimeout: "10s", + startToCloseTimeout: '1 hour', + heartbeatTimeout: '10s', }); ``` @@ -551,9 +582,9 @@ To set a Heartbeat Timeout, use [`ActivityOptions.heartbeatTimeout`](https://typ // Creating a proxy for the activity. const { longRunningActivity } = proxyActivities({ // translates to 300000 ms - scheduleToCloseTimeout: "5m", + scheduleToCloseTimeout: '5m', // translates to 30000 ms - startToCloseTimeout: "30s", + startToCloseTimeout: '30s', // equivalent to '10 seconds' heartbeatTimeout: 10000, }); @@ -573,7 +604,9 @@ There are three steps to follow: To asynchronously complete an Activity, call [`AsyncCompletionClient.complete`](https://typescript.temporal.io/api/classes/client.AsyncCompletionClient#complete). + [activities-examples/src/activities/async-completion.ts](https://github.com/temporalio/samples-typescript/blob/main/activities-examples/src/activities/async-completion.ts) + ```ts import { CompleteAsyncError, activityInfo } from '@temporalio/activity'; import { AsyncCompletionClient } from '@temporalio/client'; @@ -591,6 +624,7 @@ async function doSomeWork(taskToken: Uint8Array): Promise { await client.complete(taskToken, "Job's done!"); } ``` + ## Local Activities {#local-activities} @@ -598,14 +632,14 @@ async function doSomeWork(taskToken: Uint8Array): Promise { To call [Local Activities](/activities#local-activity) in TypeScript, use [`proxyLocalActivities`](https://typescript.temporal.io/api/namespaces/workflow/#proxylocalactivities). ```ts -import * as workflow from "@temporalio/workflow"; +import * as workflow from '@temporalio/workflow'; const { getEnvVar } = workflow.proxyLocalActivities({ - startToCloseTimeout: "2 seconds", + startToCloseTimeout: '2 seconds', }); export async function yourWorkflow(): Promise { - const someSetting = await getEnvVar("SOME_SETTING"); + const someSetting = await getEnvVar('SOME_SETTING'); // ... } ``` @@ -645,7 +679,7 @@ Then get the value of an object that acts as a proxy for a result that is initia To start a Child Workflow Execution and return a [handle](https://typescript.temporal.io/api/interfaces/workflow.ChildWorkflowHandle/) to it, use [startChild](https://typescript.temporal.io/api/namespaces/workflow/#startchild). ```ts -import { startChild } from "@temporalio/workflow"; +import { startChild } from '@temporalio/workflow'; export async function parentWorkflow(names: string[]) { const childHandle = await startChild(childWorkflow, { @@ -656,7 +690,7 @@ export async function parentWorkflow(names: string[]) { // parentClosePolicy: ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE }); // you can use childHandle to signal or get result here - await childHandle.signal("anySignal"); + await childHandle.signal('anySignal'); const result = childHandle.result(); // you can use childHandle to signal, query, cancel, terminate, or get result here } @@ -667,7 +701,9 @@ To start a Child Workflow Execution and await its completion, use [executeChild] By default, a child is scheduled on the same Task Queue as the parent. + [child-workflows/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/child-workflows/src/workflows.ts) + ```ts import { executeChild } from '@temporalio/workflow'; @@ -686,12 +722,13 @@ export async function parentWorkflow(...names: string[]): Promise { return responseArray.join('\n'); } ``` + To control any running Workflow from inside a Workflow, use [getExternalWorkflowHandle(workflowId)](https://typescript.temporal.io/api/namespaces/workflow/#getexternalworkflowhandle). ```ts -import { getExternalWorkflowHandle, workflowInfo } from "@temporalio/workflow"; +import { getExternalWorkflowHandle, workflowInfo } from '@temporalio/workflow'; export async function terminateWorkflow() { const { workflowId } = workflowInfo(); // no await needed @@ -718,7 +755,9 @@ The default Parent Close Policy option is set to terminate the Child Workflow Ex To specify how a Child Workflow reacts to a Parent Workflow reaching a Closed state, use the [`parentClosePolicy`](https://typescript.temporal.io/api/interfaces/workflow.ChildWorkflowOptions#parentclosepolicy) option. + [child-workflows/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/child-workflows/src/workflows.ts) + ```ts import { executeChild } from '@temporalio/workflow'; @@ -737,6 +776,7 @@ export async function parentWorkflow(...names: string[]): Promise { return responseArray.join('\n'); } ``` + ## How to Continue-As-New {#continue-as-new} @@ -747,7 +787,9 @@ The Workflow Execution spawned from the use of Continue-As-New has the same Work To cause a Workflow Execution to [Continue-As-New](/workflows#continue-as-new), the Workflow function should return the result of the [`continueAsNew`](https://typescript.temporal.io/api/namespaces/workflow#continueasnew). + [continue-as-new/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/continue-as-new/src/workflows.ts) + ```ts import { continueAsNew, sleep, log } from '@temporalio/workflow'; @@ -762,6 +804,7 @@ export async function loopingWorkflow(iteration = 0): Promise { // Unreachable code, continueAsNew is like `process.exit` and will stop execution once called. } ``` + ### Single-entity design pattern in TypeScript {#single-entity-pattern} @@ -779,7 +822,10 @@ interface Update { const MAX_ITERATIONS = 1; -export async function entityWorkflow(input: Input, isNew = true): Promise { +export async function entityWorkflow( + input: Input, + isNew = true +): Promise { try { const pendingUpdates = Array(); setHandler(updateSignal, (updateCommand) => { @@ -794,7 +840,7 @@ export async function entityWorkflow(input: Input, isNew = true): Promise // Ensure that we don't block the Workflow Execution forever waiting // for updates, which means that it will eventually Continue-As-New // even if it does not receive updates. - await condition(() => pendingUpdates.length > 0, "1 day"); + await condition(() => pendingUpdates.length > 0, '1 day'); while (pendingUpdates.length) { const update = pendingUpdates.shift(); @@ -901,14 +947,17 @@ Racing Signals Use `Promise.race` with Signals and Triggers to have a promise resolve at the earlier of either system time or human intervention. ```ts -import { defineSignal, sleep, Trigger } from "@temporalio/workflow"; +import { defineSignal, sleep, Trigger } from '@temporalio/workflow'; const userInteraction = new Trigger(); -const completeUserInteraction = defineSignal("completeUserInteraction"); +const completeUserInteraction = defineSignal('completeUserInteraction'); export async function yourWorkflow(userId: string) { setHandler(completeUserInteraction, () => userInteraction.resolve(true)); // programmatic resolve - const userInteracted = await Promise.race([userInteraction, sleep("30 days")]); + const userInteracted = await Promise.race([ + userInteraction, + sleep('30 days'), + ]); if (!userInteracted) { await sendReminderEmail(userId); } @@ -923,9 +972,12 @@ Be careful when racing a chained `sleep`. This might cause bugs because the chained `.then` will still continue to execute. ```js -await Promise.race([sleep("5s").then(() => (status = "timed_out")), somethingElse.then(() => (status = "processed"))]); +await Promise.race([ + sleep('5s').then(() => (status = 'timed_out')), + somethingElse.then(() => (status = 'processed')), +]); -if (status === "processed") await complete(); // takes more than 5 seconds +if (status === 'processed') await complete(); // takes more than 5 seconds // status = timed_out ``` @@ -941,21 +993,21 @@ Updatable Timer Here is how you can build an updatable Timer with `condition`: ```ts -import * as wf from "@temporalio/workflow"; +import * as wf from '@temporalio/workflow'; // usage export async function countdownWorkflow(): Promise { const target = Date.now() + 24 * 60 * 60 * 1000; // 1 day!!! const timer = new UpdatableTimer(target); - console.log("timer set for: " + new Date(target).toString()); + console.log('timer set for: ' + new Date(target).toString()); wf.setHandler(setDeadlineSignal, (deadline) => { // send in new deadlines via Signal timer.deadline = deadline; - console.log("timer now set for: " + new Date(deadline).toString()); + console.log('timer now set for: ' + new Date(deadline).toString()); }); wf.setHandler(timeLeftQuery, () => timer.deadline - Date.now()); await timer; // if you send in a signal with a new time, this timer will resolve earlier! - console.log("countdown done!"); + console.log('countdown done!'); } ``` @@ -975,7 +1027,12 @@ export class UpdatableTimer implements PromiseLike { /* eslint-disable no-constant-condition */ while (true) { this.deadlineUpdated = false; - if (!(await wf.condition(() => this.deadlineUpdated, this.#deadline - Date.now()))) { + if ( + !(await wf.condition( + () => this.deadlineUpdated, + this.#deadline - Date.now() + )) + ) { break; } } @@ -1012,7 +1069,7 @@ You can set each Workflow to repeat on a schedule with the `cronSchedule` option ```typescript const handle = await client.workflow.start(scheduledWorkflow, { // ... - cronSchedule: "* * * * *", // start every minute + cronSchedule: '* * * * *', // start every minute }); ``` @@ -1117,7 +1174,9 @@ The sample project [samples-typescript/ejson](https://github.com/temporalio/samp It implements `PayloadConverterWithEncoding` instead of `PayloadConverter` so that it could be used with [CompositePayloadConverter](https://typescript.temporal.io/api/classes/common.CompositePayloadConverter/): + [ejson/src/ejson-payload-converter.ts](https://github.com/temporalio/samples-typescript/blob/main/ejson/src/ejson-payload-converter.ts) + ```ts import { EncodingType, @@ -1168,19 +1227,28 @@ export class EjsonPayloadConverter implements PayloadConverterWithEncoding { export class UnsupportedEjsonTypeError extends PayloadConverterError { public readonly name: string = 'UnsupportedJsonTypeError'; - constructor(message: string | undefined, public readonly cause?: Error) { + constructor( + message: string | undefined, + public readonly cause?: Error + ) { super(message ?? undefined); } } ``` + Then we instantiate one and export it: + [ejson/src/payload-converter.ts](https://github.com/temporalio/samples-typescript/blob/main/ejson/src/payload-converter.ts) + ```ts -import { CompositePayloadConverter, UndefinedPayloadConverter } from '@temporalio/common'; +import { + CompositePayloadConverter, + UndefinedPayloadConverter, +} from '@temporalio/common'; import { EjsonPayloadConverter } from './ejson-payload-converter'; export const payloadConverter = new CompositePayloadConverter( @@ -1188,56 +1256,72 @@ export const payloadConverter = new CompositePayloadConverter( new EjsonPayloadConverter() ); ``` + We provide it to the Worker and Client: + [ejson/src/worker.ts](https://github.com/temporalio/samples-typescript/blob/main/ejson/src/worker.ts) + ```ts - const worker = await Worker.create({ - workflowsPath: require.resolve('./workflows'), - taskQueue: 'ejson', - dataConverter: { payloadConverterPath: require.resolve('./payload-converter') }, - }); +const worker = await Worker.create({ + workflowsPath: require.resolve('./workflows'), + taskQueue: 'ejson', + dataConverter: { + payloadConverterPath: require.resolve('./payload-converter'), + }, +}); ``` + + [ejson/src/client.ts](https://github.com/temporalio/samples-typescript/blob/main/ejson/src/client.ts) + ```ts - const client = new Client({ - dataConverter: { payloadConverterPath: require.resolve('./payload-converter') }, - }); +const client = new Client({ + dataConverter: { + payloadConverterPath: require.resolve('./payload-converter'), + }, +}); ``` + Then we can use supported data types in arguments: + [ejson/src/client.ts](https://github.com/temporalio/samples-typescript/blob/main/ejson/src/client.ts) -```ts - const user: User = { - id: uuid(), - // age: 1000n, BigInt isn't supported - hp: Infinity, - matcher: /.*Stormblessed/, - token: Uint8Array.from([1, 2, 3]), - createdAt: new Date(), - }; - const handle = await client.workflow.start(example, { - args: [user], - taskQueue: 'ejson', - workflowId: `example-user-${user.id}`, - }); +```ts +const user: User = { + id: uuid(), + // age: 1000n, BigInt isn't supported + hp: Infinity, + matcher: /.*Stormblessed/, + token: Uint8Array.from([1, 2, 3]), + createdAt: new Date(), +}; + +const handle = await client.workflow.start(example, { + args: [user], + taskQueue: 'ejson', + workflowId: `example-user-${user.id}`, +}); ``` + And they get parsed correctly for the Workflow: + [ejson/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/ejson/src/workflows.ts) + ```ts import type { Result, User } from './types'; @@ -1250,6 +1334,7 @@ export async function example(user: User): Promise { return { success, at: new Date() }; } ``` + #### Protobufs @@ -1267,12 +1352,15 @@ To serialize values as [Protocol Buffers](https://protobuf.dev/) (protobufs): - Patch `json-module.js`: + [protobufs/protos/root.js](https://github.com/temporalio/samples-typescript/blob/main/protobufs/protos/root.js) + ```js const { patchProtobufRoot } = require('@temporalio/common/lib/protobufs'); const unpatchedRoot = require('./json-module'); module.exports = patchProtobufRoot(unpatchedRoot); ``` + - Generate `root.d.ts` with the following command: @@ -1284,21 +1372,26 @@ module.exports = patchProtobufRoot(unpatchedRoot); - Create a [`DefaultPayloadConverterWithProtobufs`](https://typescript.temporal.io/api/classes/protobufs.DefaultPayloadConverterWithProtobufs/): + [protobufs/src/payload-converter.ts](https://github.com/temporalio/samples-typescript/blob/main/protobufs/src/payload-converter.ts) + ```ts import { DefaultPayloadConverterWithProtobufs } from '@temporalio/common/lib/protobufs'; import root from '../protos/root'; -export const payloadConverter = new DefaultPayloadConverterWithProtobufs({ protobufRoot: root }); +export const payloadConverter = new DefaultPayloadConverterWithProtobufs({ + protobufRoot: root, +}); ``` + Alternatively, we can use Protobuf Payload Converters directly, or with other converters. If we know that we only use Protobuf objects, and we want them binary encoded (which saves space over proto3 JSON, but can't be viewed in the Web UI), we could do the following: ```ts -import { ProtobufBinaryPayloadConverter } from "@temporalio/common/lib/protobufs"; -import root from "../protos/root"; +import { ProtobufBinaryPayloadConverter } from '@temporalio/common/lib/protobufs'; +import root from '../protos/root'; export const payloadConverter = new ProtobufBinaryPayloadConverter(root); ``` @@ -1311,9 +1404,9 @@ import { CompositePayloadConverter, JsonPayloadConverter, UndefinedPayloadConverter, -} from "@temporalio/common"; -import { ProtobufBinaryPayloadConverter } from "@temporalio/common/lib/protobufs"; -import root from "../protos/root"; +} from '@temporalio/common'; +import { ProtobufBinaryPayloadConverter } from '@temporalio/common/lib/protobufs'; +import root from '../protos/root'; export const payloadConverter = new CompositePayloadConverter( new UndefinedPayloadConverter(), @@ -1326,15 +1419,20 @@ export const payloadConverter = new CompositePayloadConverter( - Provide it to the Worker: + [protobufs/src/worker.ts](https://github.com/temporalio/samples-typescript/blob/main/protobufs/src/worker.ts) + ```ts - const worker = await Worker.create({ - workflowsPath: require.resolve('./workflows'), - activities, - taskQueue: 'protobufs', - dataConverter: { payloadConverterPath: require.resolve('./payload-converter') }, - }); +const worker = await Worker.create({ + workflowsPath: require.resolve('./workflows'), + activities, + taskQueue: 'protobufs', + dataConverter: { + payloadConverterPath: require.resolve('./payload-converter'), + }, +}); ``` + [WorkerOptions.dataConverter](https://typescript.temporal.io/api/interfaces/worker.WorkerOptions#dataconverter) @@ -1342,7 +1440,9 @@ export const payloadConverter = new CompositePayloadConverter( - Provide it to the Client: + [protobufs/src/client.ts](https://github.com/temporalio/samples-typescript/blob/main/protobufs/src/client.ts) + ```ts import { Client } from '@temporalio/client'; import { v4 as uuid } from 'uuid'; @@ -1351,7 +1451,9 @@ import { example } from './workflows'; async function run() { const client = new Client({ - dataConverter: { payloadConverterPath: require.resolve('./payload-converter') }, + dataConverter: { + payloadConverterPath: require.resolve('./payload-converter'), + }, }); const handle = await client.workflow.start(example, { @@ -1368,12 +1470,15 @@ async function run() { console.log(result.toJSON()); } ``` + - Use protobufs in your Workflows and Activities: + [protobufs/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/protobufs/src/workflows.ts) + ```ts import { proxyActivities } from '@temporalio/workflow'; import { foo, ProtoResult } from '../protos/root'; @@ -1388,17 +1493,25 @@ export async function example(input: foo.bar.ProtoInput): Promise { return result; } ``` + + [protobufs/src/activities.ts](https://github.com/temporalio/samples-typescript/blob/main/protobufs/src/activities.ts) + ```ts import { foo, ProtoResult } from '../protos/root'; -export async function protoActivity(input: foo.bar.ProtoInput): Promise { - return ProtoResult.create({ sentence: `${input.name} is ${input.age} years old.` }); +export async function protoActivity( + input: foo.bar.ProtoInput +): Promise { + return ProtoResult.create({ + sentence: `${input.name} is ${input.age} years old.`, + }); } ``` + ### Payload Codec @@ -1429,10 +1542,17 @@ interface PayloadCodec { The following is an example class that implements the `PayloadCodec` interface: + [encryption/src/encryption-codec.ts](https://github.com/temporalio/samples-typescript/blob/main/encryption/src/encryption-codec.ts) + ```ts import { webcrypto as crypto } from 'node:crypto'; -import { METADATA_ENCODING_KEY, Payload, PayloadCodec, ValueError } from '@temporalio/common'; +import { + METADATA_ENCODING_KEY, + Payload, + PayloadCodec, + ValueError, +} from '@temporalio/common'; import { temporal } from '@temporalio/proto'; import { decode, encode } from '@temporalio/common/lib/encoding'; import { decrypt, encrypt } from './crypto'; @@ -1441,7 +1561,10 @@ const ENCODING = 'binary/encrypted'; const METADATA_ENCRYPTION_KEY_ID = 'encryption-key-id'; export class EncryptionCodec implements PayloadCodec { - constructor(protected readonly keys: Map, protected readonly defaultKeyId: string) {} + constructor( + protected readonly keys: Map, + protected readonly defaultKeyId: string + ) {} static async create(keyId: string): Promise { const keys = new Map(); @@ -1468,7 +1591,10 @@ export class EncryptionCodec implements PayloadCodec { async decode(payloads: Payload[]): Promise { return Promise.all( payloads.map(async (payload) => { - if (!payload.metadata || decode(payload.metadata[METADATA_ENCODING_KEY]) !== ENCODING) { + if ( + !payload.metadata || + decode(payload.metadata[METADATA_ENCODING_KEY]) !== ENCODING + ) { return payload; } if (!payload.data) { @@ -1477,7 +1603,9 @@ export class EncryptionCodec implements PayloadCodec { const keyIdBytes = payload.metadata[METADATA_ENCRYPTION_KEY_ID]; if (!keyIdBytes) { - throw new ValueError('Unable to decrypt Payload without encryption key id'); + throw new ValueError( + 'Unable to decrypt Payload without encryption key id' + ); } const keyId = decode(keyIdBytes); @@ -1511,6 +1639,7 @@ async function fetchKey(_keyId: string): Promise { return cryptoKey; } ``` + The encryption and decryption code is in [src/crypto.ts](https://github.com/temporalio/samples-typescript/tree/main/encryption/src/crypto.ts). @@ -1519,32 +1648,38 @@ Because encryption is CPU intensive, and doing AES with the crypto module built As before, we provide a custom Data Converter to the Client and Worker: + [encryption/src/client.ts](https://github.com/temporalio/samples-typescript/blob/main/encryption/src/client.ts) + ```ts - const client = new Client({ - dataConverter: await getDataConverter(), - }); +const client = new Client({ + dataConverter: await getDataConverter(), +}); - const handle = await client.workflow.start(example, { - args: ['Alice: Private message for Bob.'], - taskQueue: 'encryption', - workflowId: `my-business-id-${uuid()}`, - }); +const handle = await client.workflow.start(example, { + args: ['Alice: Private message for Bob.'], + taskQueue: 'encryption', + workflowId: `my-business-id-${uuid()}`, +}); - console.log(`Started workflow ${handle.workflowId}`); - console.log(await handle.result()); +console.log(`Started workflow ${handle.workflowId}`); +console.log(await handle.result()); ``` + + [encryption/src/worker.ts](https://github.com/temporalio/samples-typescript/blob/main/encryption/src/worker.ts) + ```ts - const worker = await Worker.create({ - workflowsPath: require.resolve('./workflows'), - taskQueue: 'encryption', - dataConverter: await getDataConverter(), - }); +const worker = await Worker.create({ + workflowsPath: require.resolve('./workflows'), + taskQueue: 'encryption', + dataConverter: await getDataConverter(), +}); ``` + When the Client sends `'Alice: Private message for Bob.'` to the Workflow, it gets encrypted on the Client and decrypted in the Worker. @@ -1552,12 +1687,15 @@ The Workflow receives the decrypted message and appends another message. When it returns that longer string, the string gets encrypted by the Worker and decrypted by the Client. + [encryption/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/encryption/src/workflows.ts) + ```ts export async function example(message: string): Promise { return `${message}\nBob: Hi Alice, I'm Workflow Bob.`; } ``` + ## How to implement interceptors in TypeScript {#interceptors} @@ -1589,20 +1727,26 @@ All interceptor methods are optional—it's up to the implementor to choose whic **Log start and completion of Activities** ```ts -import { ActivityInput, Next, WorkflowOutboundCallsInterceptor } from "@temporalio/workflow"; - -export class ActivityLogInterceptor implements WorkflowOutboundCallsInterceptor { +import { + ActivityInput, + Next, + WorkflowOutboundCallsInterceptor, +} from '@temporalio/workflow'; + +export class ActivityLogInterceptor + implements WorkflowOutboundCallsInterceptor +{ constructor(public readonly workflowType: string) {} async scheduleActivity( input: ActivityInput, - next: Next + next: Next ): Promise { - console.log("Starting activity", { activityType: input.activityType }); + console.log('Starting activity', { activityType: input.activityType }); try { return await next(input); } finally { - console.log("Completed activity", { + console.log('Completed activity', { workflow: this.workflowType, activityType: input.activityType, }); @@ -1614,7 +1758,12 @@ export class ActivityLogInterceptor implements WorkflowOutboundCallsInterceptor **Authorization** ```ts -import { defaultDataConverter, Next, WorkflowInboundCallsInterceptor, WorkflowInput } from "@temporalio/workflow"; +import { + defaultDataConverter, + Next, + WorkflowInboundCallsInterceptor, + WorkflowInput, +} from '@temporalio/workflow'; /** * WARNING: This demo is meant as a simple auth example. @@ -1622,13 +1771,20 @@ import { defaultDataConverter, Next, WorkflowInboundCallsInterceptor, WorkflowIn * Auth headers should be encrypted and credentials * stored outside of the codebase. */ -export class DumbWorkflowAuthInterceptor implements WorkflowInboundCallsInterceptor { - public async execute(input: WorkflowInput, next: Next): Promise { +export class DumbWorkflowAuthInterceptor + implements WorkflowInboundCallsInterceptor +{ + public async execute( + input: WorkflowInput, + next: Next + ): Promise { const authHeader = input.headers.auth; - const { user, password } = authHeader ? await defaultDataConverter.fromPayload(authHeader) : undefined; + const { user, password } = authHeader + ? await defaultDataConverter.fromPayload(authHeader) + : undefined; - if (!(user === "admin" && password === "admin")) { - throw new Error("Unauthorized"); + if (!(user === 'admin' && password === 'admin')) { + throw new Error('Unauthorized'); } return await next(input); } @@ -1657,7 +1813,7 @@ You may use call the [`workflowInfo()`](https://typescript.temporal.io/api/names `src/workflows/your-interceptors.ts` ```ts -import { workflowInfo } from "@temporalio/workflow"; +import { workflowInfo } from '@temporalio/workflow'; export const interceptors = () => ({ outbound: [new ActivityLogInterceptor(workflowInfo().workflowType)], @@ -1669,9 +1825,9 @@ export const interceptors = () => ({ ```ts const worker = await Worker.create({ - workflowsPath: require.resolve("./workflows"), + workflowsPath: require.resolve('./workflows'), interceptors: { - workflowModules: [require.resolve("./workflows/your-interceptors")], + workflowModules: [require.resolve('./workflows/your-interceptors')], }, }); ``` diff --git a/docs/dev-guide/tscript/foundations.mdx b/docs/dev-guide/tscript/foundations.mdx index eae7b1e911..aa1f615b74 100644 --- a/docs/dev-guide/tscript/foundations.mdx +++ b/docs/dev-guide/tscript/foundations.mdx @@ -78,8 +78,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Darwin amd64 - - Download for Darwin arm64 + - + Download for Darwin amd64 + + - + Download for Darwin arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -94,8 +98,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed. - - Download for Linux amd64 - - Download for Linux arm64 + - + Download for Linux amd64 + + - + Download for Linux arm64 + 2. Extract the downloaded archive. 3. Add the `temporal` binary to your PATH. @@ -104,8 +112,12 @@ Choose one of the following install methods to install the Temporal CLI. - Install the Temporal CLI from CDN. 1. Select the platform and architecture needed and download the binary. - - Download for Windows amd64 - - Download for Windows arm64 + - + Download for Windows amd64 + + - + Download for Windows arm64 + 2. Extract the downloaded archive. 3. Add the `temporal.exe` binary to your PATH. @@ -224,7 +236,7 @@ Creating a [Connection](https://typescript.temporal.io/api/classes/client.Connec If you omit the `Connection` and just create a `new Client()`, it will connect to `localhost:7233`. ```ts -import { Client } from "@temporalio/client"; +import { Client } from '@temporalio/client'; async function run() { const client = new Client(); @@ -258,20 +270,20 @@ For more information about configuring TLS to secure inter- and intra-network co Create a [`Connection`](https://typescript.temporal.io/api/classes/client.Connection) with a [`connectionOptions`](https://typescript.temporal.io/api/interfaces/client.ConnectionOptions) object that has your Cloud namespace and client certificate. ```ts -import { Client, Connection } from "@temporalio/client"; -import fs from "fs-extra"; +import { Client, Connection } from '@temporalio/client'; +import fs from 'fs-extra'; -const { NODE_ENV = "development" } = process.env; -const isDeployed = ["production", "staging"].includes(NODE_ENV); +const { NODE_ENV = 'development' } = process.env; +const isDeployed = ['production', 'staging'].includes(NODE_ENV); async function run() { - const cert = await fs.readFile("./path-to/your.pem"); - const key = await fs.readFile("./path-to/your.key"); + const cert = await fs.readFile('./path-to/your.pem'); + const key = await fs.readFile('./path-to/your.key'); let connectionOptions = {}; if (isDeployed) { connectionOptions = { - address: "your-namespace.tmprl.cloud:7233", + address: 'your-namespace.tmprl.cloud:7233', tls: { clientCertPair: { crt: cert, @@ -284,7 +296,7 @@ async function run() { const client = new Client({ connection, - namespace: "your-namespace", + namespace: 'your-namespace', }); // . . . @@ -313,7 +325,9 @@ type ExampleArgs = { name: string; }; -export async function example(args: ExampleArgs): Promise<{ greeting: string }> { +export async function example( + args: ExampleArgs +): Promise<{ greeting: string }> { const greeting = await greet(args.name); return { greeting }; } @@ -385,12 +399,15 @@ In TypeScript, the Workflow Type is the Workflow function name and there isn't a In the following example, the Workflow Type is the name of the function, `helloWorld`. + [snippets/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/snippets/src/workflows.ts) + ```ts export async function helloWorld(): Promise { return '👋 Hello World!'; } ``` + ### How develop Workflow logic {#workflow-logic-requirements} @@ -424,7 +441,7 @@ To make the Workflow runtime deterministic, functions like `Math.random()`, `Dat ```typescript -import { sleep } from "@temporalio/workflow"; +import { sleep } from '@temporalio/workflow'; // this prints the *exact* same timestamp repeatedly for (let x = 0; x < 10; ++x) { @@ -433,7 +450,7 @@ for (let x = 0; x < 10; ++x) { // this prints timestamps increasing roughly 1s each iteration for (let x = 0; x < 10; ++x) { - await sleep("1 second"); + await sleep('1 second'); console.log(Date.now()); } ``` @@ -454,12 +471,15 @@ For the Workflow to be able to execute the Activity, we must define the [Activit Activities are _just functions_. The following is an Activity that accepts a string parameter and returns a string. + [snippets/src/activities.ts](https://github.com/temporalio/samples-typescript/blob/main/snippets/src/activities.ts) + ```ts export async function greet(name: string): Promise { return `👋 Hello, ${name}!`; } ``` + ### How to develop Activity Parameters {#activity-parameters} @@ -482,12 +502,15 @@ This is so that you can change what data is passed to the Activity without break This Activity takes a single `name` parameter of type `string`. + [snippets/src/activities.ts](https://github.com/temporalio/samples-typescript/blob/main/snippets/src/activities.ts) + ```ts export async function greet(name: string): Promise { return `👋 Hello, ${name}!`; } ``` + ### How to define Activity return values {#activity-return-values} @@ -515,7 +538,9 @@ You can customize the name of the Activity when you register it with the Worker. In the following example, the Activity Name is `activityFoo`. + [snippets/src/worker-activity-type-custom.ts](https://github.com/temporalio/samples-typescript/blob/main/snippets/src/worker-activity-type-custom.ts) + ```ts import { Worker } from '@temporalio/worker'; import { greet } from './activities'; @@ -532,6 +557,7 @@ async function run() { await worker.run(); } ``` + ### Important design patterns for Activities {#activity-design-patterns} @@ -548,7 +574,9 @@ This is a helpful pattern for using closures to do the following: - Inject secret keys (such as environment variables) from the Worker to the Activity. + [activities-dependency-injection/src/activities.ts](https://github.com/temporalio/samples-typescript/blob/main/activities-dependency-injection/src/activities.ts) + ```ts export interface DB { get(key: string): Promise; @@ -565,6 +593,7 @@ export const createActivities = (db: DB) => ({ }, }); ``` +
@@ -573,6 +602,7 @@ export const createActivities = (db: DB) => ({ When you register these in the Worker, pass your shared dependencies accordingly: + ```ts import { createActivities } from './activities'; @@ -598,20 +628,26 @@ run().catch((err) => { process.exit(1); }); ``` + Because Activities are always referenced by name, inside the Workflow they can be proxied as normal, although the types need some adjustment: + [activities-dependency-injection/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/activities-dependency-injection/src/workflows.ts) + ```ts import type { createActivities } from './activities'; // Note usage of ReturnType<> generic since createActivities is a factory function -const { greet, greet_es } = proxyActivities>({ +const { greet, greet_es } = proxyActivities< + ReturnType +>({ startToCloseTimeout: '30 seconds', }); ``` +
@@ -640,7 +676,7 @@ export async function DynamicWorkflow(activityName, ...args) { // these are equivalent await acts.activity1(); - await acts["activity1"](); + await acts['activity1'](); // dynamic reference to activities using activityName let result = await acts[activityName](...args); @@ -673,12 +709,12 @@ Otherwise, no additional limitations exist on Activity implementations. To spawn an Activity Execution, you must retrieve the _Activity handle_ in your Workflow. ```typescript -import { proxyActivities } from "@temporalio/workflow"; +import { proxyActivities } from '@temporalio/workflow'; // Only import the activity types -import type * as activities from "./activities"; +import type * as activities from './activities'; const { greet } = proxyActivities({ - startToCloseTimeout: "1 minute", + startToCloseTimeout: '1 minute', }); // A workflow that calls an activity @@ -708,7 +744,7 @@ export async function DynamicWorkflow(activityName, ...args) { // these are equivalent await acts.activity1(); - await acts["activity1"](); + await acts['activity1'](); let result = await acts[activityName](...args); return result; @@ -870,7 +906,9 @@ However, the failure of the Task does not cause the associated Workflow Executio In development, use [`workflowsPath`](https://typescript.temporal.io/api/interfaces/worker.WorkerOptions/#workflowspath): + [snippets/src/worker.ts](https://github.com/temporalio/samples-typescript/blob/main/snippets/src/worker.ts) + ```ts import { Worker } from '@temporalio/worker'; import * as activities from './activities'; @@ -885,6 +923,7 @@ async function run() { await worker.run(); } ``` + In this snippet, the Worker bundles the Workflow code at runtime. @@ -892,7 +931,9 @@ In this snippet, the Worker bundles the Workflow code at runtime. In production, you can improve your Worker's startup time by bundling in advance: as part of your production build, call `bundleWorkflowCode`: + [production/src/scripts/build-workflow-bundle.ts](https://github.com/temporalio/samples-typescript/blob/main/production/src/scripts/build-workflow-bundle.ts) + ```ts import { bundleWorkflowCode } from '@temporalio/worker'; import { writeFile } from 'fs/promises'; @@ -908,12 +949,15 @@ async function bundle() { console.log(`Bundle written to ${codePath}`); } ``` + Then the bundle can be passed to the Worker: + [production/src/worker.ts](https://github.com/temporalio/samples-typescript/blob/main/production/src/worker.ts) + ```ts const workflowOption = () => process.env.NODE_ENV === 'production' @@ -934,6 +978,7 @@ async function run() { await worker.run(); } ``` + ## How to shut down a Worker and track its state {#shut-down-a-worker} @@ -982,9 +1027,9 @@ When you have a Client, you can schedule the start of a Workflow with `client.wo ```typescript const handle = await client.workflow.start(example, { - workflowId: "your-workflow-id", - taskQueue: "your-task-queue", - args: ["argument01", "argument02", "argument03"], // this is typechecked against workflowFn's args + workflowId: 'your-workflow-id', + taskQueue: 'your-task-queue', + args: ['argument01', 'argument02', 'argument03'], // this is typechecked against workflowFn's args }); const handle = client.getHandle(workflowId); const result = await handle.result(); @@ -1020,16 +1065,16 @@ The Worker need three main things: - If you prefer to handle the bundling yourself, pass a prebuilt bundle to `workflowBundle`. ```ts -import { Worker } from "@temporalio/worker"; -import * as activities from "./activities"; +import { Worker } from '@temporalio/worker'; +import * as activities from './activities'; async function run() { // Step 1: Register Workflows and Activities with the Worker and connect to // the Temporal server. const worker = await Worker.create({ - workflowsPath: require.resolve("./workflows"), + workflowsPath: require.resolve('./workflows'), activities, - taskQueue: "hello-world", + taskQueue: 'hello-world', }); // Worker connects to localhost by default and uses console.error for logging. // Customize the Worker by passing more options to create(): @@ -1052,15 +1097,15 @@ run().catch((err) => { When scheduling a Workflow, you must specify `taskQueue`. ```ts -import { Client, Connection } from "@temporalio/client"; +import { Client, Connection } from '@temporalio/client'; // This is the code that is used to start a Workflow. const connection = await Connection.create(); const client = new Client({ connection }); const result = await client.workflow.execute(yourWorkflow, { // required - taskQueue: "your-task-queue", + taskQueue: 'your-task-queue', // required - workflowId: "your-workflow-id", + workflowId: 'your-workflow-id', }); ``` @@ -1070,7 +1115,7 @@ When creating a Worker, you must pass the `taskQueue` option to the `Worker.crea const worker = await Worker.create({ // imported elsewhere activities, - taskQueue: "your-task-queue", + taskQueue: 'your-task-queue', }); ``` @@ -1085,9 +1130,9 @@ Connect to a Client with `client.workflow.start()` and any arguments. Then speci ```typescript const handle = await client.workflow.start(example, { - workflowId: "yourWorkflowId", - taskQueue: "yourTaskQueue", - args: ["your", "arg", "uments"], + workflowId: 'yourWorkflowId', + taskQueue: 'yourTaskQueue', + args: ['your', 'arg', 'uments'], }); ``` @@ -1106,7 +1151,12 @@ In the Temporal Platform, it's also acceptable to use Queries as the preferred m To return the results of a Workflow Execution: ```typescript -return "Completed " + wf.workflowInfo().workflowId + ", Total Charged: " + totalCharged; +return ( + 'Completed ' + + wf.workflowInfo().workflowId + + ', Total Charged: ' + + totalCharged +); ``` `totalCharged` is just a function declared in your code. For a full example, see [subscription-workflow-project-template-typescript/src/workflows.ts](https://github.com/temporalio/subscription-workflow-project-template-typescript/blob/main/src/workflows.ts). @@ -1132,11 +1182,11 @@ try { const result = await handle.result(); } catch (err) { if (err instanceof WorkflowFailedError) { - throw new Error("Temporal workflow failed: " + workflowId, { + throw new Error('Temporal workflow failed: ' + workflowId, { cause: err, }); } else { - throw new Error("error from Temporal workflow " + workflowId, { + throw new Error('error from Temporal workflow ' + workflowId, { cause: err, }); } @@ -1187,9 +1237,15 @@ To simplify checking for cancellation, use the [isCancellation(err)](https://typ ### Internal cancellation example + [packages/test/src/workflows/cancel-timer-immediately.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/cancel-timer-immediately.ts) + ```ts -import { CancelledFailure, CancellationScope, sleep } from '@temporalio/workflow'; +import { + CancelledFailure, + CancellationScope, + sleep, +} from '@temporalio/workflow'; export async function cancelTimer(): Promise { // Timers and Activities are automatically cancelled when their containing scope is cancelled. @@ -1208,14 +1264,21 @@ export async function cancelTimer(): Promise { } } ``` + Alternatively, the preceding can be written as the following. + [packages/test/src/workflows/cancel-timer-immediately-alternative-impl.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/cancel-timer-immediately-alternative-impl.ts) + ```ts -import { CancelledFailure, CancellationScope, sleep } from '@temporalio/workflow'; +import { + CancelledFailure, + CancellationScope, + sleep, +} from '@temporalio/workflow'; export async function cancelTimerAltImpl(): Promise { try { @@ -1232,6 +1295,7 @@ export async function cancelTimerAltImpl(): Promise { } } ``` + ### External cancellation example @@ -1241,16 +1305,25 @@ The following code shows how to handle Workflow cancellation by an external clie + [packages/test/src/workflows/handle-external-workflow-cancellation-while-activity-running.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/handle-external-workflow-cancellation-while-activity-running.ts) + ```ts -import { CancellationScope, proxyActivities, isCancellation } from '@temporalio/workflow'; +import { + CancellationScope, + proxyActivities, + isCancellation, +} from '@temporalio/workflow'; import type * as activities from '../activities'; const { httpPostJSON, cleanup } = proxyActivities({ startToCloseTimeout: '10m', }); -export async function handleExternalWorkflowCancellationWhileActivityRunning(url: string, data: any): Promise { +export async function handleExternalWorkflowCancellationWhileActivityRunning( + url: string, + data: any +): Promise { try { await httpPostJSON(url, data); } catch (err) { @@ -1265,6 +1338,7 @@ export async function handleExternalWorkflowCancellationWhileActivityRunning(url } } ``` + ### nonCancellable example @@ -1272,12 +1346,16 @@ export async function handleExternalWorkflowCancellationWhileActivityRunning(url `CancellationScope.nonCancellable` prevents cancellation from propagating to children. + [packages/test/src/workflows/non-cancellable-shields-children.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/non-cancellable-shields-children.ts) + ```ts import { CancellationScope, proxyActivities } from '@temporalio/workflow'; import type * as activities from '../activities'; -const { httpGetJSON } = proxyActivities({ startToCloseTimeout: '10m' }); +const { httpGetJSON } = proxyActivities({ + startToCloseTimeout: '10m', +}); export async function nonCancellable(url: string): Promise { // Prevent Activity from being cancelled and await completion. @@ -1285,6 +1363,7 @@ export async function nonCancellable(url: string): Promise { return CancellationScope.nonCancellable(() => httpGetJSON(url)); } ``` + ### withTimeout example @@ -1293,21 +1372,29 @@ A common operation is to cancel one or more Activities if a deadline elapses. `withTimeout` creates a `CancellationScope` that is automatically cancelled after a timeout. + [packages/test/src/workflows/multiple-activities-single-timeout.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/multiple-activities-single-timeout.ts) + ```ts import { CancellationScope, proxyActivities } from '@temporalio/workflow'; import type * as activities from '../activities'; -export function multipleActivitiesSingleTimeout(urls: string[], timeoutMs: number): Promise { +export function multipleActivitiesSingleTimeout( + urls: string[], + timeoutMs: number +): Promise { const { httpGetJSON } = proxyActivities({ startToCloseTimeout: timeoutMs, }); // If timeout triggers before all activities complete // the Workflow will fail with a CancelledError. - return CancellationScope.withTimeout(timeoutMs, () => Promise.all(urls.map((url) => httpGetJSON(url)))); + return CancellationScope.withTimeout(timeoutMs, () => + Promise.all(urls.map((url) => httpGetJSON(url))) + ); } ``` + ### scope.cancelRequested @@ -1315,9 +1402,15 @@ export function multipleActivitiesSingleTimeout(urls: string[], timeoutMs: numbe You can await `cancelRequested` to make a Workflow aware of cancellation while waiting on `nonCancellable` scopes. + [packages/test/src/workflows/cancel-requested-with-non-cancellable.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/cancel-requested-with-non-cancellable.ts) + ```ts -import { CancellationScope, CancelledFailure, proxyActivities } from '@temporalio/workflow'; +import { + CancellationScope, + CancelledFailure, + proxyActivities, +} from '@temporalio/workflow'; import type * as activities from '../activities'; const { httpGetJSON } = proxyActivities({ @@ -1340,6 +1433,7 @@ export async function resumeAfterCancellation(url: string): Promise { return result; } ``` + ### Cancellation scopes and callbacks @@ -1348,7 +1442,9 @@ Callbacks are not particularly useful in Workflows because all meaningful asynch In the rare case that code uses callbacks and needs to handle cancellation, a callback can consume the `CancellationScope.cancelRequested` promise. + [packages/test/src/workflows/cancellation-scopes-with-callbacks.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/cancellation-scopes-with-callbacks.ts) + ```ts import { CancellationScope } from '@temporalio/workflow'; @@ -1363,6 +1459,7 @@ export async function cancellationScopesWithCallbacks(): Promise { }); } ``` + ### Nesting cancellation scopes @@ -1370,9 +1467,15 @@ export async function cancellationScopesWithCallbacks(): Promise { You can achieve complex flows by nesting cancellation scopes. + [packages/test/src/workflows/nested-cancellation.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/nested-cancellation.ts) + ```ts -import { CancellationScope, proxyActivities, isCancellation } from '@temporalio/workflow'; +import { + CancellationScope, + proxyActivities, + isCancellation, +} from '@temporalio/workflow'; import type * as activities from '../activities'; @@ -1384,7 +1487,9 @@ export async function nestedCancellation(url: string): Promise { await CancellationScope.cancellable(async () => { await CancellationScope.nonCancellable(() => setup()); try { - await CancellationScope.withTimeout(1000, () => httpPostJSON(url, { some: 'data' })); + await CancellationScope.withTimeout(1000, () => + httpPostJSON(url, { some: 'data' }) + ); } catch (err) { if (isCancellation(err)) { await CancellationScope.nonCancellable(() => cleanup(url)); @@ -1394,6 +1499,7 @@ export async function nestedCancellation(url: string): Promise { }); } ``` + ### Sharing promises between scopes @@ -1402,12 +1508,16 @@ Operations like Timers and Activities are cancelled by the cancellation scope th Promises returned by these operations can be awaited in different scopes. + [packages/test/src/workflows/shared-promise-scopes.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/shared-promise-scopes.ts) + ```ts import { CancellationScope, proxyActivities } from '@temporalio/workflow'; import type * as activities from '../activities'; -const { httpGetJSON } = proxyActivities({ startToCloseTimeout: '10m' }); +const { httpGetJSON } = proxyActivities({ + startToCloseTimeout: '10m', +}); export async function sharedScopes(): Promise { // Start activities in the root scope @@ -1426,15 +1536,20 @@ export async function sharedScopes(): Promise { // await Promise.all([p1, p2]); } ``` + + [packages/test/src/workflows/shield-awaited-in-root-scope.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/shield-awaited-in-root-scope.ts) + ```ts import { CancellationScope, proxyActivities } from '@temporalio/workflow'; import type * as activities from '../activities'; -const { httpGetJSON } = proxyActivities({ startToCloseTimeout: '10m' }); +const { httpGetJSON } = proxyActivities({ + startToCloseTimeout: '10m', +}); export async function shieldAwaitedInRootScope(): Promise { let p: Promise | undefined = undefined; @@ -1446,4 +1561,5 @@ export async function shieldAwaitedInRootScope(): Promise { return p; } ``` + diff --git a/docs/dev-guide/tscript/index.mdx b/docs/dev-guide/tscript/index.mdx index c3d95cfd4d..7725000103 100644 --- a/docs/dev-guide/tscript/index.mdx +++ b/docs/dev-guide/tscript/index.mdx @@ -7,14 +7,13 @@ description: Learn how to use the Temporal TypeScript SDK. slug: /dev-guide/typescript toc_max_heading_level: 4 keywords: -- dev guide -- typescript + - dev guide + - typescript tags: -- dev-guide -- typescript + - dev-guide + - typescript --- - This guide is meant to provide a comprehensive overview of the structures, primitives, and features used in [Temporal Application](/temporal#temporal-application) development. ## Project-setup @@ -110,4 +109,3 @@ The Versioning section of the Temporal TypeScript SDK developer's guide explains - [How to patch Workflow code in TypeScript](/dev-guide/typescript/versioning#patching): The TypeScript SDK Patching API lets you change Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. - [How to use Worker Versioning in TypeScript](/dev-guide/typescript/versioning#worker-versioning): Version your TypeScript Workers by using build ID-based versioning - diff --git a/docs/dev-guide/tscript/introduction.mdx b/docs/dev-guide/tscript/introduction.mdx index 298e11c87c..237b175406 100644 --- a/docs/dev-guide/tscript/introduction.mdx +++ b/docs/dev-guide/tscript/introduction.mdx @@ -7,12 +7,11 @@ description: Learn more about the Temporal TypeScript SDK. slug: /dev-guide/typescript/introduction toc_max_heading_level: 4 keywords: -- guide-context + - guide-context tags: -- guide-context + - guide-context --- - Welcome to the Temporal TypeScript SDK developer's guide! :::info Temporal TypeScript SDK API reference @@ -102,4 +101,3 @@ Further resources for learning how to use the SDK include the following: The Temporal TypeScript SDK is MIT licensed, and contributions are welcome. Please review our [contribution guidelines](https://github.com/temporalio/sdk-typescript/blob/main/CONTRIBUTING.md). - diff --git a/docs/dev-guide/tscript/observability.mdx b/docs/dev-guide/tscript/observability.mdx index a6bc87cbb8..203fe52e8d 100644 --- a/docs/dev-guide/tscript/observability.mdx +++ b/docs/dev-guide/tscript/observability.mdx @@ -7,20 +7,19 @@ description: Improve observability in your TypeScript-based Temporal Workflows. slug: /dev-guide/typescript/observability toc_max_heading_level: 3 keywords: -- client -- developer-guide -- guide-context -- sdk -- typescript + - client + - developer-guide + - guide-context + - sdk + - typescript tags: -- client -- developer-guide -- guide-context -- sdk -- typescript + - client + - developer-guide + - guide-context + - sdk + - typescript --- - The observability section of the Temporal Developer's guide covers the many ways to view the current state of your [Temporal Application](/temporal#temporal-application)—that is, ways to view which [Workflow Executions](/workflows#workflow-execution) are tracked by the [Temporal Platform](/temporal#temporal-platform) and the state of any specified Workflow Execution, either currently or at points of an execution. This section covers features related to viewing the state of the application, including: @@ -102,7 +101,7 @@ To extend the default ([Trace Context](https://github.com/open-telemetry/opentel new W3CBaggagePropagator(), new JaegerPropagator(), ], - }), + }) ); ``` @@ -280,7 +279,9 @@ However, they differ from Activities in important ways: Explicitly declaring a sink's interface is optional but is useful for ensuring type safety in subsequent steps: + [packages/test/src/workflows/log-sink-tester.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/log-sink-tester.ts) + ```ts import type { Sinks } from '@temporalio/workflow'; @@ -290,6 +291,7 @@ export interface CustomLoggerSinks extends Sinks { }; } ``` + #### Implement sinks @@ -299,7 +301,9 @@ Implementing sinks is a two-step process. Implement and inject the Sink function into a Worker + [sinks/src/worker.ts](https://github.com/temporalio/samples-typescript/blob/main/sinks/src/worker.ts) + ```ts import { InjectedSinks, Worker } from '@temporalio/worker'; import { MySinks } from './workflows'; @@ -333,6 +337,7 @@ main().catch((err) => { process.exit(1); }); ``` + - Sink function implementations are passed as an object into [WorkerOptions](https://typescript.temporal.io/api/interfaces/worker.WorkerOptions/#sinks). @@ -341,7 +346,9 @@ main().catch((err) => { #### Proxy and call a sink function from a Workflow + [packages/test/src/workflows/log-sample.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/log-sample.ts) + ```ts import * as wf from '@temporalio/workflow'; @@ -349,6 +356,7 @@ export async function logSampleWorkflow(): Promise { wf.log.info('Workflow execution started'); } ``` + Some important features of the [InjectedSinkFunction](https://typescript.temporal.io/api/interfaces/worker.InjectedSinkFunction) interface: @@ -466,24 +474,27 @@ After you've created custom Search Attributes in your Cluster (using `temporal o Use [`WorkflowOptions.searchAttributes`](https://typescript.temporal.io/api/interfaces/client.WorkflowOptions#searchattributes). + [search-attributes/src/client.ts](https://github.com/temporalio/samples-typescript/blob/main/search-attributes/src/client.ts) + ```ts - const handle = await client.workflow.start(example, { - taskQueue: 'search-attributes', - workflowId: 'search-attributes-example-0', - searchAttributes: { - CustomIntField: [2], - CustomKeywordField: ['keywordA', 'keywordB'], - CustomBoolField: [true], - CustomDatetimeField: [new Date()], - CustomStringField: [ - 'String field is for text. When queried, it will be tokenized for partial match. StringTypeField cannot be used in Order By', - ], - }, - }); +const handle = await client.workflow.start(example, { + taskQueue: 'search-attributes', + workflowId: 'search-attributes-example-0', + searchAttributes: { + CustomIntField: [2], + CustomKeywordField: ['keywordA', 'keywordB'], + CustomBoolField: [true], + CustomDatetimeField: [new Date()], + CustomStringField: [ + 'String field is for text. When queried, it will be tokenized for partial match. StringTypeField cannot be used in Order By', + ], + }, +}); - const { searchAttributes } = await handle.describe(); +const { searchAttributes } = await handle.describe(); ``` + The type of `searchAttributes` is `Record`. @@ -495,10 +506,13 @@ You can upsert Search Attributes to add or update Search Attributes from within Inside a Workflow, we can read from [`WorkflowInfo.searchAttributes`](https://typescript.temporal.io/api/interfaces/workflow.WorkflowInfo#searchattributes) and call [`upsertSearchAttributes`](https://typescript.temporal.io/api/namespaces/workflow#upsertsearchattributes): + [search-attributes/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/search-attributes/src/workflows.ts) + ```ts export async function example(): Promise { - const customInt = (workflowInfo().searchAttributes.CustomIntField?.[0] as number) || 0; + const customInt = + (workflowInfo().searchAttributes.CustomIntField?.[0] as number) || 0; upsertSearchAttributes({ // overwrite the existing CustomIntField: [2] CustomIntField: [customInt + 1], @@ -512,6 +526,7 @@ export async function example(): Promise { return workflowInfo().searchAttributes; } ``` + ### How to remove a Search Attribute from a Workflow {#remove-search-attribute} @@ -528,4 +543,3 @@ async function yourWorkflow() { upsertSearchAttributes({ CustomIntField: [] }); } ``` - diff --git a/docs/dev-guide/tscript/project-setup.mdx b/docs/dev-guide/tscript/project-setup.mdx index 704e71e7a6..379c6f1485 100644 --- a/docs/dev-guide/tscript/project-setup.mdx +++ b/docs/dev-guide/tscript/project-setup.mdx @@ -48,8 +48,8 @@ tags: - workflow --- -import Tabs from "@theme/Tabs"; -import TabItem from "@theme/TabItem"; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; The first step to creating a new Temporal Application is to set up your development environment. This chapter walks through the steps to do that using the TypeScript SDK. @@ -428,16 +428,16 @@ The `backgroundCheck` function that follows is an example of a basic Workflow De
View the source code - {" "} + {' '} in the context of the rest of the application code.
```typescript -import * as workflow from "@temporalio/workflow"; -import type * as activities from "./activities"; +import * as workflow from '@temporalio/workflow'; +import type * as activities from './activities'; const { ssnTrace } = workflow.proxyActivities({ - startToCloseTimeout: "10 seconds", + startToCloseTimeout: '10 seconds', }); export async function backgroundCheck(ssn: string): Promise { @@ -490,7 +490,7 @@ Add the following code to define your Activity:
View the source code - {" "} + {' '} in the context of the rest of the application code.
@@ -498,7 +498,7 @@ Add the following code to define your Activity: export async function ssnTrace(param: string): Promise { // This is where a call to another service is made // Here we are pretending that the service that does SSNTrace returned "pass" - return "pass"; + return 'pass'; } ``` @@ -526,13 +526,13 @@ Add the following code to `src/worker.ts` to define a worker process that commun
View the source code - {" "} + {' '} in the context of the rest of the application code.
```typescript -import { NativeConnection, Worker } from "@temporalio/worker"; -import * as activities from "./activities"; +import { NativeConnection, Worker } from '@temporalio/worker'; +import * as activities from './activities'; async function run() { // Step 1: Establish a connection with Temporal server. @@ -540,17 +540,17 @@ async function run() { // Worker code uses `@temporalio/worker.NativeConnection`. // (But in your application code it's `@temporalio/client.Connection`.) const connection = await NativeConnection.connect({ - address: "localhost:7233", + address: 'localhost:7233', // TLS and gRPC metadata configuration goes here. }); // Step 2: Register Workflows and Activities with the Worker and specify your // namespace and Task Queue. const worker = await Worker.create({ connection, - namespace: "default", - taskQueue: "background-check", + namespace: 'default', + taskQueue: 'background-check', // Workflows are registered using a path as they run in a separate JS context. - workflowsPath: require.resolve("./workflows"), + workflowsPath: require.resolve('./workflows'), activities, }); @@ -595,15 +595,15 @@ configuration provided via environment variables:
View the source code - {" "} + {' '} in the context of the rest of the application code.
```typescript -import fs from "fs/promises"; +import fs from 'fs/promises'; -import { Worker, NativeConnection } from "@temporalio/worker"; -import * as activities from "./activities"; +import { Worker, NativeConnection } from '@temporalio/worker'; +import * as activities from './activities'; // Note that serverNameOverride and serverRootCACertificate are optional. async function run({ @@ -635,11 +635,11 @@ async function run({ const worker = await Worker.create({ connection, namespace, - workflowsPath: require.resolve("./workflows"), + workflowsPath: require.resolve('./workflows'), activities, taskQueue, }); - console.log("Worker connection successfully established"); + console.log('Worker connection successfully established'); await worker.run(); await connection.close(); @@ -671,13 +671,13 @@ export interface Env { export function getEnv(): Env { return { - address: requiredEnv("TEMPORAL_ADDRESS"), - namespace: requiredEnv("TEMPORAL_NAMESPACE"), - clientCertPath: requiredEnv("TEMPORAL_CLIENT_CERT_PATH"), - clientKeyPath: requiredEnv("TEMPORAL_CLIENT_KEY_PATH"), + address: requiredEnv('TEMPORAL_ADDRESS'), + namespace: requiredEnv('TEMPORAL_NAMESPACE'), + clientCertPath: requiredEnv('TEMPORAL_CLIENT_CERT_PATH'), + clientKeyPath: requiredEnv('TEMPORAL_CLIENT_KEY_PATH'), serverNameOverride: process.env.TEMPORAL_SERVER_NAME_OVERRIDE, serverRootCACertificatePath: process.env.TEMPORAL_SERVER_ROOT_CA_CERT_PATH, - taskQueue: process.env.TEMPORAL_TASK_QUEUE || "hello-world-mtls", + taskQueue: process.env.TEMPORAL_TASK_QUEUE || 'hello-world-mtls', }; } ``` @@ -765,13 +765,13 @@ Add the following code to `src/worker.ts` to define a worker process that commun
View the source code - {" "} + {' '} in the context of the rest of the application code.
```typescript -import { NativeConnection, Worker } from "@temporalio/worker"; -import * as activities from "./activities"; +import { NativeConnection, Worker } from '@temporalio/worker'; +import * as activities from './activities'; async function run() { // Step 1: Establish a connection with Temporal server. @@ -779,17 +779,17 @@ async function run() { // Worker code uses `@temporalio/worker.NativeConnection`. // (But in your application code it's `@temporalio/client.Connection`.) const connection = await NativeConnection.connect({ - address: "172.18.0.4:7233", + address: '172.18.0.4:7233', // TLS and gRPC metadata configuration goes here. }); // Step 2: Register Workflows and Activities with the Worker and specify your // namespace and Task Queue. const worker = await Worker.create({ connection, - namespace: "backgroundcheck_namespace", - taskQueue: "hello-world", + namespace: 'backgroundcheck_namespace', + taskQueue: 'hello-world', // Workflows are registered using a path as they run in a separate JS context. - workflowsPath: require.resolve("./workflows"), + workflowsPath: require.resolve('./workflows'), activities, }); @@ -911,7 +911,11 @@ Use the Namespace dropdown to select the project Namespace you created earlier.

Web UI Namespace selection

- Web UI Namespace selection + Web UI Namespace selection
@@ -942,7 +946,11 @@ If there are none, the application won't run.

Confirm Workers polling Task Queue

- Confirm Workers polling Task Queue + Confirm Workers polling Task Queue
@@ -1019,7 +1027,11 @@ https://cloud.temporal.io/namespaces/./workflows

View Workflows in the Cloud UI

- View Workflows in the Cloud UI + View Workflows in the Cloud UI
@@ -1077,18 +1089,18 @@ Add the following code to `src/mocha/backgroundcheck.test.ts` to test that the W
View the source code - {" "} + {' '} in the context of the rest of the application code.
```typescript -import { TestWorkflowEnvironment } from "@temporalio/testing"; -import { before, describe, it } from "mocha"; -import { Worker } from "@temporalio/worker"; -import { backgroundCheck } from "../workflows"; -import assert from "assert"; +import { TestWorkflowEnvironment } from '@temporalio/testing'; +import { before, describe, it } from 'mocha'; +import { Worker } from '@temporalio/worker'; +import { backgroundCheck } from '../workflows'; +import assert from 'assert'; -describe("Background check workflow", () => { +describe('Background check workflow', () => { let testEnv: TestWorkflowEnvironment; before(async () => { @@ -1099,28 +1111,28 @@ describe("Background check workflow", () => { await testEnv?.teardown(); }); - it("successfully completes the Workflow", async () => { - const ssn = "111-22-3333"; + it('successfully completes the Workflow', async () => { + const ssn = '111-22-3333'; const { client, nativeConnection } = testEnv; - const taskQueue = "testing"; + const taskQueue = 'testing'; const worker = await Worker.create({ connection: nativeConnection, taskQueue, - workflowsPath: require.resolve("../workflows"), + workflowsPath: require.resolve('../workflows'), activities: { - ssnTrace: async () => "pass", + ssnTrace: async () => 'pass', }, }); const result = await worker.runUntil( client.workflow.execute(backgroundCheck, { args: [ssn], - workflowId: "background-check-test", + workflowId: 'background-check-test', taskQueue, }) ); - assert.equal(result, "pass"); + assert.equal(result, 'pass'); }); }); ``` @@ -1152,22 +1164,22 @@ Activity and ensure it returns the expected value:
View the source code - {" "} + {' '} in the context of the rest of the application code.
```typescript -import { MockActivityEnvironment } from "@temporalio/testing"; -import { describe, it } from "mocha"; -import * as activities from "../activities"; -import assert from "assert"; +import { MockActivityEnvironment } from '@temporalio/testing'; +import { describe, it } from 'mocha'; +import * as activities from '../activities'; +import assert from 'assert'; -describe("ssnTrace activity", async () => { - it("successfully passes the ssn trace", async () => { +describe('ssnTrace activity', async () => { + it('successfully passes the ssn trace', async () => { const env = new MockActivityEnvironment(); - const ssn = "111-22-3333"; + const ssn = '111-22-3333'; const result = await env.run(activities.ssnTrace, ssn); - assert.equal(result, "pass"); + assert.equal(result, 'pass'); }); }); ``` diff --git a/docs/dev-guide/tscript/testing.mdx b/docs/dev-guide/tscript/testing.mdx index 61c7d46d4f..72d7983aaa 100644 --- a/docs/dev-guide/tscript/testing.mdx +++ b/docs/dev-guide/tscript/testing.mdx @@ -18,7 +18,6 @@ tags: - typescript --- - The Testing section of the Temporal Application development guide describes the frameworks that facilitate Workflow and integration testing. In the context of Temporal, you can create these types of automated tests: @@ -168,11 +167,11 @@ When integration testing Workflows with a Worker, you can mock Activities by pro Implement only the relevant Activities for the Workflow being tested. ```ts -import type * as activities from "./activities"; +import type * as activities from './activities'; // Creating a mock object of the activities. const mockActivities: Partial = { - makeHTTPRequest: async () => "99", + makeHTTPRequest: async () => '99', }; // Creating a worker with the mocked activities. @@ -209,7 +208,7 @@ The `@temporalio/testing` package downloads the test server and exports [`TestWo A typical test suite should set up a single instance of the test environment to be reused in all tests (for example, in a [Jest](https://jestjs.io/) `beforeAll` hook or a [Mocha](https://mochajs.org/) `before()` hook). ```typescript -import { TestWorkflowEnvironment } from "@temporalio/testing"; +import { TestWorkflowEnvironment } from '@temporalio/testing'; let testEnv: TestWorkflowEnvironment; @@ -262,29 +261,29 @@ In "skipped" mode, timers (`sleep()` calls and `condition()` timeouts) are fast- `workflows.ts` ```ts -import { sleep } from "@temporalio/workflow"; +import { sleep } from '@temporalio/workflow'; export async function sleeperWorkflow() { - await sleep("1 day"); + await sleep('1 day'); } ``` `test.ts` ```ts -import { sleeperWorkflow } from "./workflows"; +import { sleeperWorkflow } from './workflows'; -test("sleep completes almost immediately", async () => { +test('sleep completes almost immediately', async () => { const worker = await Worker.create({ connection: testEnv.nativeConnection, - taskQueue: "test", - workflowsPath: require.resolve("./workflows"), + taskQueue: 'test', + workflowsPath: require.resolve('./workflows'), }); // Does not wait an entire day await worker.runUntil( testEnv.client.workflow.execute(sleeperWorkflow, { workflowId: uuid(), - taskQueue: "test", + taskQueue: 'test', }) ); }); @@ -301,10 +300,10 @@ However, to use `testEnv.sleep()`, you need to avoid automatic time skipping by `workflow.ts` ```ts -import { sleep } from "@temporalio/workflow"; -import { defineQuery, setHandler } from "@temporalio/workflow"; +import { sleep } from '@temporalio/workflow'; +import { defineQuery, setHandler } from '@temporalio/workflow'; -export const daysQuery = defineQuery("days"); +export const daysQuery = defineQuery('days'); export async function sleeperWorkflow() { let numDays = 0; @@ -312,7 +311,7 @@ export async function sleeperWorkflow() { setHandler(daysQuery, () => numDays); for (let i = 0; i < 100; i++) { - await sleep("1 day"); + await sleep('1 day'); numDays++; } } @@ -321,11 +320,11 @@ export async function sleeperWorkflow() { `test.ts` ```ts -test("sleeperWorkflow counts days correctly", async () => { +test('sleeperWorkflow counts days correctly', async () => { const worker = await Worker.create({ connection: testEnv.nativeConnection, - taskQueue: "test", - workflowsPath: require.resolve("./workflows"), + taskQueue: 'test', + workflowsPath: require.resolve('./workflows'), }); // `start()` starts the test server in "normal" mode, not skipped time mode. @@ -342,11 +341,11 @@ test("sleeperWorkflow counts days correctly", async () => { assert.equal(numDays, 0); // Advance the test server's time by 25 hours - await testEnv.sleep("25 hours"); + await testEnv.sleep('25 hours'); numDays = await handle.query(daysQuery); assert.equal(numDays, 1); - await testEnv.sleep("25 hours"); + await testEnv.sleep('25 hours'); numDays = await handle.query(daysQuery); assert.equal(numDays, 2); }); @@ -369,7 +368,9 @@ Workflow implementation + [timer-examples/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/timer-examples/src/workflows.ts) + ```ts export async function processOrderWorkflow({ orderProcessingMS, @@ -377,9 +378,11 @@ export async function processOrderWorkflow({ }: ProcessOrderOptions): Promise { let processing = true; // Dynamically define the timeout based on given input - const { processOrder } = proxyActivities>({ - startToCloseTimeout: orderProcessingMS, - }); + const { processOrder } = proxyActivities>( + { + startToCloseTimeout: orderProcessingMS, + } + ); const processOrderPromise = processOrder().then(() => { processing = false; @@ -396,44 +399,53 @@ export async function processOrderWorkflow({ return 'Order completed!'; } ``` + + [timer-examples/src/test/workflows.test.ts](https://github.com/temporalio/samples-typescript/blob/main/timer-examples/src/test/workflows.test.ts) + ```ts - it('sends reminder email if processOrder does not complete in time', async () => { - // This test doesn't actually take days to complete: the TestWorkflowEnvironment starts the - // Test Server, which automatically skips time when there are no running Activities. - let emailSent = false; - const mockActivities: ReturnType = { - async processOrder() { - // Test server switches to "normal" time while an Activity is executing. - // Call `env.sleep` to skip ahead 2 days, by which time sendNotificationEmail - // should have been called. - await env.sleep('2 days'); - }, - async sendNotificationEmail() { - emailSent = true; - }, - }; - const worker = await Worker.create({ - connection: env.nativeConnection, - taskQueue: 'test', - workflowsPath: require.resolve('../workflows'), - activities: mockActivities, - }); - await worker.runUntil( - env.client.workflow.execute(processOrderWorkflow, { - workflowId: uuid(), - taskQueue: 'test', - args: [{ orderProcessingMS: ms('3 days'), sendDelayedEmailTimeoutMS: ms('1 day') }], - }) - ); - assert.ok(emailSent); +it('sends reminder email if processOrder does not complete in time', async () => { + // This test doesn't actually take days to complete: the TestWorkflowEnvironment starts the + // Test Server, which automatically skips time when there are no running Activities. + let emailSent = false; + const mockActivities: ReturnType = { + async processOrder() { + // Test server switches to "normal" time while an Activity is executing. + // Call `env.sleep` to skip ahead 2 days, by which time sendNotificationEmail + // should have been called. + await env.sleep('2 days'); + }, + async sendNotificationEmail() { + emailSent = true; + }, + }; + const worker = await Worker.create({ + connection: env.nativeConnection, + taskQueue: 'test', + workflowsPath: require.resolve('../workflows'), + activities: mockActivities, }); + await worker.runUntil( + env.client.workflow.execute(processOrderWorkflow, { + workflowId: uuid(), + taskQueue: 'test', + args: [ + { + orderProcessingMS: ms('3 days'), + sendDelayedEmailTimeoutMS: ms('1 day'), + }, + ], + }) + ); + assert.ok(emailSent); +}); ``` + ### Test functions in Workflow context {#workflow-context} @@ -453,10 +465,10 @@ Then execute the function as if it were a Workflow: `workflows/file-with-workflow-function-to-test.ts` ```ts -import { sleep } from "@temporalio/workflow"; +import { sleep } from '@temporalio/workflow'; export async function functionToTest(): Promise { - await sleep("1 day"); + await sleep('1 day'); return 42; } ``` @@ -466,10 +478,14 @@ export async function functionToTest(): Promise { ```ts const worker = await Worker.create({ connection: testEnv.nativeConnection, - workflowsPath: require.resolve("./workflows/file-with-workflow-function-to-test"), + workflowsPath: require.resolve( + './workflows/file-with-workflow-function-to-test' + ), }); -const result = await worker.runUntil(testEnv.client.workflow.execute(functionToTest, workflowOptions)); +const result = await worker.runUntil( + testEnv.client.workflow.execute(functionToTest, workflowOptions) +); assert.equal(result, 42); ``` @@ -477,8 +493,8 @@ assert.equal(result, 42); If `functionToTest` starts a Child Workflow, that Workflow must be exported from the same file (so that the Worker knows about it): ```ts -import { sleep } from "@temporalio/workflow"; -import { someWorkflowToRunAsChild } from "./some-workflow"; +import { sleep } from '@temporalio/workflow'; +import { someWorkflowToRunAsChild } from './some-workflow'; export { someWorkflowToRunAsChild }; @@ -504,7 +520,7 @@ These interceptors catch an `AssertionError` and turn it into an `ApplicationFai `workflows/file-with-workflow-function-to-test.ts` ```ts -import assert from "assert"; +import assert from 'assert'; export async function functionToTest() { assert.ok(false); @@ -514,14 +530,19 @@ export async function functionToTest() { `test.ts` ```ts -import { TestWorkflowEnvironment, workflowInterceptorModules } from "@temporalio/testing"; +import { + TestWorkflowEnvironment, + workflowInterceptorModules, +} from '@temporalio/testing'; const worker = await Worker.create({ connection: testEnv.nativeConnection, interceptors: { workflowModules: workflowInterceptorModules, }, - workflowsPath: require.resolve("./workflows/file-with-workflow-function-to-test"), + workflowsPath: require.resolve( + './workflows/file-with-workflow-function-to-test' + ), }); await worker.runUntil( @@ -553,11 +574,11 @@ If replay fails for any other reason, [ReplayError](https://typescript.temporal. In the following example, a single Event History is loaded from a JSON file on disk (as obtained from the [Web UI](/web-ui) or the [Temporal CLI](/cli/workflow#show)): ```ts -const filePath = "./history_file.json"; -const history = await JSON.parse(fs.promises.readFile(filePath, "utf8")); +const filePath = './history_file.json'; +const history = await JSON.parse(fs.promises.readFile(filePath, 'utf8')); await Worker.runReplayHistory( { - workflowsPath: require.resolve("./your/workflows"), + workflowsPath: require.resolve('./your/workflows'), }, history ); @@ -567,12 +588,12 @@ Alternatively, we can download the Event History programmatically using a Client ```ts const connection = await Connection.connect({ address }); -const client = new Client({ connection, namespace: "your-namespace" }); -const handle = client.workflow.getHandle("your-workflow-id"); +const client = new Client({ connection, namespace: 'your-namespace' }); +const handle = client.workflow.getHandle('your-workflow-id'); const history = await handle.fetchHistory(); await Worker.runReplayHistory( { - workflowsPath: require.resolve("./your/workflows"), + workflowsPath: require.resolve('./your/workflows'), }, history ); @@ -591,13 +612,13 @@ const executions = client.workflow.list({ const histories = executions.intoHistories(); const results = Worker.runReplayHistories( { - workflowsPath: require.resolve("./your/workflows"), + workflowsPath: require.resolve('./your/workflows'), }, histories ); for await (const result of results) { if (result.error) { - console.error("Replay failed", result); + console.error('Replay failed', result); } } ``` diff --git a/docs/dev-guide/tscript/versioning.mdx b/docs/dev-guide/tscript/versioning.mdx index cebb87f76d..e661909e84 100644 --- a/docs/dev-guide/tscript/versioning.mdx +++ b/docs/dev-guide/tscript/versioning.mdx @@ -7,20 +7,19 @@ description: The Versioning section of the Temporal TypeScript SDK developer's g slug: /dev-guide/typescript/versioning toc_max_heading_level: 4 keywords: -- how-to -- patching -- typescript -- versioning -- workflow code + - how-to + - patching + - typescript + - versioning + - workflow code tags: -- how-to -- patching -- typescript -- versioning -- workflow-code + - how-to + - patching + - typescript + - versioning + - workflow-code --- - The Temporal Platform requires that Workflow code is [deterministic](/workflows#deterministic-constraints). Because of that requirement, the Temporal TypeScript SDK offers two dedicated versioning features. @@ -141,7 +140,9 @@ This is best explained in sequence (click through to follow along using our SDK Given an initial Workflow version `v1`: + [patching-api/src/workflows-v1.ts](https://github.com/temporalio/samples-typescript/blob/main/patching-api/src/workflows-v1.ts) + ```ts // v1 export async function myWorkflow(): Promise { @@ -150,13 +151,16 @@ export async function myWorkflow(): Promise { await activityThatMustRunAfterA(); } ``` + We decide to update our code and run `activityB` instead. This is our desired end state, `vFinal`. + [patching-api/src/workflows-vFinal.ts](https://github.com/temporalio/samples-typescript/blob/main/patching-api/src/workflows-vFinal.ts) + ```ts // vFinal export async function myWorkflow(): Promise { @@ -164,6 +168,7 @@ export async function myWorkflow(): Promise { await sleep('1 days'); } ``` + **Problem: We cannot directly deploy `vFinal` until we know for sure there are no more running Workflows created using `v1` code.** @@ -185,7 +190,9 @@ Patching is a three-step process: During replay, when a Worker picks up a history with that marker it will fail the Workflow task when running Workflow code that does not emit the same patch marker (in this case `your-change-id`); therefore it is safe to deploy code from `v2` in a "feature flag" alongside the original version (`v1`). + [patching-api/src/workflows-v2.ts](https://github.com/temporalio/samples-typescript/blob/main/patching-api/src/workflows-v2.ts) + ```ts // v2 import { patched } from '@temporalio/workflow'; @@ -200,6 +207,7 @@ export async function myWorkflow(): Promise { } } ``` + #### Step 2: Deprecate patch @@ -212,7 +220,9 @@ This marker does not fail replay when Workflow code does not emit it. If while we're deploying `v3` (below) there are still live Workers running `v2` code and those Workers pick up Workflow histories generated by `v3`, they will safely use the patched branch. + [patching-api/src/workflows-v3.ts](https://github.com/temporalio/samples-typescript/blob/main/patching-api/src/workflows-v3.ts) + ```ts // v3 import { deprecatePatch } from '@temporalio/workflow'; @@ -223,6 +233,7 @@ export async function myWorkflow(): Promise { await sleep('1 days'); } ``` + #### Step 3: Solely deploy new code @@ -356,4 +367,3 @@ const { echo } = proxyActivities({ }); // ... ``` - diff --git a/docs/dev-guide/worker-performance.mdx b/docs/dev-guide/worker-performance.mdx index fc31c37940..94f019d072 100644 --- a/docs/dev-guide/worker-performance.mdx +++ b/docs/dev-guide/worker-performance.mdx @@ -8,7 +8,7 @@ tags: - workers --- -import RelatedReadList from '../components/RelatedReadList.js' +import RelatedReadList from '../components/RelatedReadList.js'; _Note: All metrics in this article are prepended with the “temporal\_” prefix. The prefix is omitted in this article to make the names more descriptive._ @@ -70,7 +70,6 @@ Increase the maximum number of working slots by adjusting `maxConcurrentWorkflow 1. The Worker hosts are underutilized (no bottlenecks on CPU, load average, etc.). 2. The `worker_task_slots_available` metric from the corresponding Worker type frequently shows a depleted number of available Worker slots. - ### Poller count :::note diff --git a/docs/develop/go/temporal-client.mdx b/docs/develop/go/temporal-client.mdx index 803ea18c71..5351bce8a7 100644 --- a/docs/develop/go/temporal-client.mdx +++ b/docs/develop/go/temporal-client.mdx @@ -64,7 +64,9 @@ If you don't provide [`HostPort`](https://pkg.go.dev/go.temporal.io/sdk/internal If you don't set a custom Namespace name in the Namespace field, the client connects to the default Namespace. + [sample-apps/go/yourapp/gateway/main.go](https://github.com/temporalio/documentation/blob/main/sample-apps/go/yourapp/gateway/main.go) + ```go package main @@ -92,6 +94,7 @@ func main() { // ... } ``` + ## Connect to Temporal Cloud {#connect-to-temporal-cloud} @@ -124,7 +127,9 @@ For more information about managing and generating client certificates for Tempo For more information about configuring TLS to secure inter- and intra-network communication for a Temporal Cluster, see [Temporal Customization Samples](https://github.com/temporalio/samples-server). + [sample-apps/go/cloud/client/main.go](https://github.com/temporalio/documentation/blob/main/sample-apps/go/cloud/client/main.go) + ```go package main @@ -167,6 +172,7 @@ func main() { // ... } ``` + ## Start Workflow Execution {#start-workflow-execution} diff --git a/docs/develop/java/temporal-client.mdx b/docs/develop/java/temporal-client.mdx index f1408dbe3f..9747b8f671 100644 --- a/docs/develop/java/temporal-client.mdx +++ b/docs/develop/java/temporal-client.mdx @@ -50,7 +50,9 @@ However, it is acceptable and common to use a Temporal Client inside an Activity ::: + [sample-apps/java/client/devserver-client-sample/src/main/java/clientsample/YourCallerApp.java](https://github.com/temporalio/documentation/blob/main/sample-apps/java/client/devserver-client-sample/src/main/java/clientsample/YourCallerApp.java) + ```java // ... // Create an instance that connects to a Temporal Service running on the local @@ -61,6 +63,7 @@ However, it is acceptable and common to use a Temporal Client inside an Activity // This application uses the Client to communicate with the local Temporal Service WorkflowClient client = WorkflowClient.newInstance(serviceStub); ``` + The Namespace is assumed to be 'default' unless otherwise specified. @@ -73,7 +76,9 @@ Custom Namespaces on local development systems let you to build out new features Namespaces are established by setting a Client's options to configure the new instance. + [sample-apps/java/client/devserver-namespace-client-sample/src/main/java/clientsample/YourCallerApp.java](https://github.com/temporalio/documentation/blob/main/sample-apps/java/client/devserver-namespace-client-sample/src/main/java/clientsample/YourCallerApp.java) + ```java // ... // Add the Namespace as a Client Option @@ -86,6 +91,7 @@ Namespaces are established by setting a Client's options to configure the new in // This application uses the Client to communicate with the Temporal Service WorkflowClient client = WorkflowClient.newInstance(service, clientOptions); ``` + ## Connect to Temporal Cloud {#connect-to-temporal-cloud} @@ -96,7 +102,9 @@ When you use a remote service, you don't use the `newLocalServicesStubs` conveni Instead, set your connection details as stub configuration options: + [sample-apps/java/client/cloudserver-client-sample/src/main/java/clientsample/YourCallerApp.java](https://github.com/temporalio/documentation/blob/main/sample-apps/java/client/cloudserver-client-sample/src/main/java/clientsample/YourCallerApp.java) + ```java // ... // Set the Service Stub options (SSL context and gRPC endpoint) @@ -109,6 +117,7 @@ Instead, set your connection details as stub configuration options: // Create a stub that accesses a Temporal Service WorkflowServiceStubs serviceStub = WorkflowServiceStubs.newServiceStubs(stubsOptions); ``` + Each Temporal Cloud service Client has four prerequisites. @@ -125,7 +134,9 @@ Along with the gRPC endpoint, this information configures a service stub for Tem Add the Namespace to your Client build options and initialize the new Client: + [sample-apps/java/client/cloudserver-client-sample/src/main/java/clientsample/YourCallerApp.java](https://github.com/temporalio/documentation/blob/main/sample-apps/java/client/cloudserver-client-sample/src/main/java/clientsample/YourCallerApp.java) + ```java // ... // Generate an SSL context @@ -153,6 +164,7 @@ Add the Namespace to your Client build options and initialize the new Client: // This application uses the Client to communicate with the Temporal Service WorkflowClient client = WorkflowClient.newInstance(serviceStub, clientOptions); ``` + ## Start a Workflow Execution {#start-workflow-execution} diff --git a/docs/encyclopedia/activities.mdx b/docs/encyclopedia/activities.mdx index 2ea2a7e69e..26ecdeabfa 100644 --- a/docs/encyclopedia/activities.mdx +++ b/docs/encyclopedia/activities.mdx @@ -7,16 +7,15 @@ description: This guide provides a comprehensive overview of Temporal Activities slug: /activities toc_max_heading_level: 4 keywords: -- explanation -- term -- timeouts + - explanation + - term + - timeouts tags: -- explanation -- term -- timeouts + - explanation + - term + - timeouts --- - This guide provides a comprehensive overview of Temporal Activities. In day-to-day conversation, the term _Activity_ denotes an [Activity Definition](#activity-definition), [Activity Type](#activity-type), or [Activity Execution](#activity-execution). @@ -49,7 +48,18 @@ Therefore, the terms Activity Function and Activity Method refer to the source o Activity Definitions are named and referenced in code by their [Activity Type](#activity-type). -

Activity Definition

Activity Definition
+
+
+

Activity Definition

+
+
+ Activity Definition +
+
#### Idempotency @@ -117,7 +127,18 @@ An Activity Execution is the full chain of [Activity Task Executions](/workers#a - [How to start an Activity Execution using the Python SDK](/dev-guide/python/foundations#activity-execution) - [How to start an Activity Execution using the TypeScript SDK](/dev-guide/typescript/foundations#activity-execution) -

Activity Execution

Activity Execution
+
+
+

Activity Execution

+
+
+ Activity Execution +
+
You can customize [Activity Execution timeouts](#start-to-close-timeout) and [retry policies](/retry-policies). @@ -192,7 +213,18 @@ In other words, it's a limit for how long an Activity Task can be enqueued. The moment that the Task is picked by the Worker from the Task Queue is considered to be the start of the Activity Task for the purposes of the Schedule-To-Start Timeout and associated metrics. This definition of "Start" avoids issues that a clock difference between the Temporal Cluster and a Worker might create. -

Schedule-To-Start Timeout period

Schedule-To-Start Timeout period
+
+
+

Schedule-To-Start Timeout period

+
+
+ Schedule-To-Start Timeout period +
+
"Schedule" in Schedule-To-Start and Schedule-To-Close have different frequency guarantees. @@ -202,7 +234,18 @@ Thus, "Schedule" in Schedule-To-Start refers to the scheduling moment of _every_ A [Retry Policy](/retry-policies) attached to an Activity Execution retries an Activity Task. -

Start-To-Close Timeout period with retries

Start-To-Close Timeout period with retries
+
+
+

Start-To-Close Timeout period with retries

+
+
+ Start-To-Close Timeout period with retries +
+
This timeout has two primary use cases: @@ -244,14 +287,36 @@ Therefore, the Temporal Server relies on the Start-To-Close Timeout to force Act The main use case for the Start-To-Close timeout is to detect when a Worker crashes after it has started executing an Activity Task. -

Start-To-Close Timeout period

Start-To-Close Timeout period
+
+
+

Start-To-Close Timeout period

+
+
+ Start-To-Close Timeout period +
+
A [Retry Policy](/retry-policies) attached to an Activity Execution retries an Activity Task Execution. Thus, the Start-To-Close Timeout is applied to each Activity Task Execution within an Activity Execution. If the first Activity Task Execution returns an error the first time, then the full Activity Execution might look like this: -

Start-To-Close Timeout period with retries

Start-To-Close Timeout period with retries
+
+
+

Start-To-Close Timeout period with retries

+
+
+ Start-To-Close Timeout period with retries +
+
If this timeout is reached, the following actions occur: @@ -270,11 +335,33 @@ A Schedule-To-Close Timeout is the maximum amount of time allowed for the overal - [How to set a Schedule-To-Close Timeout using the Python SDK](/dev-guide/go/features#activity-timeouts) - [How to set a Schedule-To-Close Timeout using the TypeScript SDK](/dev-guide/typescript/features#activity-timeouts) -

Schedule-To-Close Timeout period

Schedule-To-Close Timeout period
+
+
+

Schedule-To-Close Timeout period

+
+
+ Schedule-To-Close Timeout period +
+
Example Schedule-To-Close Timeout period for an Activity Execution that has a chain Activity Task Executions: -

Schedule-To-Close Timeout period with a retry

Schedule-To-Close Timeout period with a retry
+
+
+

Schedule-To-Close Timeout period with a retry

+
+
+ Schedule-To-Close Timeout period with a retry +
+
**The default Schedule-To-Close Timeout is ∞ (infinity).** @@ -374,7 +461,18 @@ A Heartbeat Timeout is the maximum time between [Activity Heartbeats](#activity- - [How to set a Heartbeat Timeout using the Python SDK](/dev-guide/python/features#heartbeat-timeout) - [How to set a Heartbeat Timeout using the TypeScript SDK](/dev-guide/typescript/features#heartbeat-timeout) -

Heartbeat Timeout periods

Heartbeat Timeout periods
+
+
+

Heartbeat Timeout periods

+
+
+ Heartbeat Timeout periods +
+
If this timeout is reached, the Activity Task fails and a retry occurs if a [Retry Policy](/retry-policies) dictates it. @@ -471,4 +569,3 @@ The drawbacks of long-running Local Activities are: Using a Local Activity without understanding its limitations can cause various production issues. **We recommend using regular Activities unless your use case requires very high throughput and large Activity fan outs of very short-lived Activities.** More guidance in choosing between [Local Activity vs Activity](https://community.temporal.io/t/local-activity-vs-activity/290/3) is available in our forums. - diff --git a/docs/encyclopedia/child-workflows.mdx b/docs/encyclopedia/child-workflows.mdx index ba75393ef5..beb0ccfbba 100644 --- a/docs/encyclopedia/child-workflows.mdx +++ b/docs/encyclopedia/child-workflows.mdx @@ -66,7 +66,10 @@ If a Child Workflow Execution uses Continue-As-New, from the Parent Workflow Exe
-

Parent and Child Workflow Execution entity relationship with Continue As New

+

+ Parent and Child Workflow Execution entity relationship with Continue As + New +

Parent Close Policy entity relationship

- Parent Close Policy entity relationship + Parent Close Policy entity relationship
diff --git a/docs/encyclopedia/clusters.mdx b/docs/encyclopedia/clusters.mdx index beb07b8653..3c1b618b2c 100644 --- a/docs/encyclopedia/clusters.mdx +++ b/docs/encyclopedia/clusters.mdx @@ -76,7 +76,11 @@ The Frontend Service is responsible for rate limiting, authorizing, validating,

Frontend Service

- Frontend Service + Frontend Service
@@ -110,8 +114,8 @@ From there, a Worker can poll for work, receive this updated history, and resume

- Block diagram of how the History Service relates to the other services of the Temporal Server and to the Temporal - Service + Block diagram of how the History Service relates to the other services of + the Temporal Server and to the Temporal Service

@@ -175,7 +179,11 @@ The Matching Service is responsible for hosting user-facing [Task Queues](/worke

Matching Service

- Matching Service + Matching Service
@@ -198,7 +206,11 @@ The Worker Service runs background processing for the replication queue, system

Worker Service

- Worker Service + Worker Service
@@ -244,7 +256,11 @@ Multiple types of databases are supported.

Persistence

- Persistence + Persistence
diff --git a/docs/encyclopedia/dataconversion.mdx b/docs/encyclopedia/dataconversion.mdx index da86527f5b..4ab988df73 100644 --- a/docs/encyclopedia/dataconversion.mdx +++ b/docs/encyclopedia/dataconversion.mdx @@ -32,7 +32,11 @@ Workflow inputs and outputs need to be serialized and deserialized so they can b

Data Converter encodes and decodes data

- Data Converter encodes and decodes data + Data Converter encodes and decodes data
@@ -235,6 +239,7 @@ Samples: A Codec Server is an HTTP/HTTPS server that uses a [custom Payload Codec](/production-deployment/data-encryption) to decode your data remotely through endpoints. + ![](/diagrams/tctl-diagram-codec-server.svg) A Codec Server follows the Temporal [Codec Server Protocol](https://github.com/temporalio/samples-go/tree/main/codec-server#codec-server-protocol). diff --git a/docs/encyclopedia/temporal-sdks.mdx b/docs/encyclopedia/temporal-sdks.mdx index 6498198234..cf7824d82f 100644 --- a/docs/encyclopedia/temporal-sdks.mdx +++ b/docs/encyclopedia/temporal-sdks.mdx @@ -139,7 +139,9 @@ Another quality of the SDKs lies in their ability to replay Workflow Executions,
-

The SDKs Replay code execution to continue from the last step

+

+ The SDKs Replay code execution to continue from the last step +

-

Temporal SDK components create a runtime across your environment and a Temporal Cluster

+

+ Temporal SDK components create a runtime across your environment and a + Temporal Cluster +

A Worker long polls for Tasks

- A Worker long polls for Tasks + A Worker long polls for Tasks
@@ -497,7 +506,11 @@ We can use a Temporal Client (available in Temporal SDKs and the Temporal CLI) t

Start a Workflow using a Temporal Client

- Start a Workflow using a Temporal Client + Start a Workflow using a Temporal Client
@@ -516,7 +529,9 @@ When the call to invoke the Activity is evaluated, the Worker suspends executing
-

Worker suspends code execution and sends a Command to the Cluster

+

+ Worker suspends code execution and sends a Command to the Cluster +

The Worker picks up the new Task

- The Worker picks up the new Task + The Worker picks up the new Task
@@ -569,7 +588,9 @@ The result of the Workflow can now be retrieved using a Temporal Client.
-

The Temporal Client can now access the result of the Workflow

+

+ The Temporal Client can now access the result of the Workflow +

The Temporal System

- The Temporal System + The Temporal System
@@ -56,7 +60,11 @@ Together these components create a runtime for your application.

The Temporal Platform

- The Temporal Platform + The Temporal Platform
diff --git a/docs/encyclopedia/visibility.mdx b/docs/encyclopedia/visibility.mdx index 7ac738040a..521bf79798 100644 --- a/docs/encyclopedia/visibility.mdx +++ b/docs/encyclopedia/visibility.mdx @@ -7,21 +7,21 @@ description: This guide provides a comprehensive overview of Temporal Visibility slug: /visibility toc_max_heading_level: 4 keywords: -- explanation -- filtered-lists -- term -- visibility + - explanation + - filtered-lists + - term + - visibility tags: -- explanation -- filtered-lists -- term -- visibility + - explanation + - filtered-lists + - term + - visibility --- - This guide provides a comprehensive overview of Temporal Visibility. :::tip Support, stability, and dependency info + - For Temporal Server v1.19 and earlier, all supported databases for Visibility provide standard Visibility features, and an Elasticsearch database is required for advanced Visibility features. - For Temporal Server v1.20 and later, advanced Visibility features are enabled on all supported SQL databases, in addition to Elasticsearch. - In Temporal Server v1.21 and later, standard Visibility is no longer in development, and we recommend migrating to a [database that supports Advanced Visibility features](/self-hosted-guide/visibility). The Visibility configuration for Temporal Clusters has been updated and Dual Visibility is enabled. For details, see [Visibility store setup](/self-hosted-guide/visibility). @@ -441,4 +441,3 @@ Their names indicate their types: - CustomKeywordField - CustomTextField --> - diff --git a/docs/encyclopedia/workers.mdx b/docs/encyclopedia/workers.mdx index 6443eaac5e..fe8ac738ed 100644 --- a/docs/encyclopedia/workers.mdx +++ b/docs/encyclopedia/workers.mdx @@ -100,7 +100,9 @@ Here are some approaches:
-

Component diagram of a Worker Process and the Temporal Server

+

+ Component diagram of a Worker Process and the Temporal Server +

Task Queue component

- Task Queue component + Task Queue component
diff --git a/docs/encyclopedia/workflows.mdx b/docs/encyclopedia/workflows.mdx index 26b129e7db..2608a3b319 100644 --- a/docs/encyclopedia/workflows.mdx +++ b/docs/encyclopedia/workflows.mdx @@ -290,7 +290,10 @@ A Workflow Type is a name that maps to a Workflow Definition.
-

Workflow Type cardinality with Workflow Definitions and Workflow Executions

+

+ Workflow Type cardinality with Workflow Definitions and Workflow + Executions +

Workflow Execution statuses

- Workflow Execution statuses + Workflow Execution statuses
@@ -444,7 +451,11 @@ Events are created by the Temporal Cluster in response to either Commands or act

Workflow Execution

- Workflow Execution + Workflow Execution
@@ -503,7 +514,9 @@ There will always be [WorkflowTaskStarted](/references/events#workflowtaskstarte
-

Commands are generated by the use of Workflow APIs in your code

+

+ Commands are generated by the use of Workflow APIs in your code +

Workflow Execution Timeout period

- Workflow Execution Timeout period + Workflow Execution Timeout period
@@ -722,7 +739,11 @@ A Workflow Run Timeout is the maximum amount of time that a single Workflow Run

Workflow Run Timeout period

- Workflow Run Timeout period + Workflow Run Timeout period
@@ -746,7 +767,11 @@ A Workflow Task Timeout is the maximum amount of time allowed for a [Worker](/wo

Workflow Task Timeout period

- Workflow Task Timeout period + Workflow Task Timeout period
@@ -1251,7 +1276,11 @@ A Temporal Cron Job is the series of Workflow Executions that occur when a Cron

Temporal Cron Job timeline

- Temporal Cron Job timeline + Temporal Cron Job timeline
diff --git a/docs/evaluate/major-components.mdx b/docs/evaluate/major-components.mdx index 6f24601a96..12c7ce51f7 100644 --- a/docs/evaluate/major-components.mdx +++ b/docs/evaluate/major-components.mdx @@ -63,8 +63,8 @@ With the Temporal CLI, developers can start their applications, pass messages, c The Temporal CLI provides developers with direct access to a Temporal Service. It also includes a distribution of the Temporal Service for local development purposes. -import Tabs from "@theme/Tabs"; -import TabItem from "@theme/TabItem"; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; ](https://learn.temporal.io/getting_started/typescript) - - - diff --git a/docs/index.mdx b/docs/index.mdx index df4b8bafaf..9af6ee8b8f 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -2,9 +2,8 @@ id: index title: Documentation sidebar_label: Home - --- -import {Intro} from '/docs/components/Intro.js' +import { Intro } from '/docs/components/Intro.js'; - + diff --git a/docs/production-deployment/cloud/account-setup/users.mdx b/docs/production-deployment/cloud/account-setup/users.mdx index 8d6f96b618..8c3dc3f145 100644 --- a/docs/production-deployment/cloud/account-setup/users.mdx +++ b/docs/production-deployment/cloud/account-setup/users.mdx @@ -7,26 +7,25 @@ description: Invite users, set account level roles, and set Namespace-level posi slug: /cloud/users toc_max_heading_level: 4 keywords: -- explanation -- how-to -- introduction -- namespace -- namespaces -- temporal cloud -- temporal cloud account -- users + - explanation + - how-to + - introduction + - namespace + - namespaces + - temporal cloud + - temporal cloud account + - users tags: -- explanation -- how-to -- introduction -- namespace -- namespaces -- temporal-cloud -- temporal-cloud-account -- users + - explanation + - how-to + - introduction + - namespace + - namespaces + - temporal-cloud + - temporal-cloud-account + - users --- - - [How to invite users to your Temporal Cloud account](#invite-users) - [What are the account-level roles?](#account-level-roles) - [What are the Namespace-level permissions?](#namespace-level-permissions) @@ -231,52 +230,52 @@ This table provides API-level details for the permissions granted to a user thro | Permission | Read-only | Developer | Global Admin | | ------------------------------ | --------- | --------- | ------------ | -| CountIdentities | ✔ | ✔ | ✔ | -| CreateAPIKey | ✔ | ✔ | ✔ | -| CreateNamespace | | ✔ | ✔ | -| CreateServiceAccount | | | ✔ | -| CreateServiceAccountAPIKey | | | ✔ | -| CreateUser | | | ✔ | -| DeleteAPIKey | ✔ | ✔ | ✔ | -| DeleteServiceAccount | | | ✔ | -| DeleteUser | | | ✔ | -| GetAccount | ✔ | ✔ | ✔ | -| GetAccountFeatureFlags | ✔ | ✔ | ✔ | -| GetAccountLimits | ✔ | ✔ | ✔ | -| GetAccountSettings | ✔ | ✔ | ✔ | -| GetAccountUsage | | | ✔ | -| GetAPIKey | ✔ | ✔ | ✔ | -| GetAPIKeys | ✔ | ✔ | ✔ | -| GetAsyncOperation | ✔ | ✔ | ✔ | -| GetDecodedCertificate | ✔ | ✔ | ✔ | -| GetIdentities | ✔ | ✔ | ✔ | -| GetIdentity | ✔ | ✔ | ✔ | -| GetNamespaces | ✔ | ✔ | ✔ | -| GetNamespacesUsage | | | ✔ | -| GetRegion | ✔ | ✔ | ✔ | -| GetRegions | ✔ | ✔ | ✔ | -| GetRequestStatus | ✔ | ✔ | ✔ | -| GetRequestStatuses | | | ✔ | -| GetRequestStatusesForNamespace | ✔ | ✔ | ✔ | -| GetRequestStatusesForUser | ✔ | ✔ | ✔ | -| GetRoles | ✔ | ✔ | ✔ | -| GetRolesByPermissions | ✔ | ✔ | ✔ | -| GetServiceAccount | ✔ | ✔ | ✔ | -| GetServiceAccounts | ✔ | ✔ | ✔ | -| GetUser | ✔ | ✔ | ✔ | -| GetUsers | ✔ | ✔ | ✔ | -| GetUsersWithAccountRoles | ✔ | ✔ | ✔ | -| InviteUsers | | | ✔ | -| ListCreditLedgerEntries | | | ✔ | -| ListGrants | | | ✔ | -| ListNamespaces | ✔ | ✔ | ✔ | -| ResendUserInvite | | | ✔ | -| SetAccountSettings | | | ✔ | -| SyncCurrentUserInvite | ✔ | ✔ | ✔ | -| UpdateAccount | | | ✔ | -| UpdateAPIKey | ✔ | ✔ | ✔ | -| UpdateServiceAccount | | | ✔ | -| UpdateUser | | | ✔ | +| CountIdentities | ✔ | ✔ | ✔ | +| CreateAPIKey | ✔ | ✔ | ✔ | +| CreateNamespace | | ✔ | ✔ | +| CreateServiceAccount | | | ✔ | +| CreateServiceAccountAPIKey | | | ✔ | +| CreateUser | | | ✔ | +| DeleteAPIKey | ✔ | ✔ | ✔ | +| DeleteServiceAccount | | | ✔ | +| DeleteUser | | | ✔ | +| GetAccount | ✔ | ✔ | ✔ | +| GetAccountFeatureFlags | ✔ | ✔ | ✔ | +| GetAccountLimits | ✔ | ✔ | ✔ | +| GetAccountSettings | ✔ | ✔ | ✔ | +| GetAccountUsage | | | ✔ | +| GetAPIKey | ✔ | ✔ | ✔ | +| GetAPIKeys | ✔ | ✔ | ✔ | +| GetAsyncOperation | ✔ | ✔ | ✔ | +| GetDecodedCertificate | ✔ | ✔ | ✔ | +| GetIdentities | ✔ | ✔ | ✔ | +| GetIdentity | ✔ | ✔ | ✔ | +| GetNamespaces | ✔ | ✔ | ✔ | +| GetNamespacesUsage | | | ✔ | +| GetRegion | ✔ | ✔ | ✔ | +| GetRegions | ✔ | ✔ | ✔ | +| GetRequestStatus | ✔ | ✔ | ✔ | +| GetRequestStatuses | | | ✔ | +| GetRequestStatusesForNamespace | ✔ | ✔ | ✔ | +| GetRequestStatusesForUser | ✔ | ✔ | ✔ | +| GetRoles | ✔ | ✔ | ✔ | +| GetRolesByPermissions | ✔ | ✔ | ✔ | +| GetServiceAccount | ✔ | ✔ | ✔ | +| GetServiceAccounts | ✔ | ✔ | ✔ | +| GetUser | ✔ | ✔ | ✔ | +| GetUsers | ✔ | ✔ | ✔ | +| GetUsersWithAccountRoles | ✔ | ✔ | ✔ | +| InviteUsers | | | ✔ | +| ListCreditLedgerEntries | | | ✔ | +| ListGrants | | | ✔ | +| ListNamespaces | ✔ | ✔ | ✔ | +| ResendUserInvite | | | ✔ | +| SetAccountSettings | | | ✔ | +| SyncCurrentUserInvite | ✔ | ✔ | ✔ | +| UpdateAccount | | | ✔ | +| UpdateAPIKey | ✔ | ✔ | ✔ | +| UpdateServiceAccount | | | ✔ | +| UpdateUser | | | ✔ | #### Namespace-level permissions details @@ -284,70 +283,69 @@ This table provides API-level details for the permissions granted to a user thro | Permission | Read | Write | Namespace Admin | | ---------------------------------- | ---- | ----- | --------------- | -| CountWorkflowExecutions | ✔ | ✔ | ✔ | -| CreateExportSink | | ✔ | ✔ | -| CreateSchedule | | ✔ | ✔ | -| DeleteExportSink | | ✔ | ✔ | -| DeleteNamespace | | ✔ | ✔ | -| DeleteSchedule | | ✔ | ✔ | -| DescribeBatchOperation | ✔ | ✔ | ✔ | -| DescribeNamespace | ✔ | ✔ | ✔ | -| DescribeSchedule | ✔ | ✔ | ✔ | -| DescribeTaskQueue | ✔ | ✔ | ✔ | -| DescribeWorkflowExecution | ✔ | ✔ | ✔ | -| FailoverNamespace | | | ✔ | -| GetExportSink | ✔ | ✔ | ✔ | -| GetExportSinks | ✔ | ✔ | ✔ | -| GetNamespace | ✔ | ✔ | ✔ | -| GetNamespaceUsage | ✔ | ✔ | ✔ | -| GetReplicationStatus | ✔ | ✔ | ✔ | -| GetSearchAttributes | ✔ | ✔ | ✔ | -| GetUsersForNamespace | ✔ | ✔ | ✔ | -| GetWorkerBuildIdCompatibility | ✔ | ✔ | ✔ | -| GetWorkerTaskReachability | ✔ | ✔ | ✔ | -| GetWorkflowExecutionHistory | ✔ | ✔ | ✔ | -| GetWorkflowExecutionHistoryReverse | ✔ | ✔ | ✔ | -| GlobalizeNamespace | | | ✔ | -| ListBatchOperations | ✔ | ✔ | ✔ | -| ListClosedWorkflowExecutions | ✔ | ✔ | ✔ | -| ListExportSinks | ✔ | ✔ | ✔ | -| ListFailoverHistoryByNamespace | ✔ | ✔ | ✔ | -| ListOpenWorkflowExecutions | ✔ | ✔ | ✔ | -| ListReplicaStatus | ✔ | ✔ | ✔ | -| ListScheduleMatchingTimes | ✔ | ✔ | ✔ | -| ListSchedules | ✔ | ✔ | ✔ | -| ListTaskQueuePartitions | ✔ | ✔ | ✔ | -| ListWorkflowExecutions | ✔ | ✔ | ✔ | -| PatchSchedule | | ✔ | ✔ | -| PollActivityTaskQueue | | ✔ | ✔ | -| PollWorkflowTaskQueue | | ✔ | ✔ | -| QueryWorkflow | ✔ | ✔ | ✔ | -| RecordActivityTaskHeartbeat | | ✔ | ✔ | -| RecordActivityTaskHeartbeatById | | ✔ | ✔ | -| RenameCustomSearchAttribute | | ✔ | ✔ | -| RequestCancelWorkflowExecution | | ✔ | ✔ | -| ResetStickyTaskQueue | | ✔ | ✔ | -| ResetWorkflowExecution | | ✔ | ✔ | -| RespondActivityTaskCanceled | | ✔ | ✔ | -| RespondActivityTaskCanceledById | | ✔ | ✔ | -| RespondActivityTaskCompleted | | ✔ | ✔ | -| RespondActivityTaskCompletedById | | ✔ | ✔ | -| RespondActivityTaskFailed | | ✔ | ✔ | -| RespondActivityTaskFailedById | | ✔ | ✔ | -| RespondQueryTaskCompleted | | ✔ | ✔ | -| RespondWorkflowTaskCompleted | | ✔ | ✔ | -| RespondWorkflowTaskFailed | | ✔ | ✔ | -| SetUserNamespaceAccess | | | ✔ | -| SignalWithStartWorkflowExecution | | ✔ | ✔ | -| SignalWorkflowExecution | | ✔ | ✔ | -| StartBatchOperation | | ✔ | ✔ | -| StartWorkflowExecution | | ✔ | ✔ | -| StopBatchOperation | | ✔ | ✔ | -| TerminateWorkflowExecution | | ✔ | ✔ | -| UpdateExportSink | | ✔ | ✔ | -| UpdateNamespace | | ✔ | ✔ | -| UpdateSchedule | | ✔ | ✔ | -| UpdateUserNamespacePermissions | | | ✔ | -| ValidateExportSink | | ✔ | ✔ | -| ValidateGlobalizeNamespace | | | ✔ | - +| CountWorkflowExecutions | ✔ | ✔ | ✔ | +| CreateExportSink | | ✔ | ✔ | +| CreateSchedule | | ✔ | ✔ | +| DeleteExportSink | | ✔ | ✔ | +| DeleteNamespace | | ✔ | ✔ | +| DeleteSchedule | | ✔ | ✔ | +| DescribeBatchOperation | ✔ | ✔ | ✔ | +| DescribeNamespace | ✔ | ✔ | ✔ | +| DescribeSchedule | ✔ | ✔ | ✔ | +| DescribeTaskQueue | ✔ | ✔ | ✔ | +| DescribeWorkflowExecution | ✔ | ✔ | ✔ | +| FailoverNamespace | | | ✔ | +| GetExportSink | ✔ | ✔ | ✔ | +| GetExportSinks | ✔ | ✔ | ✔ | +| GetNamespace | ✔ | ✔ | ✔ | +| GetNamespaceUsage | ✔ | ✔ | ✔ | +| GetReplicationStatus | ✔ | ✔ | ✔ | +| GetSearchAttributes | ✔ | ✔ | ✔ | +| GetUsersForNamespace | ✔ | ✔ | ✔ | +| GetWorkerBuildIdCompatibility | ✔ | ✔ | ✔ | +| GetWorkerTaskReachability | ✔ | ✔ | ✔ | +| GetWorkflowExecutionHistory | ✔ | ✔ | ✔ | +| GetWorkflowExecutionHistoryReverse | ✔ | ✔ | ✔ | +| GlobalizeNamespace | | | ✔ | +| ListBatchOperations | ✔ | ✔ | ✔ | +| ListClosedWorkflowExecutions | ✔ | ✔ | ✔ | +| ListExportSinks | ✔ | ✔ | ✔ | +| ListFailoverHistoryByNamespace | ✔ | ✔ | ✔ | +| ListOpenWorkflowExecutions | ✔ | ✔ | ✔ | +| ListReplicaStatus | ✔ | ✔ | ✔ | +| ListScheduleMatchingTimes | ✔ | ✔ | ✔ | +| ListSchedules | ✔ | ✔ | ✔ | +| ListTaskQueuePartitions | ✔ | ✔ | ✔ | +| ListWorkflowExecutions | ✔ | ✔ | ✔ | +| PatchSchedule | | ✔ | ✔ | +| PollActivityTaskQueue | | ✔ | ✔ | +| PollWorkflowTaskQueue | | ✔ | ✔ | +| QueryWorkflow | ✔ | ✔ | ✔ | +| RecordActivityTaskHeartbeat | | ✔ | ✔ | +| RecordActivityTaskHeartbeatById | | ✔ | ✔ | +| RenameCustomSearchAttribute | | ✔ | ✔ | +| RequestCancelWorkflowExecution | | ✔ | ✔ | +| ResetStickyTaskQueue | | ✔ | ✔ | +| ResetWorkflowExecution | | ✔ | ✔ | +| RespondActivityTaskCanceled | | ✔ | ✔ | +| RespondActivityTaskCanceledById | | ✔ | ✔ | +| RespondActivityTaskCompleted | | ✔ | ✔ | +| RespondActivityTaskCompletedById | | ✔ | ✔ | +| RespondActivityTaskFailed | | ✔ | ✔ | +| RespondActivityTaskFailedById | | ✔ | ✔ | +| RespondQueryTaskCompleted | | ✔ | ✔ | +| RespondWorkflowTaskCompleted | | ✔ | ✔ | +| RespondWorkflowTaskFailed | | ✔ | ✔ | +| SetUserNamespaceAccess | | | ✔ | +| SignalWithStartWorkflowExecution | | ✔ | ✔ | +| SignalWorkflowExecution | | ✔ | ✔ | +| StartBatchOperation | | ✔ | ✔ | +| StartWorkflowExecution | | ✔ | ✔ | +| StopBatchOperation | | ✔ | ✔ | +| TerminateWorkflowExecution | | ✔ | ✔ | +| UpdateExportSink | | ✔ | ✔ | +| UpdateNamespace | | ✔ | ✔ | +| UpdateSchedule | | ✔ | ✔ | +| UpdateUserNamespacePermissions | | | ✔ | +| ValidateExportSink | | ✔ | ✔ | +| ValidateGlobalizeNamespace | | | ✔ | diff --git a/docs/production-deployment/cloud/audit-logging.mdx b/docs/production-deployment/cloud/audit-logging.mdx index 0d7ffe7884..d2156d793e 100644 --- a/docs/production-deployment/cloud/audit-logging.mdx +++ b/docs/production-deployment/cloud/audit-logging.mdx @@ -7,24 +7,23 @@ description: Audit Logging provides forensic access information at the account, slug: /cloud/audit-logging toc_max_heading_level: 4 keywords: -- audit logging -- explanation -- how-to -- operations -- temporal cloud -- term -- troubleshooting + - audit logging + - explanation + - how-to + - operations + - temporal cloud + - term + - troubleshooting tags: -- audit-logging -- explanation -- how-to -- operations -- temporal-cloud -- term -- troubleshooting + - audit-logging + - explanation + - how-to + - operations + - temporal-cloud + - term + - troubleshooting --- - Audit Logging is a feature of [Temporal Cloud](/cloud/overview) that provides forensic access information at the account level, the user level, and the [Namespace](/namespaces) level. Audit Logging answers "who, when, and what" questions about Temporal Cloud resources. diff --git a/docs/production-deployment/cloud/index.mdx b/docs/production-deployment/cloud/index.mdx index ffd8bc229a..0201b95ea1 100644 --- a/docs/production-deployment/cloud/index.mdx +++ b/docs/production-deployment/cloud/index.mdx @@ -7,12 +7,11 @@ description: Temporal Cloud documentation, including explanations and usage. slug: /cloud toc_max_heading_level: 4 keywords: -- explanation + - explanation tags: -- explanation + - explanation --- - Welcome to the Temporal Cloud guide. In this guide you will find information about Temporal Cloud, onboarding, features, and how to use them. @@ -43,4 +42,3 @@ To create a Temporal Cloud account, sign up [here](https://temporal.io/get-cloud - [Cloud Ops API](/ops) - [Audit logging feature guide](/cloud/audit-logging) - [`tcld` (Temporal Cloud command-line interface) reference](/cloud/tcld) - diff --git a/docs/production-deployment/cloud/introduction/index.mdx b/docs/production-deployment/cloud/introduction/index.mdx index a0f0bb815c..edc08d1f8f 100644 --- a/docs/production-deployment/cloud/introduction/index.mdx +++ b/docs/production-deployment/cloud/introduction/index.mdx @@ -7,14 +7,13 @@ description: Learn more about Temporal Cloud. slug: /cloud/introduction toc_max_heading_level: 4 keywords: -- Introduction -- Temporal Cloud + - Introduction + - Temporal Cloud tags: -- introduction -- temporal-cloud + - introduction + - temporal-cloud --- - In the introduction to Temporal Cloud you'll find the following information: - [Overview of Temporal Cloud](/cloud/overview) @@ -24,4 +23,3 @@ In the introduction to Temporal Cloud you'll find the following information: - [SLA](/cloud/sla) - [Pricing](/cloud/pricing) - [Support](/cloud/support) - diff --git a/docs/production-deployment/cloud/introduction/limits.mdx b/docs/production-deployment/cloud/introduction/limits.mdx index f5ba8eb9df..154215963f 100644 --- a/docs/production-deployment/cloud/introduction/limits.mdx +++ b/docs/production-deployment/cloud/introduction/limits.mdx @@ -7,20 +7,19 @@ description: Learn more about Temporal Cloud defaults, limits, and configurable slug: /cloud/limits toc_max_heading_level: 4 keywords: -- configuration -- defaults -- limits -- settings -- temporal cloud + - configuration + - defaults + - limits + - settings + - temporal cloud tags: -- configuration -- defaults -- limits -- settings -- temporal-cloud + - configuration + - defaults + - limits + - settings + - temporal-cloud --- - This page addresses the limits of the Temporal Cloud system. Reach out to your account team should you have any quesitons about these limits. @@ -107,9 +106,31 @@ This is configurable in the Temporal Web UI. [Navigate to your list of Namespaces](https://cloud.temporal.io/namespaces), choose the Namespace you want to update, and select edit: -

Choose your Namespace and select Edit

Choose your Namespace and select Edit
- -

Update the Retention Period

Update the Retention Period
+
+
+

Choose your Namespace and select Edit

+
+
+ Choose your Namespace and select Edit +
+
+ +
+
+

Update the Retention Period

+
+
+ Update the Retention Period +
+
You can set the Retention Period between 1 and 90 days. @@ -219,4 +240,4 @@ After that limit is reached, no more Signals will be processed for that Workflow **What is the maximum number of Updates for a single Workflow Execution?** -A single Workflow Execution can have a maximum of 10 in-flight Updates and 2000 total Updates in History. +A single Workflow Execution can have a maximum of 10 in-flight Updates and 2000 total Updates in History. diff --git a/docs/production-deployment/cloud/introduction/overview.mdx b/docs/production-deployment/cloud/introduction/overview.mdx index 4fe7c909c0..3dcce96611 100644 --- a/docs/production-deployment/cloud/introduction/overview.mdx +++ b/docs/production-deployment/cloud/introduction/overview.mdx @@ -34,7 +34,11 @@ There are two major parts of the Temporal Platform that work together to create

High-level system topology

- High-level system topology + High-level system topology
diff --git a/docs/production-deployment/cloud/introduction/service-availability.mdx b/docs/production-deployment/cloud/introduction/service-availability.mdx index ee762a2a36..21212bb1f0 100644 --- a/docs/production-deployment/cloud/introduction/service-availability.mdx +++ b/docs/production-deployment/cloud/introduction/service-availability.mdx @@ -7,18 +7,17 @@ description: The operating envelope of Temporal Cloud includes availability, reg slug: /cloud/service-availability toc_max_heading_level: 4 keywords: -- explanation -- operations -- temporal cloud -- throughput + - explanation + - operations + - temporal cloud + - throughput tags: -- explanation -- operations -- temporal-cloud -- throughput + - explanation + - operations + - temporal-cloud + - throughput --- - The operating envelope of Temporal Cloud includes availability, regions, throughput, latency, and limits. If you need more details, [contact us](https://pages.temporal.io/contact-us). @@ -65,6 +64,7 @@ Throttling means limiting the rate at which Actions are performed to prevent the Critical calls to external events, such starting or Signaling a Workflow, are always prioritized and never throttled. There are four priority levels for Temporal Cloud API calls: + 1. External events 2. Workflow progress updates 3. Visibility API calls @@ -97,4 +97,3 @@ As Temporal continues working on improving latencies, these numbers will progres Latency observed from the Temporal Client is influenced by other system components like the Codec Server, egress proxy, and the network itself. Also, concurrent operations on the same Workflow Execution may result in higher latency. - diff --git a/docs/production-deployment/cloud/introduction/sla.mdx b/docs/production-deployment/cloud/introduction/sla.mdx index f35b1f6f14..006240a423 100644 --- a/docs/production-deployment/cloud/introduction/sla.mdx +++ b/docs/production-deployment/cloud/introduction/sla.mdx @@ -7,16 +7,15 @@ description: Learn more about Temporal Cloud's Sevice Level Agreement (SLA). slug: /cloud/sla toc_max_heading_level: 4 keywords: -- explanation -- operations -- temporal cloud + - explanation + - operations + - temporal cloud tags: -- explanation -- operations -- temporal-cloud + - explanation + - operations + - temporal-cloud --- - **What is Temporal Cloud's Service Level Agreement? SLA?** Temporal Cloud provides 99.99% availability, and its service level agreement (SLA) has a 99.9% guarantee against service errors. @@ -52,4 +51,3 @@ When we receive an alert that an SLO is not being met, we page our on-call engin Internally, our components are distributed across a minimum of three availability zones per region. For current system status and information about recent incidents, see [Temporal Status](https://status.temporal.io). - diff --git a/docs/production-deployment/cloud/introduction/support.mdx b/docs/production-deployment/cloud/introduction/support.mdx index 7eb34d3da3..5d159fec39 100644 --- a/docs/production-deployment/cloud/introduction/support.mdx +++ b/docs/production-deployment/cloud/introduction/support.mdx @@ -3,24 +3,23 @@ id: support title: Services, support, and training - Temporal Cloud sidebar_label: Support -description: Temporal Cloud users can reach out for help through our community Slack channel, or file a support ticket through Zendesk. +description: Temporal Cloud users can reach out for help through our community Slack channel, or file a support ticket through Zendesk. slug: /cloud/support toc_max_heading_level: 4 keywords: -- how-to -- introduction -- support -- temporal cloud -- training + - how-to + - introduction + - support + - temporal cloud + - training tags: -- how-to -- introduction -- support -- temporal-cloud -- training + - how-to + - introduction + - support + - temporal-cloud + - training --- - Temporal Cloud includes the support, services and training needed to onboard you successfully, design and deploy your application efficiently and scale. Our team has extensive knowledge of the Temporal project, and a broad set of skills to help you succeed with any project. @@ -139,4 +138,3 @@ Temporal offers developer resources and a variety of hands-on tutorials to get y - [Courses](https://learn.temporal.io/courses): Learn and apply Temporal concepts in our free, self-paced, hands-on courses. - [Tutorials](https://learn.temporal.io/tutorials): Apply Temporal concepts to build real-world applications with these hands-on tutorials. - [Example applications](https://learn.temporal.io/examples): Explore example applications that use Temporal and gain a clearer understanding of how Temporal concepts work in a complex application. - diff --git a/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx b/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx index 2b90825cb9..2d83826b2e 100644 --- a/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx +++ b/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx @@ -220,7 +220,7 @@ global: # Set your scrape configuration targets to the ports exposed on your endpoints in the SDK. scrape_configs: - - job_name: "temporalsdkmetrics" + - job_name: 'temporalsdkmetrics' metrics_path: /metrics scheme: http static_configs: diff --git a/docs/production-deployment/cloud/saml.mdx b/docs/production-deployment/cloud/saml.mdx index 92990adcea..2b33ccf125 100644 --- a/docs/production-deployment/cloud/saml.mdx +++ b/docs/production-deployment/cloud/saml.mdx @@ -7,18 +7,17 @@ description: Integrate a SAML identity provider with your Temporal Cloud account slug: /cloud/saml toc_max_heading_level: 4 keywords: -- how-to -- introduction -- security -- temporal cloud + - how-to + - introduction + - security + - temporal cloud tags: -- how-to -- introduction -- security -- temporal-cloud + - how-to + - introduction + - security + - temporal-cloud --- - To authenticate the users of your Temporal Cloud account, you can connect an identity provider (IdP) to your account by using Security Assertion Markup Language (SAML) 2.0. :::info @@ -154,4 +153,3 @@ When you receive confirmation from us that we have finished configuration, log i This time, though, enter your email address in **Enterprise identity** and select **Continue**. Do not select **Continue with Google** or **Continue with Microsoft**. You will be redirected to the authentication page of your IdP. - diff --git a/docs/production-deployment/cloud/tcld/account.mdx b/docs/production-deployment/cloud/tcld/account.mdx index 9c37316bef..e523336739 100644 --- a/docs/production-deployment/cloud/tcld/account.mdx +++ b/docs/production-deployment/cloud/tcld/account.mdx @@ -6,14 +6,13 @@ description: The Temporal Cloud CLI (tcld) account commands manage accounts in T slug: /cloud/tcld/account toc_max_heading_level: 4 keywords: -- cli reference -- tcld + - cli reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - The `tcld account` commands manage accounts in Temporal Cloud. Alias: `a` @@ -319,4 +318,3 @@ The `tcld account metrics disable` command disables the metrics endpoint for the `tcld account metrics disable` The command has no modifiers. - diff --git a/docs/production-deployment/cloud/tcld/apikey.mdx b/docs/production-deployment/cloud/tcld/apikey.mdx index 79c7d95f35..bc6aabcd1c 100644 --- a/docs/production-deployment/cloud/tcld/apikey.mdx +++ b/docs/production-deployment/cloud/tcld/apikey.mdx @@ -6,14 +6,13 @@ description: The Temporal Cloud CLI (tcld) apikey commands manage API keys in Te slug: /cloud/tcld/apikey toc_max_heading_level: 4 keywords: -- cli reference -- tcld + - cli reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - The `tcld apikey` commands manage API Keys in Temporal Cloud. Alias: `ak` @@ -280,4 +279,3 @@ Alias: `-r` ```bash tcld apikey enable --id --request-id ``` - diff --git a/docs/production-deployment/cloud/tcld/feature.mdx b/docs/production-deployment/cloud/tcld/feature.mdx index b62cb0bc93..dfe14d68a7 100644 --- a/docs/production-deployment/cloud/tcld/feature.mdx +++ b/docs/production-deployment/cloud/tcld/feature.mdx @@ -5,14 +5,13 @@ sidebar_label: feature description: The Temporal Cloud CLI (tcld) feature command enables features in a user to Temporal Cloud. toc_max_heading_level: 4 keywords: -- cli reference -- tcld + - cli reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -81,4 +80,3 @@ The feature `apikey` is an example. Update the feature name to toggle a different feature. ::: - diff --git a/docs/production-deployment/cloud/tcld/generate-certificates.mdx b/docs/production-deployment/cloud/tcld/generate-certificates.mdx index 7dd9c29328..1948b60478 100644 --- a/docs/production-deployment/cloud/tcld/generate-certificates.mdx +++ b/docs/production-deployment/cloud/tcld/generate-certificates.mdx @@ -6,14 +6,13 @@ description: How to use Temporal Cloud's tcld generate-certificates command. slug: /cloud/tcld/generate-certificates/ toc_max_heading_level: 4 keywords: -- cli-reference -- tcld + - cli-reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - The `tcld generate-certificates` commands generate certificate authority (CA) and end-entity TLS certificates for Temporal Cloud. Alias: `gen` @@ -185,4 +184,3 @@ Alias: `--key` ```bash tcld generate-certificates end-entity-certificate --key-file ``` - diff --git a/docs/production-deployment/cloud/tcld/index.mdx b/docs/production-deployment/cloud/tcld/index.mdx index fcc10b2a5f..533391810f 100644 --- a/docs/production-deployment/cloud/tcld/index.mdx +++ b/docs/production-deployment/cloud/tcld/index.mdx @@ -6,14 +6,13 @@ description: The Temporal Cloud CLI (tcld) is a command-line tool that you can u slug: /cloud/tcld toc_max_heading_level: 4 keywords: -- operation-guide -- tcld + - operation-guide + - tcld tags: -- operation-guide -- tcld + - operation-guide + - tcld --- - The Temporal Cloud CLI (tcld) is a command-line tool that you can use to interact with Temporal Cloud. - [How to install tcld](#install-tcld) @@ -79,4 +78,3 @@ brew install temporalio/brew/tcld ```bash tcld version ``` - diff --git a/docs/production-deployment/cloud/tcld/login.mdx b/docs/production-deployment/cloud/tcld/login.mdx index 7c5ea87be1..16c5e9c5c7 100644 --- a/docs/production-deployment/cloud/tcld/login.mdx +++ b/docs/production-deployment/cloud/tcld/login.mdx @@ -6,14 +6,13 @@ description: The Temporal Cloud CLI (tcld) login command logs in a user to Tempo slug: /cloud/tcld/login toc_max_heading_level: 4 keywords: -- cli-reference -- tcld + - cli-reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - The `tcld login` command logs in a user to Temporal Cloud. Follow instructions in the browser to log in to your Temporal account. @@ -23,4 +22,3 @@ Alias: `l` `tcld login` The command has no modifiers. - diff --git a/docs/production-deployment/cloud/tcld/logout.mdx b/docs/production-deployment/cloud/tcld/logout.mdx index 401e088717..5bea2a7e5d 100644 --- a/docs/production-deployment/cloud/tcld/logout.mdx +++ b/docs/production-deployment/cloud/tcld/logout.mdx @@ -6,14 +6,13 @@ description: The Temporal Cloud CLI (tcld) logout command logs a user out of Tem slug: /cloud/tcld/logout/ toc_max_heading_level: 4 keywords: -- cli reference -- tcld + - cli reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - The `tcld logout` command logs a user out of Temporal Cloud. Alias: `lo` @@ -25,4 +24,3 @@ The following modifier controls the behavior of the command. #### --disable-pop-up Disables a browser pop-up if set to `true`. The default value is `false`. - diff --git a/docs/production-deployment/cloud/tcld/namespace.mdx b/docs/production-deployment/cloud/tcld/namespace.mdx index 2b30edb663..4deb47ba2f 100644 --- a/docs/production-deployment/cloud/tcld/namespace.mdx +++ b/docs/production-deployment/cloud/tcld/namespace.mdx @@ -6,14 +6,13 @@ description: The Temporal Cloud CLI (tcld) Namespace commands let you create, co slug: /cloud/tcld/namespace/ toc_max_heading_level: 4 keywords: -- cli reference -- tcld + - cli reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - The `tcld namespace` commands enable [Namespace](/namespaces) operations in Temporal Cloud. Alias: `n` @@ -1371,4 +1370,3 @@ Alias: `--ic` ```bash tcld namespace update-codec-server --namespace --endpoint --include-credentials true ``` - diff --git a/docs/production-deployment/cloud/tcld/request.mdx b/docs/production-deployment/cloud/tcld/request.mdx index a0def0c795..ca6e3e3e21 100644 --- a/docs/production-deployment/cloud/tcld/request.mdx +++ b/docs/production-deployment/cloud/tcld/request.mdx @@ -6,14 +6,13 @@ description: The Temporal Cloud CLI (tcld) request commands manage asynchronous slug: /cloud/tcld/request/ toc_max_heading_level: 4 keywords: -- cli reference -- tcld + - cli reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - The `tcld request` commands manage asynchronous requests in Temporal Cloud. Alias: `r` @@ -53,4 +52,3 @@ Alias: `-r` ```bash tcld namespace get --request-id ``` - diff --git a/docs/production-deployment/cloud/tcld/user.mdx b/docs/production-deployment/cloud/tcld/user.mdx index 6ee8080d28..0ed786438f 100644 --- a/docs/production-deployment/cloud/tcld/user.mdx +++ b/docs/production-deployment/cloud/tcld/user.mdx @@ -6,14 +6,13 @@ description: The Temporal Cloud CLI (tcld) lets you manage users in Temporal Clo slug: /cloud/tcld/user/ toc_max_heading_level: 4 keywords: -- cli reference -- tcld + - cli reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - The `tcld user` commands manage users in Temporal Cloud. Alias: `u` @@ -338,4 +337,3 @@ Each value must be in the format of `namespace=permission-type`. Available namespace permissions: `Admin` | `Write` | `Read`. Alias: `-p` - diff --git a/docs/production-deployment/cloud/tcld/version.mdx b/docs/production-deployment/cloud/tcld/version.mdx index 848b9a94e6..fb86a74c9a 100644 --- a/docs/production-deployment/cloud/tcld/version.mdx +++ b/docs/production-deployment/cloud/tcld/version.mdx @@ -6,14 +6,13 @@ description: The Temporal Cloud CLI (tcld) version command get version informati slug: /cloud/tcld/version/ toc_max_heading_level: 4 keywords: -- cli reference -- tcld + - cli reference + - tcld tags: -- cli-reference -- tcld + - cli-reference + - tcld --- - The `tcld version` command gets version information about tcld. Alias: `v` @@ -21,4 +20,3 @@ Alias: `v` `tcld version` The command has no modifiers. - diff --git a/docs/production-deployment/cloud/terraform-provider.mdx b/docs/production-deployment/cloud/terraform-provider.mdx index e32681e260..3c314fa1b8 100644 --- a/docs/production-deployment/cloud/terraform-provider.mdx +++ b/docs/production-deployment/cloud/terraform-provider.mdx @@ -57,10 +57,10 @@ You can skip generating an API Key if you already possess a valid API Key. 2. Select your account name in the top right corner. 3. Select **API Keys** from the menu. 4. Choose **Create API Key**. - 1. Enter a name for your API Key. - 2. (optional) Provide a description. - 3. Set a duration for the API Key. - 4. Choose **Generate API Key**. +5. Enter a name for your API Key. +6. (optional) Provide a description. +7. Set a duration for the API Key. +8. Choose **Generate API Key**. **Using the tcld** @@ -124,11 +124,11 @@ You must have the Account Role permission set associated with your account to ma ```yml terraform { - required_providers { - temporalcloud = { - source = "temporalio/temporalcloud" - } - } +required_providers { +temporalcloud = { +source = "temporalio/temporalcloud" +} +} } provider "temporalcloud" { @@ -136,10 +136,10 @@ provider "temporalcloud" { } resource "temporalcloud_namespace" "namespace" { - name = "terraform" - regions = ["aws-us-east-1"] - accepted_client_ca = base64encode(file("ca.pem")) - retention_days = 14 +name = "terraform" +regions = ["aws-us-east-1"] +accepted_client_ca = base64encode(file("ca.pem")) +retention_days = 14 } ``` @@ -199,12 +199,12 @@ For example, change the retention period setting in the Terraform file previousl ```yml terraform { - required_providers { - temporalcloud = { - source = "temporalio/temporalcloud" - version = ">= 0.0.6" - } - } +required_providers { +temporalcloud = { +source = "temporalio/temporalcloud" +version = ">= 0.0.6" +} +} } provider "temporalcloud" { @@ -212,10 +212,10 @@ provider "temporalcloud" { } resource "temporalcloud_namespace" "namespace" { - name = "terraform" - regions = ["aws-us-east-1"] - accepted_client_ca = base64encode(file("ca.pem")) - retention_days = 30 +name = "terraform" +regions = ["aws-us-east-1"] +accepted_client_ca = base64encode(file("ca.pem")) +retention_days = 30 } ``` @@ -252,12 +252,12 @@ The following examples create, update, and delete Temporal Cloud Users by using ```yml terraform { - required_providers { - temporalcloud = { - source = "temporalio/temporalcloud" - version = ">= 0.0.6" - } - } +required_providers { +temporalcloud = { +source = "temporalio/temporalcloud" +version = ">= 0.0.6" +} +} } provider "temporalcloud" { @@ -265,26 +265,26 @@ provider "temporalcloud" { } resource "temporalcloud_namespace" "namespace" { - name = "terraform" - regions = ["aws-us-east-1"] - accepted_client_ca = base64encode(file("ca.pem")) - retention_days = 14 +name = "terraform" +regions = ["aws-us-east-1"] +accepted_client_ca = base64encode(file("ca.pem")) +retention_days = 14 } resource "temporalcloud_user" "global_admin" { - email = - account_access = "Admin" +email = +account_access = "Admin" } resource "temporalcloud_user" "namespace_admin" { - email = - account_access = "Developer" - namespace_accesses = [ - { - namespace_id = temporalcloud_namespace.namespace.id - permission = "Write" - } - ] +email = +account_access = "Developer" +namespace_accesses = [ +{ +namespace_id = temporalcloud_namespace.namespace.id +permission = "Write" +} +] } ``` @@ -316,12 +316,12 @@ To delete a User with Terraform, remove the Terraform User resources configurati ```yml terraform { - required_providers { - temporalcloud = { - source = "temporalio/temporalcloud" - version = ">= 0.0.6" - } - } +required_providers { +temporalcloud = { +source = "temporalio/temporalcloud" +version = ">= 0.0.6" +} +} } provider "temporalcloud" { @@ -329,22 +329,21 @@ provider "temporalcloud" { } resource "temporalcloud_namespace" "namespace" { - name = "terraform" - regions = ["aws-us-east-1"] - accepted_client_ca = base64encode(file("ca.pem")) - retention_days = 14 +name = "terraform" +regions = ["aws-us-east-1"] +accepted_client_ca = base64encode(file("ca.pem")) +retention_days = 14 } resource "temporalcloud_user" "global_admin" { - email = - account_access = "Admin" +email = +account_access = "Admin" } resource "temporalcloud_user" "global_admin" { - email = - account_access = "Admin" +email = +account_access = "Admin" } - # resource "temporalcloud_user" "namespace_admin" { # email = # account_access = "Developer" diff --git a/docs/production-deployment/data-encryption.mdx b/docs/production-deployment/data-encryption.mdx index 00be6db1bd..dee91db3a8 100644 --- a/docs/production-deployment/data-encryption.mdx +++ b/docs/production-deployment/data-encryption.mdx @@ -45,7 +45,11 @@ A Payload Codec does byte-to-byte conversion to transform your Payload (for exam

Remote data encoding architecture

- Remote data encoding architecture + Remote data encoding architecture
@@ -240,7 +244,11 @@ On Temporal Cloud and self-hosted Temporal Clusters, you can configure a Codec S

Codec Server endpoint Namespace setting

- Codec Server endpoint Namespace setting + Codec Server endpoint Namespace setting
@@ -262,7 +270,11 @@ You can also override the global Codec Server setting at the browser level. This

Codec Server endpoint browser setting

- Codec Server endpoint browser setting + Codec Server endpoint browser setting
diff --git a/docs/production-deployment/index.mdx b/docs/production-deployment/index.mdx index 193317239c..01e8712de9 100644 --- a/docs/production-deployment/index.mdx +++ b/docs/production-deployment/index.mdx @@ -7,12 +7,11 @@ description: Learn more about how to deploy a Temporal Application to production slug: /production-deployment toc_max_heading_level: 4 keywords: -- production deployment + - production deployment tags: -- production-deployment + - production-deployment --- - **Ready to elevate your durable application into production?** To take your application to production, you deploy your application code, including your Workflows, Activities, and Workers, on your infrastructure using your existing build, test and deploy tools. @@ -26,12 +25,35 @@ You can use Temporal Cloud, a fully-managed platform, or you can self-host the s You can let us handle the operations of running the Temporal Service, and focus on your application. Follow the [Temporal Cloud guide](/cloud) to get started. -

Connect your application instances to Temporal Cloud

Connect your application instances to Temporal Cloud
+
+
+

Connect your application instances to Temporal Cloud

+
+
+ Connect your application instances to Temporal Cloud +
+
## Run a Self-hosted Temporal Service Alternatively, you can run your own production level Temporal Service to orchestrate your durable applications. Follow the [Self-hosted guide](/self-hosted-guide) to get started. -

Connect your application instances to your self-hosted Temporal Service

Connect your application instances to your self-hosted Temporal Service
- +
+
+

+ Connect your application instances to your self-hosted Temporal Service +

+
+
+ Connect your application instances to your self-hosted Temporal Service +
+
diff --git a/docs/production-deployment/migration.mdx b/docs/production-deployment/migration.mdx index a35e714871..2ee349342c 100644 --- a/docs/production-deployment/migration.mdx +++ b/docs/production-deployment/migration.mdx @@ -7,16 +7,15 @@ description: Migrate to Temporal Cloud from a Self-hosted Cluster. slug: /production-deployments/migration toc_max_heading_level: 4 keywords: -- migration -- multi-cluster replication -- temporal cloud + - migration + - multi-cluster replication + - temporal cloud tags: -- migration -- multi-cluster-replication -- temporal-cloud + - migration + - multi-cluster-replication + - temporal-cloud --- - Migrating to Temporal Cloud from a self-hosted Cluster will have different requirements depending on your usage. This guide provides some guidance based on our experience helping customers of all sizes successfully migrate. @@ -95,4 +94,3 @@ The volume of these requests might be high to execute against all the matches to Migrating Execution History from a self-hosted Temporal Cluster to Temporal Cloud is not currently supported. However, a migration tool based on Multi-Cluster Replication, which will enable this, is currently in development for Temporal Cloud. If you have used this feature locally or you are interested in using it to migrate to Temporal Cloud, [create a support ticket](https://docs.temporal.io/cloud/support) or watch this space for more information about public availability. - diff --git a/docs/production-deployment/self-hosted-guide/archival.mdx b/docs/production-deployment/self-hosted-guide/archival.mdx index 5b175dd325..4c86f42884 100644 --- a/docs/production-deployment/self-hosted-guide/archival.mdx +++ b/docs/production-deployment/self-hosted-guide/archival.mdx @@ -7,14 +7,13 @@ description: Learn how to setup the self-hosted Cluster Archival feature. slug: /self-hosted-guide/archival toc_max_heading_level: 4 keywords: -- explanation -- how-to + - explanation + - how-to tags: -- explanation -- how-to + - explanation + - how-to --- - Archival is a feature that automatically backs up [Event Histories](/workflows#event-history) and Visibility records from Temporal Cluster persistence to a custom blob store. - [How to create a custom Archiver](#custom-archiver) @@ -67,15 +66,15 @@ archival: # Event History configuration history: # Archival is enabled at the cluster level - state: "enabled" + state: 'enabled' enableRead: true # Namespaces can use either the local filestore provider or the Google Cloud provider provider: filestore: - fileMode: "0666" - dirMode: "0766" + fileMode: '0666' + dirMode: '0766' gstorage: - credentialsPath: "/tmp/gcloud/keyfile.json" + credentialsPath: '/tmp/gcloud/keyfile.json' # Default values for a Namespace if none are provided at creation namespaceDefaults: @@ -83,9 +82,9 @@ namespaceDefaults: archival: # Event History defaults history: - state: "enabled" + state: 'enabled' # New Namespaces will default to the local provider - URI: "file:///tmp/temporal_archival/development" + URI: 'file:///tmp/temporal_archival/development' ``` You can disable Archival by setting `archival.history.state` and `namespaceDefaults.archival.history.state` to `"disabled"`. @@ -95,12 +94,12 @@ Example: ```yaml archival: history: - state: "disabled" + state: 'disabled' namespaceDefaults: archival: history: - state: "disabled" + state: 'disabled' ``` The following table showcases acceptable values for each configuration and what purpose they serve. @@ -139,6 +138,7 @@ To test Archival locally, start by running a Temporal server: Then register a new Namespace with Archival enabled. + ```bash ./temporal operator namespace create --namespace="my-namespace" --global false --history-archival-state="enabled" --retention="4d" ``` @@ -271,4 +271,3 @@ As for now, try to make your syntax similar to the one used by our advanced list - [s3store](https://github.com/temporalio/temporal/tree/master/common/archiver/s3store#visibility-query-syntax) - [gcloud](https://github.com/temporalio/temporal/tree/master/common/archiver/gcloud#visibility-query-syntax) - diff --git a/docs/production-deployment/self-hosted-guide/checklist.mdx b/docs/production-deployment/self-hosted-guide/checklist.mdx index c047d8d255..54be4ffda9 100644 --- a/docs/production-deployment/self-hosted-guide/checklist.mdx +++ b/docs/production-deployment/self-hosted-guide/checklist.mdx @@ -65,7 +65,9 @@ export async function myWorkflow(foo: string): Promise; ```typescript type MyWorkflowInput = { foo: string }; type MyWorkflowOuptut = { result: string }; -export async function myWorkflow(foo: MyWorkflowInput): Promise; +export async function myWorkflow( + foo: MyWorkflowInput +): Promise; ``` By using this technique, you can add fields in a way that will be compatible with existing [Event Histories](/workflows#event-history) (assuming you use a [Payload Converter](/dataconversion#payload-converter) that can deserialize older [Payloads](/dataconversion#payload), such as JSON). diff --git a/docs/production-deployment/self-hosted-guide/defaults.mdx b/docs/production-deployment/self-hosted-guide/defaults.mdx index 78d1b2236a..039b62a45e 100644 --- a/docs/production-deployment/self-hosted-guide/defaults.mdx +++ b/docs/production-deployment/self-hosted-guide/defaults.mdx @@ -7,16 +7,15 @@ description: Learn about the default limits for self-hosted Temporal Clusters. slug: /self-hosted-guide/defaults toc_max_heading_level: 4 keywords: -- defaults -- limits -- self-hosting + - defaults + - limits + - self-hosting tags: -- defaults -- limits -- self-hosting + - defaults + - limits + - self-hosting --- - :::info Looking for Temporal Cloud defaults? See the [Temporal Cloud defaults and limits page](/cloud/limits) @@ -44,7 +43,7 @@ These limits might apply specifically to each Workflow Execution and do not pert - Temporal errors at 2 MB: `ErrBlobSizeExceedsLimit: Blob data size exceeds limit.` - Refer to [Troubleshoot blob size limit error](/troubleshooting/blob-size-limit-error). - **Workflow Execution Update limits**: - - A single Workflow Execution can have a maximum of 10 in-flight Updates and 2000 total Updates in History. + - A single Workflow Execution can have a maximum of 10 in-flight Updates and 2000 total Updates in History. - **History total size limit** (leading to a terminated Workflow Execution): - Temporal warns at 10 MB: [history size exceeds warn limit](https://github.com/temporalio/temporal/blob/v1.7.0/service/history/workflowExecutionContext.go#L1238). - Temporal errors at 50 MB: [history size exceeds error limit](https://github.com/temporalio/temporal/blob/v1.7.0/service/history/workflowExecutionContext.go#L1204). @@ -71,4 +70,3 @@ These limits might apply specifically to each Workflow Execution and do not pert - [Custom Search Attributes limits](/visibility#custom-search-attributes-limits) For details on dynamic configuration keys, see [Dynamic configuration reference](/references/dynamic-configuration). - diff --git a/docs/production-deployment/self-hosted-guide/index.mdx b/docs/production-deployment/self-hosted-guide/index.mdx index 3a901a0e98..a953c50148 100644 --- a/docs/production-deployment/self-hosted-guide/index.mdx +++ b/docs/production-deployment/self-hosted-guide/index.mdx @@ -7,12 +7,11 @@ description: This guide provides a comprehensive overview to deploy and operate slug: /self-hosted-guide toc_max_heading_level: 4 keywords: -- self-hosted + - self-hosted tags: -- self-hosted + - self-hosted --- - Welcome to the self-hosted Temporal Service guide. This guide shows you how to self-host open source infrastructure software that orchestrates your durable applications. @@ -45,4 +44,3 @@ Check out the [dev guide](/dev-guide) for application development best practices - [Upgrading server](/self-hosted-guide/upgrade-server#upgrade-server) - [Archival](/self-hosted-guide/archival) - [Multi-Cluster Replication](/self-hosted-guide/multi-cluster-replication) - diff --git a/docs/production-deployment/self-hosted-guide/monitoring.mdx b/docs/production-deployment/self-hosted-guide/monitoring.mdx index 94555a46a4..b4c45bb3dd 100644 --- a/docs/production-deployment/self-hosted-guide/monitoring.mdx +++ b/docs/production-deployment/self-hosted-guide/monitoring.mdx @@ -59,7 +59,7 @@ The [docker-compose setup](https://github.com/temporalio/docker-compose/blob/0bc Here’s an example of how to expose a Prometheus endpoint on your local docker-compose Temporal Cluster configuration: ```yaml {20,26} -version: "3.5" +version: '3.5' services: #... diff --git a/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx b/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx index 2f86965a57..9d76fe17de 100644 --- a/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx +++ b/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx @@ -7,18 +7,17 @@ description: Learn how to setup Multi-Cluster Replication. slug: /self-hosted-guide/multi-cluster-replication toc_max_heading_level: 4 keywords: -- cluster -- explanation -- how-to -- term + - cluster + - explanation + - how-to + - term tags: -- cluster -- explanation -- how-to -- term + - cluster + - explanation + - how-to + - term --- - Multi-Cluster Replication is a feature which asynchronously replicates Workflow Executions from active Clusters to other passive Clusters, for backup and state reconstruction. When necessary, for higher availability, Cluster operators can failover to any of the backup Clusters. @@ -507,13 +506,17 @@ clusterMetadata: Then you can use the Temporal CLI tool to add cluster connections. All operations should be executed in both Clusters. + + + + ```shell # Add a cluster temporal operator cluster upsert --frontend_address="127.0.2.1:8233" diff --git a/docs/production-deployment/self-hosted-guide/security.mdx b/docs/production-deployment/self-hosted-guide/security.mdx index d384a4b625..f270c48f5a 100644 --- a/docs/production-deployment/self-hosted-guide/security.mdx +++ b/docs/production-deployment/self-hosted-guide/security.mdx @@ -7,22 +7,21 @@ description: This guide is an overview of the Temporal Platform security feature slug: /self-hosted-guide/security toc_max_heading_level: 4 keywords: -- auth -- developer-guide -- guide-context -- java -- security -- term + - auth + - developer-guide + - guide-context + - java + - security + - term tags: -- auth -- developer-guide -- guide-context -- java -- security -- term + - auth + - developer-guide + - guide-context + - java + - security + - term --- - :::info General company security For information about the general security habits of Temporal Technologies, see our [company security page](/temporal-technologies-inc-security). @@ -307,4 +306,3 @@ You can use a [Codec Server](/dataconversion#codec-server) with your custom Payl However, ensure that you consider all security implications of [remote data encoding](/dataconversion#remote-data-encoding) before using a Codec Server. For details on how to set up a Codec Server, see [Codec Server setup](/production-deployment/data-encryption#codec-server-setup). - diff --git a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx index 4985a7ca36..c9c07f4323 100644 --- a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx +++ b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx @@ -82,7 +82,11 @@ Once inside the evans prompt, you can run commands like `help`, `show service` t

ListWorkflowExecutions

- ListWorkflowExecutions + ListWorkflowExecutions
@@ -93,7 +97,11 @@ One downside compared to [command line](#with-command-line) is it doesn't show e

DescribeTaskQueue

- DescribeTaskQueue + DescribeTaskQueue
diff --git a/docs/production-deployment/self-hosted-guide/upgrade-server.mdx b/docs/production-deployment/self-hosted-guide/upgrade-server.mdx index 4406c54d95..c7833026d9 100644 --- a/docs/production-deployment/self-hosted-guide/upgrade-server.mdx +++ b/docs/production-deployment/self-hosted-guide/upgrade-server.mdx @@ -7,12 +7,11 @@ description: Learn how to keep your Temporal Server up to date. slug: /self-hosted-guide/upgrade-server toc_max_heading_level: 4 keywords: -- how-to + - how-to tags: -- how-to + - how-to --- - ## How to upgrade the Temporal Server version {#upgrade-server} If a newer version of the [Temporal Server](/clusters#temporal-server) is available, a notification appears in the Temporal Web UI. @@ -196,4 +195,3 @@ We recommend preparing a staging Cluster and then do the following to verify the 3. Wait and observe for a few minutes to verify that there is no unstable behavior from both the server and the simulation load logic. 4. Upgrade the server. 5. Now do the same to the live environment cluster. - diff --git a/docs/production-deployment/self-hosted-guide/visibility.mdx b/docs/production-deployment/self-hosted-guide/visibility.mdx index 87d45b382f..d477c55478 100644 --- a/docs/production-deployment/self-hosted-guide/visibility.mdx +++ b/docs/production-deployment/self-hosted-guide/visibility.mdx @@ -7,18 +7,17 @@ description: Learn how to set up the Temporal self-hosted Cluster Visibility fea slug: /self-hosted-guide/visibility toc_max_heading_level: 4 keywords: -- filtered-lists -- guide-context -- operation-guide -- visibility + - filtered-lists + - guide-context + - operation-guide + - visibility tags: -- filtered-lists -- guide-context -- operation-guide -- visibility + - filtered-lists + - guide-context + - operation-guide + - visibility --- - A [Visibility](/clusters#visibility) store is set up as a part of your [Persistence store](/clusters#persistence) to enable listing and filtering details about Workflow Executions that exist on your Temporal Cluster. A Visibility store is required in a Temporal Cluster setup because it is used by Temporal Web UI and CLI to pull Workflow Execution data and enables features like batch operations on a group of Workflow Executions. @@ -62,6 +61,7 @@ For updates, check [Server release notes](https://github.com/temporalio/temporal ## How to set up MySQL Visibility store {#mysql} :::tip Support, stability, and dependency info + - MySQL v5.7 and later. - Support for MySQL v5.7 will be deprecated for all Temporal Server versions after v1.20. - With Temporal Server version 1.20 and later, advanced Visibility is available on MySQL v8.0.17 and later. @@ -90,15 +90,15 @@ persistence: #... mysql-visibility: sql: - pluginName: "mysql8" # For MySQL v8.0.17 and later. For earlier versions, use "mysql" plugin. - databaseName: "temporal_visibility" - connectAddr: " " # Remote address of this database; for example, 127.0.0.0:3306 - connectProtocol: " " # Protocol example: tcp - user: "username_for_auth" - password: "password_for_auth" + pluginName: 'mysql8' # For MySQL v8.0.17 and later. For earlier versions, use "mysql" plugin. + databaseName: 'temporal_visibility' + connectAddr: ' ' # Remote address of this database; for example, 127.0.0.0:3306 + connectProtocol: ' ' # Protocol example: tcp + user: 'username_for_auth' + password: 'password_for_auth' maxConns: 2 maxIdleConns: 2 - maxConnLifetime: "1h" + maxConnLifetime: '1h' #... ``` @@ -151,6 +151,7 @@ Note that the script uses [temporal-sql-tool](https://github.com/temporalio/temp ## How to set up PostgreSQL Visibility store {#postgresql} :::tip Support, stability, and dependency info + - PostgreSQL v9.6 and later. - With Temporal Cluster version 1.20 and later, advanced Visibility is available on PostgreSQL v12 and later. - Support for PostgreSQL v9.6 through v11 will be deprecated for all Temporal Server versions after v1.20; we recommend upgrading to PostgreSQL 12 or later. @@ -179,15 +180,15 @@ persistence: #... postgres-visibility: sql: - pluginName: "postgres12" # For PostgreSQL v12 and later. For earlier versions, use "postgres" plugin. - databaseName: "temporal_visibility" - connectAddr: " " # remote address of this database; for example, 127.0.0.0:5432 - connectProtocol: " " # protocol example: tcp - user: "username_for_auth" - password: "password_for_auth" + pluginName: 'postgres12' # For PostgreSQL v12 and later. For earlier versions, use "postgres" plugin. + databaseName: 'temporal_visibility' + connectAddr: ' ' # remote address of this database; for example, 127.0.0.0:5432 + connectProtocol: ' ' # protocol example: tcp + user: 'username_for_auth' + password: 'password_for_auth' maxConns: 2 maxIdleConns: 2 - maxConnLifetime: "1h" + maxConnLifetime: '1h' #... ``` @@ -233,6 +234,7 @@ Note that the script uses [temporal-sql-tool](https://github.com/temporalio/temp ## How to set up SQLite Visibility store {#sqlite} :::tip Support, stability, and dependency info + - SQLite v3.31.0 and later. ::: @@ -262,25 +264,25 @@ persistence: # ... sqlite-visibility: sql: - user: "username_for_auth" - password: "password_for_auth" - pluginName: "sqlite" - databaseName: "default" - connectAddr: "localhost" - connectProtocol: "tcp" + user: 'username_for_auth' + password: 'password_for_auth' + pluginName: 'sqlite' + databaseName: 'default' + connectAddr: 'localhost' + connectProtocol: 'tcp' connectAttributes: - mode: "memory" - cache: "private" + mode: 'memory' + cache: 'private' maxConns: 1 maxIdleConns: 1 - maxConnLifetime: "1h" + maxConnLifetime: '1h' tls: enabled: false - caFile: "" - certFile: "" - keyFile: "" + caFile: '' + certFile: '' + keyFile: '' enableHostVerification: false - serverName: "" + serverName: '' ``` SQLite (v3.31.0 and later) has advanced Visibility enabled by default. @@ -294,6 +296,7 @@ For an example of setting up the SQLite schema, see [Temporalite](https://github ## How to set up Cassandra Visibility store {#cassandra} :::tip Support, stability, and dependency info + - Support for Cassandra as a Visibility database is deprecated beginning with Temporal Server v1.21. For updates, check the [Temporal Server release notes](https://github.com/temporalio/temporal/releases). - We recommend migrating from Cassandra to any of the other supported databases for Visibility. @@ -326,8 +329,8 @@ persistence: #... cass-visibility: cassandra: - hosts: "127.0.0.1" - keyspace: "temporal_visibility" + hosts: '127.0.0.1' + keyspace: 'temporal_visibility' #... ``` @@ -372,6 +375,7 @@ setup_cassandra_schema() { ## How to integrate Elasticsearch into a Temporal Cluster {#elasticsearch} :::tip Support, stability, and dependency info + - Elasticsearch v8 is supported beginning with Temporal Server version 1.18.0. - Elasticsearch v7.10 is supported beginning with Temporal Server version 1.17.0. - Elasticsearch v6.8 is supported through Temporal Server version 1.17._x_. @@ -463,6 +467,7 @@ Ensure that the following privileges are granted for the Elasticsearch Temporal ## How to set up Dual Visibility {#dual-visibility} :::tip Support, stability, and dependency info + - Supported from Temporal Server v1.21 onwards. ::: @@ -488,16 +493,16 @@ persistence: datastores: cass-visibility: cassandra: - hosts: "127.0.0.1" - keyspace: "temporal_primary_visibility" + hosts: '127.0.0.1' + keyspace: 'temporal_primary_visibility' mysql-visibility: sql: - pluginName: "mysql8" # Verify supported versions. Use a version of SQL that supports advanced Visibility. - databaseName: "temporal_secondary_visibility" - connectAddr: "127.0.0.1:3306" - connectProtocol: "tcp" - user: "temporal" - password: "temporal" + pluginName: 'mysql8' # Verify supported versions. Use a version of SQL that supports advanced Visibility. + databaseName: 'temporal_secondary_visibility' + connectAddr: '127.0.0.1:3306' + connectProtocol: 'tcp' + user: 'temporal' + password: 'temporal' ``` To configure Elasticsearch as both your primary and secondary store, use the configuration key `elasticsearch.indices.secondary_visibility`, as shown in the following example. @@ -508,11 +513,11 @@ persistence: datastores: es-visibility: elasticsearch: - version: "v7" - logLevel: "error" + version: 'v7' + logLevel: 'error' url: - scheme: "http" - host: "127.0.0.1:9200" + scheme: 'http' + host: '127.0.0.1:9200' indices: visibility: temporal_visibility_v1 secondary_visibility: temporal_visibility_v1_new @@ -638,7 +643,7 @@ For example, to enable write operations to both primary and secondary stores, bu ```yaml system.secondaryVisibilityWritingMode: - - value: "dual" + - value: 'dual' constraints: {} system.enableReadFromSecondaryVisibility: - value: false @@ -653,6 +658,7 @@ For details on the configuration options, see: ## How to migrate Visibility database {#migrating-visibility-database} :::tip Support, stability, and dependency info + - Supported beginning with Temporal Server v1.21. ::: @@ -681,15 +687,15 @@ After you make any changes to your [Cluster configuration](/clusters#cluster-con datastores: cass-visibility: cassandra: - hosts: "127.0.0.1" - keyspace: "temporal_visibility" + hosts: '127.0.0.1' + keyspace: 'temporal_visibility' es-visibility: elasticsearch: - version: "v7" - logLevel: "error" + version: 'v7' + logLevel: 'error' url: - scheme: "http" - host: "127.0.0.1:9200" + scheme: 'http' + host: '127.0.0.1:9200' indices: visibility: temporal_visibility_v1_dev closeIdleConnectionsInterval: 15s @@ -758,11 +764,11 @@ When you are ready to deprecate your primary store, follow these steps. datastores: es-visibility: elasticsearch: - version: "v7" - logLevel: "error" + version: 'v7' + logLevel: 'error' url: - scheme: "http" - host: "127.0.0.1:9200" + scheme: 'http' + host: '127.0.0.1:9200' indices: visibility: temporal_visibility_v1_dev closeIdleConnectionsInterval: 15s @@ -805,7 +811,7 @@ temporal operator search-attribute create --name="CustomSA" --type="Keyword"` ``` Note that if you use a SQL database with advanced Visibility capabilities, you are required to specify a Namespace when creating a custom Search Attribute. -For example: +For example: ``` temporal operator search-attribute create --name="CustomSA" --type="Keyword" --namespace="yournamespace" @@ -841,6 +847,7 @@ Note that this script has been updated for Temporal Server v1.20, which requires For Temporal Server v1.19 and earlier, or if using Elasticsearch for advanced Visibility, you can create custom Search Attributes without a Namespace association, as shown in the following example. + ```bash add_custom_search_attributes() { echo "Adding Custom*Field search attributes." @@ -865,6 +872,7 @@ Removing Search Attributes is not supported on Temporal Cloud. For example, if using Elasticsearch for advanced Visibility, to remove a custom Search Attribute called `CustomSA` of type Keyword use the following command: + ``` temporal attribute search-attribute remove --name="CustomSA" ``` @@ -872,11 +880,12 @@ temporal attribute search-attribute remove --name="CustomSA" With Temporal Server v1.20, if using a SQL database for advanced Visibility, you need to specify the Namespace in your command, as shown in the following command: -```` + +``` temporal attribute search-attribute remove --name="CustomSA" --namespace="SomeNamespace" -```` +``` -To check whether the Search Attribute was removed, run +To check whether the Search Attribute was removed, run ``` temporal operator search-attribute list @@ -885,7 +894,7 @@ temporal operator search-attribute list and check the list. If you're on Temporal Server v1.20 and later, specify the Namespace from which you removed the Search Attribute. -For example, +For example, ``` temporal search-attribute list --namespace="yournamespace" @@ -896,5 +905,3 @@ Removing this custom Search Attribute removes the mapping with the database fiel If you remove a custom Search Attribute and add a new one, the new custom Search Attribute might be mapped to the database field of the one that was recently removed. This might cause unexpected results when you use the List API to retrieve results using the new custom Search Attribute. These constraints do not apply if you use Elasticsearch. - - diff --git a/docs/references/configuration.mdx b/docs/references/configuration.mdx index 2b1f34a09e..9cf2e71d92 100644 --- a/docs/references/configuration.mdx +++ b/docs/references/configuration.mdx @@ -5,12 +5,11 @@ sidebar_label: Cluster configuration description: Much of the behavior of a Temporal Cluster is configured using the `development.yaml` file. toc_max_heading_level: 4 keywords: -- reference + - reference tags: -- reference + - reference --- - Much of the behavior of a Temporal Cluster is configured using the `development.yaml` file and may contain the following top-level sections: - [`global`](#global) @@ -34,11 +33,11 @@ The `global` section contains process-wide configuration. See below for a minima ```yaml global: membership: - broadcastAddress: "127.0.0.1" + broadcastAddress: '127.0.0.1' metrics: prometheus: - framework: "tally" - listenAddress: "127.0.0.1:8000" + framework: 'tally' + listenAddress: '127.0.0.1:8000' ``` ### membership @@ -219,21 +218,21 @@ persistence: datastores: default: cassandra: - hosts: "127.0.0.1" - keyspace: "temporal" - user: "username" - password: "password" + hosts: '127.0.0.1' + keyspace: 'temporal' + user: 'username' + password: 'password' cass-visibility: cassandra: - hosts: "127.0.0.1" - keyspace: "temporal_visibility" + hosts: '127.0.0.1' + keyspace: 'temporal_visibility' es-visibility: elasticsearch: - version: "v7" - logLevel: "error" + version: 'v7' + logLevel: 'error' url: - scheme: "http" - host: "127.0.0.1:9200" + scheme: 'http' + host: '127.0.0.1:9200' indices: visibility: temporal_visibility_v1_dev closeIdleConnectionsInterval: 15s @@ -331,13 +330,13 @@ An example `clusterMetadata` section: clusterMetadata: enableGlobalNamespace: true failoverVersionIncrement: 10 - masterClusterName: "active" - currentClusterName: "active" + masterClusterName: 'active' + currentClusterName: 'active' clusterInformation: active: enabled: true initialFailoverVersion: 0 - rpcAddress: "127.0.0.1:7233" + rpcAddress: '127.0.0.1:7233' #replicationConsumer: #type: kafka ``` @@ -370,7 +369,7 @@ services: rpc: grpcPort: 8233 membershipPort: 8933 - bindOnIP: "0.0.0.0" + bindOnIP: '0.0.0.0' ``` There are two sections defined under each service heading: @@ -401,7 +400,7 @@ Example: ```yaml publicClient: - hostPort: "localhost:8933" + hostPort: 'localhost:8933' ``` Use `dns:///` prefix to enable round-robin between IP address for DNS name. @@ -431,24 +430,24 @@ Example: # Event History configuration history: # Archival is enabled for the History Service data. - state: "enabled" + state: 'enabled' enableRead: true # Namespaces can use either the local filestore provider or the Google Cloud provider. provider: filestore: - fileMode: "0666" - dirMode: "0766" + fileMode: '0666' + dirMode: '0766' gstorage: - credentialsPath: "/tmp/gcloud/keyfile.json" + credentialsPath: '/tmp/gcloud/keyfile.json' # Configuration for archiving Visibility data. visibility: # Archival is enabled for Visibility data. - state: "enabled" + state: 'enabled' enableRead: true provider: filestore: - fileMode: "0666" - dirMode: "0766" + fileMode: '0666' + dirMode: '0766' ``` - To disable Archival in your Cluster configuration: @@ -457,18 +456,18 @@ Example: # Cluster-level Archival config disabled archival: history: - state: "disabled" + state: 'disabled' enableRead: false visibility: - state: "disabled" + state: 'disabled' enableRead: false namespaceDefaults: archival: history: - state: "disabled" + state: 'disabled' visibility: - state: "disabled" + state: 'disabled' ``` For more details on Archival setup, see [Set up Archival](/self-hosted-guide/archival#set-up-archival). @@ -493,12 +492,12 @@ namespaceDefaults: archival: # Event History defaults. history: - state: "enabled" + state: 'enabled' # New Namespaces will default to the local provider. - URI: "file:///tmp/temporal_archival/development" + URI: 'file:///tmp/temporal_archival/development' visibility: - state: "disabled" - URI: "file:///tmp/temporal_vis_archival/development" + state: 'disabled' + URI: 'file:///tmp/temporal_vis_archival/development' ``` ## dcRedirectionPolicy @@ -525,7 +524,7 @@ Example: ```yaml #... dcRedirectionPolicy: - policy: "selected-apis-forwarding" + policy: 'selected-apis-forwarding' #... ``` @@ -544,7 +543,6 @@ Example: ```yaml dynamicConfigClient: - filepath: "config/dynamicconfig/development-cass.yaml" - pollInterval: "10s" + filepath: 'config/dynamicconfig/development-cass.yaml' + pollInterval: '10s' ``` - diff --git a/docs/references/dynamic-configuration.mdx b/docs/references/dynamic-configuration.mdx index b9d4d3f024..b4d1ebfb6e 100644 --- a/docs/references/dynamic-configuration.mdx +++ b/docs/references/dynamic-configuration.mdx @@ -5,12 +5,11 @@ sidebar_label: Dynamic configuration description: Temporal Cluster provides dynamic configuration keys that you can update and apply to a running Cluster without restarting your services. toc_max_heading_level: 4 keywords: -- reference + - reference tags: -- reference + - reference --- - Temporal Cluster provides [dynamic configuration](/clusters#dynamic-configuration) keys that you can update and apply to a running Cluster without restarting your services. The dynamic configuration keys are set with default values when you create your Cluster configuration. @@ -40,23 +39,23 @@ testGetBoolPropertyKey: - value: false - value: true constraints: - namespace: "your-namespace" + namespace: 'your-namespace' - value: false constraints: - namespace: "your-other-namespace" + namespace: 'your-other-namespace' testGetDurationPropertyKey: - - value: "1m" + - value: '1m' constraints: - namespace: "your-namespace" - taskQueueName: "longIdleTimeTaskqueue" + namespace: 'your-namespace' + taskQueueName: 'longIdleTimeTaskqueue' testGetFloat64PropertyKey: - value: 12.0 constraints: - namespace: "your-namespace" + namespace: 'your-namespace' testGetMapPropertyKey: - value: key1: 1 - key2: "value 2" + key2: 'value 2' key3: - false - key4: true @@ -82,9 +81,9 @@ Not defining constraints on a dynamic configuration key sets the values across t frontend.persistenceNamespaceMaxQPS: # Rate limit on the number of queries the Frontend sends to the Persistence store. - constraints: {} # Sets default value that applies to all Namespaces value: 2000 # The default value for this key is 0. - - constraints: { namespace: "namespace1" } # Sets limit on number of queries that can be sent from "namespace1" Namespace to the Persistence store. + - constraints: { namespace: 'namespace1' } # Sets limit on number of queries that can be sent from "namespace1" Namespace to the Persistence store. value: 4000 - - constraints: { namespace: "namespace2" } + - constraints: { namespace: 'namespace2' } value: 1000 ``` @@ -97,20 +96,28 @@ Not defining constraints on a dynamic configuration key sets the values across t ```yaml matching.numTaskqueueReadPartitions: # Number of Task Queue partitions for read operations. - - constraints: { namespace: "namespace1", taskQueueName: "tq" } # Applies to the "tq" Task Queue for both Workflows and Activities. + - constraints: { namespace: 'namespace1', taskQueueName: 'tq' } # Applies to the "tq" Task Queue for both Workflows and Activities. value: 8 # The default value for this key is 4. Task Queues that need to support high traffic require higher number of partitions. Set these values in accordance to your poller count. - - constraints: { namespace: "namespace1", taskQueueName: "other-tq", taskType: "Activity" } # Applies to the "other_tq" Task Queue for Activities specifically. + - constraints: { + namespace: 'namespace1', + taskQueueName: 'other-tq', + taskType: 'Activity', + } # Applies to the "other_tq" Task Queue for Activities specifically. value: 20 - - constraints: { namespace: "namespace2" } # Applies to all task queues in "namespace2". + - constraints: { namespace: 'namespace2' } # Applies to all task queues in "namespace2". value: 10 - constraints: {} # Applies to all other task queues in "namespace1" and all other Namespaces. value: 16 matching.numTaskqueueWritePartitions: # Number of Task Queue partitions for write operations. - - constraints: { namespace: "namespace1", taskQueueName: "tq" } # Applies to the "tq" Task Queue for both Workflows and Activities. + - constraints: { namespace: 'namespace1', taskQueueName: 'tq' } # Applies to the "tq" Task Queue for both Workflows and Activities. value: 8 # The default value for this key is 4. Task Queues that need to support high traffic require higher number of partitions. Set these values in accordance to your poller count. - - constraints: { namespace: "namespace1", taskQueueName: "other-tq", taskType: "Activity" } # Applies to the "other_tq" Task Queue for Activities specifically. + - constraints: { + namespace: 'namespace1', + taskQueueName: 'other-tq', + taskType: 'Activity', + } # Applies to the "other_tq" Task Queue for Activities specifically. value: 20 - - constraints: { namespace: "namespace2" } # Applies to all task queues in "namespace2". + - constraints: { namespace: 'namespace2' } # Applies to all task queues in "namespace2". value: 10 - constraints: {} # Applies to all other task queues in "namespace1" and all other Namespaces. value: 16 @@ -224,4 +231,3 @@ This can be useful when migrating a Visibility database or creating a backup Vis | ------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | | `system.enableReadFromSecondaryVisibility` | Boolean | Enables reading from the [secondary Visibility store](/visibility#dual-visibility), and can be set per Namespace. Allowed values are `true` or `false`. | `false` | | `system.secondaryVisibilityWritingMode` | | Enables writing Visibility data to the secondary Visibility store and can be set per Namespace. Setting this value to `on` disables write operations to the primary Visibility store. Allowed values:
`off`: Enables writing to primary Visibility store only.
`on`: Enables writing to secondary Visibility store only.
`dual`: Enables writing to both primary and secondary Visibility stores. | `off` | - diff --git a/docs/references/failures.mdx b/docs/references/failures.mdx index 1223ee001d..8acd6f2e49 100644 --- a/docs/references/failures.mdx +++ b/docs/references/failures.mdx @@ -5,16 +5,15 @@ sidebar_label: Failures description: A Failure is Temporal's representation of various types of errors that occur in the system. toc_max_heading_level: 4 keywords: -- explanation -- failure -- term + - explanation + - failure + - term tags: -- explanation -- failure -- term + - explanation + - failure + - term --- - A Failure is Temporal's representation of various types of errors that occur in the system. There are different types of Failures, and each has a different type in the SDKs and different information in the protobuf messages (which are used to communicate with the Temporal Cluster and appear in [Event History](/workflows#event-history)). @@ -165,4 +164,3 @@ A Server Failure is used for errors that originate in the Cluster. - Go: [ServerError](https://pkg.go.dev/go.temporal.io/sdk/temporal#ServerError) - Python: [ServerError](https://python.temporal.io/temporalio.exceptions.ServerError.html) - Proto: [ServerFailureInfo](https://api-docs.temporal.io/#temporal.api.failure.v1.ServerFailureInfo) and [Failure](https://api-docs.temporal.io/#temporal.api.failure.v1.Failure) - diff --git a/docs/references/server-options.mdx b/docs/references/server-options.mdx index 1657a99306..53e3165ca1 100644 --- a/docs/references/server-options.mdx +++ b/docs/references/server-options.mdx @@ -5,14 +5,13 @@ sidebar_label: Server options description: You can run the Temporal Server as a Go application by including the server package `go.temporal.io/server/temporal` and using it to create and start a Temporal Server. toc_max_heading_level: 4 keywords: -- reference -- web-ui + - reference + - web-ui tags: -- reference -- web-ui + - reference + - web-ui --- - You can run the [Temporal Server](/clusters#temporal-server) as a Go application by including the server package `go.temporal.io/server/temporal` and using it to create and start a Temporal Server. The Temporal Server services can be run in various ways. @@ -123,4 +122,3 @@ s := temporal.NewServer( ``` You can see the [Uber tally docs on custom reporter](https://github.com/uber-go/tally#report-your-metrics) and see a community implementation of [a reporter for Datadog's `dogstatsd` format](https://github.com/temporalio/temporal/pull/998#issuecomment-857884983). - diff --git a/docs/references/web-ui-configuration.mdx b/docs/references/web-ui-configuration.mdx index 0f979a684b..56c3523cf1 100644 --- a/docs/references/web-ui-configuration.mdx +++ b/docs/references/web-ui-configuration.mdx @@ -5,14 +5,13 @@ sidebar_label: Web UI config description: The Temporal Web UI Server uses a configuration file for many of the UI's settings. toc_max_heading_level: 4 keywords: -- reference -- web-ui + - reference + - web-ui tags: -- reference -- web-ui + - reference + - web-ui --- - The Temporal Web UI Server uses a configuration file for many of the UI's settings. An example development.yaml file can be found in the [temporalio/ui-server repo](https://github.com/temporalio/ui-server/blob/main/config/development.yaml). @@ -42,7 +41,7 @@ port: 8080 The path used by the Temporal Web UI Server and any APIs. ```yaml -publicPath: "" +publicPath: '' ``` ## enableUi @@ -251,4 +250,3 @@ Configures headers for forwarding. forwardHeaders: - ``` - diff --git a/docs/references/web-ui-environment-variables.mdx b/docs/references/web-ui-environment-variables.mdx index 4d84a2b92b..893e76d11c 100644 --- a/docs/references/web-ui-environment-variables.mdx +++ b/docs/references/web-ui-environment-variables.mdx @@ -5,18 +5,17 @@ sidebar_label: Web UI env vars description: How to set environmental variables for Temporal Web UI. toc_max_heading_level: 4 keywords: -- docker -- reference -- ui server -- webui + - docker + - reference + - ui server + - webui tags: -- docker -- reference -- ui-server -- webui + - docker + - reference + - ui-server + - webui --- - You can use environment variables to dynamically alter the configuration of your Temporal Web UI. These can be used in many environments such as Docker. @@ -200,4 +199,3 @@ Forward-specified HTTP headers to direct from HTTP API requests to the Temporal ## `TEMPORAL_DISABLE_WRITE_ACTIONS` Disables any button in the UI that allows the user to modify Workflows or Activities. - diff --git a/docs/references/web-ui-server-env-vars.mdx b/docs/references/web-ui-server-env-vars.mdx index a67a1b01e7..834d16e4be 100644 --- a/docs/references/web-ui-server-env-vars.mdx +++ b/docs/references/web-ui-server-env-vars.mdx @@ -5,16 +5,15 @@ sidebar_label: Web UI Docker env vars description: How to set the docker environmental variables quickly. toc_max_heading_level: 4 keywords: -- docker -- reference -- webui + - docker + - reference + - webui tags: -- docker -- reference -- webui + - docker + - reference + - webui --- - Docker containers can be configured for use in a production setting. Use `docker run` to configure the Web UI environmental variables. @@ -55,4 +54,3 @@ The environmental variables are defined below: - `TEMPORAL_TLS_KEY` : TLS key path. - `TEMPORAL_TLS_ENABLE_HOST_VERIFICATION` : enable or disable TLS host verification. - `TEMPORAL_TLS_SERVER_NAME` : TLS server name. - diff --git a/docs/troubleshooting/blob-size-limit-error.mdx b/docs/troubleshooting/blob-size-limit-error.mdx index 6569274535..08b3cd74c0 100644 --- a/docs/troubleshooting/blob-size-limit-error.mdx +++ b/docs/troubleshooting/blob-size-limit-error.mdx @@ -5,11 +5,11 @@ sidebar_label: Blob size limit error description: Blob size limit error occur as a result of sending a large payload to Temporal. toc_max_heading_level: 4 keywords: -- error -- troubleshooting + - error + - troubleshooting tags: -- error -- troubleshooting + - error + - troubleshooting --- The `BlobSizeLimitError` is an error that occurs when the size of a blob (payloads including Workflow context and each Workflow and Activity argument and return value) exceeds the set limit in Temporal. @@ -30,9 +30,11 @@ To resolve this error, reduce the size of the blob so that it is within the 4 MB There are multiple strategies you can use to avoid this error: 1. Use compression with a [custom payload codec](/dataconversion#payload-codec) for large payloads. + - This addresses the immediate issue of the blob size limit; however, if blob sizes continue to grow this problem can arise again. 2. Break larger batches of commands into smaller batch sizes: + - Workflow-level batching: 1. Modify the Workflow to process Activities or Child Workflows into smaller batches. 2. Iterate through each batch, waiting for completion before moving to the next. diff --git a/docs/troubleshooting/deadline-exceeded-error.mdx b/docs/troubleshooting/deadline-exceeded-error.mdx index bc6dbfbfb6..19976967a5 100644 --- a/docs/troubleshooting/deadline-exceeded-error.mdx +++ b/docs/troubleshooting/deadline-exceeded-error.mdx @@ -5,14 +5,13 @@ sidebar_label: Deadline-exceeded error description: Deadline exceeded errors occur as a result of Temporal frontend requests failing. This guide provides troubleshooting solutions. toc_max_heading_level: 4 keywords: -- error -- troubleshooting + - error + - troubleshooting tags: -- error -- troubleshooting + - error + - troubleshooting --- - All requests made to the [Temporal Cluster](/clusters) by the Client or Worker are [gRPC requests](https://grpc.io/docs/what-is-grpc/core-concepts/#deadlines). Sometimes, when these frontend requests can't be completed, you'll see this particular error message: `Context: deadline exceeded`. Network interruptions, timeouts, server overload, and Query errors are some of the causes of this error. @@ -124,4 +123,3 @@ Still unable to resolve your issue? - If you use Temporal Cloud, create a [support ticket](/cloud/support#support-ticket). - If you use our open source software or Temporal Cloud, check for similar questions and possible solutions in our [community forum](https://community.temporal.io) or [community Slack](https://temporal.io/slack). - diff --git a/docs/troubleshooting/last-connection-error.mdx b/docs/troubleshooting/last-connection-error.mdx index b71cea9299..12332f769f 100644 --- a/docs/troubleshooting/last-connection-error.mdx +++ b/docs/troubleshooting/last-connection-error.mdx @@ -5,14 +5,13 @@ sidebar_label: Failed reaching server error description: Failed reaching server errors can result from expired certificates. This guide provides troubleshooting solutions. toc_max_heading_level: 4 keywords: -- cloud -- namespaces + - cloud + - namespaces tags: -- cloud -- namespaces + - cloud + - namespaces --- - The message `Failed reaching server: last connection error` can often result from an expired TLS certificate or during the Server startup process, in which the Client requests reach the Server before the roles are fully initialized. This troubleshooting guide shows you how to do the following: diff --git a/docs/web-ui.mdx b/docs/web-ui.mdx index 0b5b093aef..e04b757f3c 100644 --- a/docs/web-ui.mdx +++ b/docs/web-ui.mdx @@ -6,14 +6,13 @@ sidebar_label: Web UI description: Explore the intuitive web user interface (Web UI) for Temporal. Seamlessly monitor and manage your Namespaces, Workflows, Schedules, and other settings. toc_max_heading_level: 4 keywords: -- term -- web-ui + - term + - web-ui tags: -- term -- web-ui + - term + - web-ui --- - The Temporal Web UI provides users with Workflow Execution state and metadata for debugging purposes. It ships with every [Temporal CLI](/cli) release and [Docker Compose](https://github.com/temporalio/docker-compose) update and is available with [Temporal Cloud](/cloud). @@ -161,4 +160,3 @@ The Web UI provides a "labs" mode for users to try out upcoming, production-read When off, users will experience the current UI. Features will move in and out of labs mode according to demand and feedback. Labs mode can be turned on or off at any time in the left navigation bar via the Labs icon. - diff --git a/dprint.json b/dprint.json index 1be0db918a..9789822a68 100644 --- a/dprint.json +++ b/dprint.json @@ -32,8 +32,7 @@ "useTabs": false }, "includes": [ - "docs-src/**/*.{md}", - "website/docs/dev-guide/**/*.md", + "docs/**/*.{mdx}", "vercel.json" ], "excludes": [ From 0ccfb8f15e4f186808d42f43eda062925a2982b2 Mon Sep 17 00:00:00 2001 From: rachfop Date: Wed, 8 May 2024 12:54:45 -0700 Subject: [PATCH 06/26] stuff --- docs/cli/index.mdx | 1 - docs/dev-guide/golang/cancellation.mdx | 1 - docs/dev-guide/golang/converters.mdx | 1 - docs/dev-guide/golang/debugging.mdx | 1 - docs/dev-guide/golang/durable-execution.mdx | 1 - docs/dev-guide/golang/features.mdx | 1 - docs/dev-guide/golang/foundations.mdx | 1 - docs/dev-guide/golang/index.mdx | 1 - docs/dev-guide/golang/introduction.mdx | 1 - docs/dev-guide/golang/observability.mdx | 1 - docs/dev-guide/golang/project-setup.mdx | 1 - docs/dev-guide/golang/testing.mdx | 1 - docs/dev-guide/golang/versioning.mdx | 1 - docs/dev-guide/javalang/converters.mdx | 1 - docs/dev-guide/javalang/debugging.mdx | 1 - docs/dev-guide/javalang/durable-execution.mdx | 1 - docs/dev-guide/javalang/features.mdx | 1 - docs/dev-guide/javalang/foundations.mdx | 1 - docs/dev-guide/javalang/index.mdx | 1 - docs/dev-guide/javalang/introduction.mdx | 1 - docs/dev-guide/javalang/observability.mdx | 1 - docs/dev-guide/javalang/project-setup.mdx | 1 - docs/dev-guide/javalang/testing.mdx | 1 - docs/dev-guide/javalang/versioning.mdx | 1 - docs/dev-guide/phplang/debugging.mdx | 1 - docs/dev-guide/phplang/features.mdx | 1 - docs/dev-guide/phplang/foundations.mdx | 1 - docs/dev-guide/phplang/index.mdx | 1 - docs/dev-guide/phplang/observability.mdx | 1 - docs/dev-guide/phplang/testing.mdx | 1 - docs/dev-guide/python/index.mdx | 1 - docs/dev-guide/python/introduction.mdx | 1 - docs/dev-guide/tscript/debugging.mdx | 1 - docs/dev-guide/tscript/features.mdx | 1 - docs/dev-guide/tscript/foundations.mdx | 1 - docs/dev-guide/tscript/index.mdx | 1 - docs/dev-guide/tscript/introduction.mdx | 1 - docs/dev-guide/tscript/observability.mdx | 1 - docs/dev-guide/tscript/project-setup.mdx | 1 - docs/dev-guide/tscript/testing.mdx | 1 - docs/dev-guide/tscript/versioning.mdx | 1 - docs/encyclopedia/activities.mdx | 1 - docs/encyclopedia/clusters.mdx | 1 - docs/encyclopedia/dataconversion.mdx | 1 - docs/encyclopedia/namespaces.mdx | 1 - docs/encyclopedia/retry-policies.mdx | 1 - docs/encyclopedia/temporal-sdks.mdx | 1 - docs/encyclopedia/temporal.mdx | 1 - docs/encyclopedia/visibility.mdx | 1 - docs/encyclopedia/workers.mdx | 1 - docs/encyclopedia/workflows.mdx | 1 - docs/evaluate/index.mdx | 1 - docs/evaluate/release-stages.mdx | 1 - docs/evaluate/why-temporal.mdx | 2 -- docs/getting-started.mdx | 1 - docs/production-deployment/cloud/account-setup/certificates.mdx | 1 - docs/production-deployment/cloud/account-setup/index.mdx | 1 - docs/production-deployment/cloud/account-setup/namespaces.mdx | 1 - docs/production-deployment/cloud/account-setup/users.mdx | 1 - docs/production-deployment/cloud/api-keys.mdx | 1 - docs/production-deployment/cloud/audit-logging.mdx | 1 - docs/production-deployment/cloud/export.mdx | 1 - docs/production-deployment/cloud/get-started.mdx | 1 - docs/production-deployment/cloud/index.mdx | 1 - docs/production-deployment/cloud/introduction/index.mdx | 1 - docs/production-deployment/cloud/introduction/limits.mdx | 1 - docs/production-deployment/cloud/introduction/overview.mdx | 1 - docs/production-deployment/cloud/introduction/pricing.mdx | 1 - docs/production-deployment/cloud/introduction/security.mdx | 1 - .../cloud/introduction/service-availability.mdx | 1 - docs/production-deployment/cloud/introduction/sla.mdx | 1 - docs/production-deployment/cloud/introduction/support.mdx | 1 - docs/production-deployment/cloud/metrics/index.mdx | 1 - docs/production-deployment/cloud/operation-api.mdx | 1 - docs/production-deployment/cloud/saml.mdx | 1 - docs/production-deployment/cloud/terraform-provider.mdx | 1 - docs/production-deployment/data-encryption.mdx | 1 - docs/production-deployment/index.mdx | 1 - docs/production-deployment/migration.mdx | 1 - docs/production-deployment/self-hosted-guide/archival.mdx | 1 - docs/production-deployment/self-hosted-guide/checklist.mdx | 1 - docs/production-deployment/self-hosted-guide/defaults.mdx | 1 - docs/production-deployment/self-hosted-guide/index.mdx | 1 - docs/production-deployment/self-hosted-guide/monitoring.mdx | 1 - .../self-hosted-guide/multi-cluster-replication.mdx | 1 - docs/production-deployment/self-hosted-guide/security.mdx | 1 - .../self-hosted-guide/server-frontend-api-reference.mdx | 1 - docs/production-deployment/self-hosted-guide/setup.mdx | 1 - docs/production-deployment/self-hosted-guide/upgrade-server.mdx | 1 - docs/production-deployment/self-hosted-guide/visibility.mdx | 1 - docs/references/index.mdx | 1 - docs/security.mdx | 1 - docs/tctl-v1/index.mdx | 1 - docs/troubleshooting/index.mdx | 1 - docs/web-ui.mdx | 1 - 95 files changed, 96 deletions(-) diff --git a/docs/cli/index.mdx b/docs/cli/index.mdx index ab67e20f50..5838fb751f 100644 --- a/docs/cli/index.mdx +++ b/docs/cli/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal CLI command reference sidebar_label: Temporal CLI - description: Discover the Temporal Command Line Interface (CLI) documentation. Navigate, configure, and utilize the Temporal CLI effectively. slug: /cli toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/cancellation.mdx b/docs/dev-guide/golang/cancellation.mdx index c5220557a2..d7bf846bec 100644 --- a/docs/dev-guide/golang/cancellation.mdx +++ b/docs/dev-guide/golang/cancellation.mdx @@ -2,7 +2,6 @@ id: cancellation title: Cancellation - Go SDK feature guide sidebar_label: Cancellation - description: How to cancel a Workflow Execution and it's Activities using the Go SDK. slug: /dev-guide/go/cancellation toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/converters.mdx b/docs/dev-guide/golang/converters.mdx index 1064b96003..d9db1b881b 100644 --- a/docs/dev-guide/golang/converters.mdx +++ b/docs/dev-guide/golang/converters.mdx @@ -2,7 +2,6 @@ id: converters title: Converters and Codecs - Go SDK feature guide sidebar_label: Converters and Codecs - description: The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. slug: /dev-guide/go/converters toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/debugging.mdx b/docs/dev-guide/golang/debugging.mdx index 97a4498c48..7d90483405 100644 --- a/docs/dev-guide/golang/debugging.mdx +++ b/docs/dev-guide/golang/debugging.mdx @@ -2,7 +2,6 @@ id: debugging title: Debugging - Go SDK feature guide sidebar_label: Debugging - description: The Debugging section of the Temporal Go SDK Developer's guide covers the many ways to debug your application. slug: /dev-guide/go/debugging toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/durable-execution.mdx b/docs/dev-guide/golang/durable-execution.mdx index 744b35dffa..f5d420c3bb 100644 --- a/docs/dev-guide/golang/durable-execution.mdx +++ b/docs/dev-guide/golang/durable-execution.mdx @@ -2,7 +2,6 @@ id: durable-execution title: Develop code that durably executes - Go SDK dev guide sidebar_label: Develop for durability - description: The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. slug: /dev-guide/go/durable-execution toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/features.mdx b/docs/dev-guide/golang/features.mdx index c5a379d4cc..57aba590e2 100644 --- a/docs/dev-guide/golang/features.mdx +++ b/docs/dev-guide/golang/features.mdx @@ -2,7 +2,6 @@ id: features title: Features - Go SDK feature guide sidebar_label: Features - description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. slug: /dev-guide/go/features toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/foundations.mdx b/docs/dev-guide/golang/foundations.mdx index 76edcd94fc..72d493ec73 100644 --- a/docs/dev-guide/golang/foundations.mdx +++ b/docs/dev-guide/golang/foundations.mdx @@ -2,7 +2,6 @@ id: foundations title: Foundations - Go SDK feature guide sidebar_label: Foundations - description: The Foundations section of the Temporal Go SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in Go – that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/go/foundations toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/index.mdx b/docs/dev-guide/golang/index.mdx index 754a65fbe7..11a0a45fd1 100644 --- a/docs/dev-guide/golang/index.mdx +++ b/docs/dev-guide/golang/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal Go SDK development documentation sidebar_label: Go SDK - description: Learn how to use the Temporal Go SDK. slug: /dev-guide/go toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/introduction.mdx b/docs/dev-guide/golang/introduction.mdx index c9fa4c45ca..d4975dc560 100644 --- a/docs/dev-guide/golang/introduction.mdx +++ b/docs/dev-guide/golang/introduction.mdx @@ -2,7 +2,6 @@ id: introduction title: Introduction to the Temporal Go SDK sidebar_label: Introduction - description: Learn more about Temporal Go SDK. slug: /dev-guide/go/introduction toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/observability.mdx b/docs/dev-guide/golang/observability.mdx index b5334cfbbe..0810b23b38 100644 --- a/docs/dev-guide/golang/observability.mdx +++ b/docs/dev-guide/golang/observability.mdx @@ -2,7 +2,6 @@ id: observability title: Observability - Go SDK feature guide sidebar_label: Observability - description: Improve observability in your Go-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. slug: /dev-guide/go/observability toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/project-setup.mdx b/docs/dev-guide/golang/project-setup.mdx index 540741c250..268457375b 100644 --- a/docs/dev-guide/golang/project-setup.mdx +++ b/docs/dev-guide/golang/project-setup.mdx @@ -2,7 +2,6 @@ id: project-setup title: Set up a Temporal Application project - Go SDK dev guide sidebar_label: Project setup - description: The project setup section of the Temporal Go SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in Go—that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/go/project-setup toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/testing.mdx b/docs/dev-guide/golang/testing.mdx index 4547652131..c53e986876 100644 --- a/docs/dev-guide/golang/testing.mdx +++ b/docs/dev-guide/golang/testing.mdx @@ -2,7 +2,6 @@ id: testing title: Testing - Go SDK feature guide sidebar_label: Testing - description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. slug: /dev-guide/go/testing toc_max_heading_level: 4 diff --git a/docs/dev-guide/golang/versioning.mdx b/docs/dev-guide/golang/versioning.mdx index e5cf508875..79b30aa700 100644 --- a/docs/dev-guide/golang/versioning.mdx +++ b/docs/dev-guide/golang/versioning.mdx @@ -2,7 +2,6 @@ id: versioning title: Versioning - Go SDK feature guide sidebar_label: Versioning - description: The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. slug: /dev-guide/go/versioning toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/converters.mdx b/docs/dev-guide/javalang/converters.mdx index 95695078b6..a2f81d2c6c 100644 --- a/docs/dev-guide/javalang/converters.mdx +++ b/docs/dev-guide/javalang/converters.mdx @@ -2,7 +2,6 @@ id: converters title: Converters and Codecs - Java SDK feature guide sidebar_label: Converters and Codecs - description: The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. slug: /dev-guide/java/converters toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/debugging.mdx b/docs/dev-guide/javalang/debugging.mdx index ba3d0b48ce..577edda51d 100644 --- a/docs/dev-guide/javalang/debugging.mdx +++ b/docs/dev-guide/javalang/debugging.mdx @@ -2,7 +2,6 @@ id: debugging title: Debugging - Java SDK feature guide sidebar_label: Debugging - description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. slug: /dev-guide/java/debugging toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/durable-execution.mdx b/docs/dev-guide/javalang/durable-execution.mdx index dd0ff8e3cd..2806263095 100644 --- a/docs/dev-guide/javalang/durable-execution.mdx +++ b/docs/dev-guide/javalang/durable-execution.mdx @@ -2,7 +2,6 @@ id: durable-execution title: Develop code that durably executes - Java SDK dev guide sidebar_label: Develop for durability - description: The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. slug: /dev-guide/java/durable-execution toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/features.mdx b/docs/dev-guide/javalang/features.mdx index e8a0fa7665..40835a7feb 100644 --- a/docs/dev-guide/javalang/features.mdx +++ b/docs/dev-guide/javalang/features.mdx @@ -2,7 +2,6 @@ id: features title: Features - Java SDK feature guide sidebar_label: Features - description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. slug: /dev-guide/java/features toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/foundations.mdx b/docs/dev-guide/javalang/foundations.mdx index e7cd9587e1..351757328b 100644 --- a/docs/dev-guide/javalang/foundations.mdx +++ b/docs/dev-guide/javalang/foundations.mdx @@ -2,7 +2,6 @@ id: foundations title: Foundations - Java SDK feature guide sidebar_label: Foundations - description: The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application – that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/java/foundations toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/index.mdx b/docs/dev-guide/javalang/index.mdx index a292c75579..c3fd43136d 100644 --- a/docs/dev-guide/javalang/index.mdx +++ b/docs/dev-guide/javalang/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal Java SDK development documentation sidebar_label: Java SDK - description: Learn how to use Temporal Java SDK. slug: /dev-guide/java toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/introduction.mdx b/docs/dev-guide/javalang/introduction.mdx index 56b3303f46..8faa7fbb70 100644 --- a/docs/dev-guide/javalang/introduction.mdx +++ b/docs/dev-guide/javalang/introduction.mdx @@ -2,7 +2,6 @@ id: introduction title: Introduction to the Temporal Java SDK sidebar_label: Introduction - description: Learn more about Temporal Java SDK. slug: /dev-guide/java/introduction toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/observability.mdx b/docs/dev-guide/javalang/observability.mdx index f92be15f1e..0b67852cf5 100644 --- a/docs/dev-guide/javalang/observability.mdx +++ b/docs/dev-guide/javalang/observability.mdx @@ -2,7 +2,6 @@ id: observability title: Observability - Java SDK feature guide sidebar_label: Observability - description: Improve observability in your Java-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. slug: /dev-guide/java/observability toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/project-setup.mdx b/docs/dev-guide/javalang/project-setup.mdx index f60b875469..24ba15ad09 100644 --- a/docs/dev-guide/javalang/project-setup.mdx +++ b/docs/dev-guide/javalang/project-setup.mdx @@ -2,7 +2,6 @@ id: project-setup title: Set up a Temporal Application project - Java SDK dev guide sidebar_label: Project setup - description: The project setup section of the Temporal Java SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in java—that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/java/project-setup toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/testing.mdx b/docs/dev-guide/javalang/testing.mdx index 84b25c7b86..2f820b809e 100644 --- a/docs/dev-guide/javalang/testing.mdx +++ b/docs/dev-guide/javalang/testing.mdx @@ -2,7 +2,6 @@ id: testing title: Testing - Java SDK feature guide sidebar_label: Testing - description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. slug: /dev-guide/java/testing toc_max_heading_level: 4 diff --git a/docs/dev-guide/javalang/versioning.mdx b/docs/dev-guide/javalang/versioning.mdx index db1596a8e4..74f7658cc2 100644 --- a/docs/dev-guide/javalang/versioning.mdx +++ b/docs/dev-guide/javalang/versioning.mdx @@ -2,7 +2,6 @@ id: versioning title: Versioning - Java SDK feature guide sidebar_label: Versioning - description: The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. slug: /dev-guide/java/versioning toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/debugging.mdx b/docs/dev-guide/phplang/debugging.mdx index 7e9c3dfda6..ee3c266eef 100644 --- a/docs/dev-guide/phplang/debugging.mdx +++ b/docs/dev-guide/phplang/debugging.mdx @@ -2,7 +2,6 @@ id: debugging title: Debugging - PHP SDK feature guide sidebar_label: Debugging - description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. slug: /dev-guide/php/debugging toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/features.mdx b/docs/dev-guide/phplang/features.mdx index ab725c6ee2..894013a08d 100644 --- a/docs/dev-guide/phplang/features.mdx +++ b/docs/dev-guide/phplang/features.mdx @@ -2,7 +2,6 @@ id: features title: Features - PHP SDK feature guide sidebar_label: Features - description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. slug: /dev-guide/php/features toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/foundations.mdx b/docs/dev-guide/phplang/foundations.mdx index add345a3f7..ed6b95445c 100644 --- a/docs/dev-guide/phplang/foundations.mdx +++ b/docs/dev-guide/phplang/foundations.mdx @@ -2,7 +2,6 @@ id: foundations title: Foundations - PHP SDK feature guide sidebar_label: Foundations - description: The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application – that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/php/foundations toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/index.mdx b/docs/dev-guide/phplang/index.mdx index 45c3f72c8b..240d6af6b5 100644 --- a/docs/dev-guide/phplang/index.mdx +++ b/docs/dev-guide/phplang/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal PHP SDK development information sidebar_label: PHP SDK - description: Learn how to use the Temporal PHP SDK. slug: /dev-guide/php toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/observability.mdx b/docs/dev-guide/phplang/observability.mdx index a00b300599..5ff52cc43f 100644 --- a/docs/dev-guide/phplang/observability.mdx +++ b/docs/dev-guide/phplang/observability.mdx @@ -2,7 +2,6 @@ id: observability title: Observability - PHP SDK feature guide sidebar_label: Observability - description: Improve observability in your PHP-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. slug: /dev-guide/php/observability toc_max_heading_level: 4 diff --git a/docs/dev-guide/phplang/testing.mdx b/docs/dev-guide/phplang/testing.mdx index d28df880c1..e4168ab7ac 100644 --- a/docs/dev-guide/phplang/testing.mdx +++ b/docs/dev-guide/phplang/testing.mdx @@ -2,7 +2,6 @@ id: testing title: Testing - PHP SDK feature guide sidebar_label: Testing - description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. slug: /dev-guide/php/testing toc_max_heading_level: 4 diff --git a/docs/dev-guide/python/index.mdx b/docs/dev-guide/python/index.mdx index 9893352560..892bdd24b6 100644 --- a/docs/dev-guide/python/index.mdx +++ b/docs/dev-guide/python/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal Python SDK development documentation sidebar_label: Python SDK - description: Learn how to use the Temporal Python SDK. slug: /dev-guide/python toc_max_heading_level: 4 diff --git a/docs/dev-guide/python/introduction.mdx b/docs/dev-guide/python/introduction.mdx index b99d84a44a..15fde7d8fc 100644 --- a/docs/dev-guide/python/introduction.mdx +++ b/docs/dev-guide/python/introduction.mdx @@ -2,7 +2,6 @@ id: introduction title: Introduction to the Temporal Python SDK sidebar_label: Introduction - description: Learn more about Temporal Python SDK. slug: /dev-guide/python/introduction toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/debugging.mdx b/docs/dev-guide/tscript/debugging.mdx index 3284beea47..187c946161 100644 --- a/docs/dev-guide/tscript/debugging.mdx +++ b/docs/dev-guide/tscript/debugging.mdx @@ -2,7 +2,6 @@ id: debugging title: Debugging - TypeScript SDK feature guide sidebar_label: Debugging - description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. slug: /dev-guide/typescript/debugging toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/features.mdx b/docs/dev-guide/tscript/features.mdx index 8a8120f6e2..7051da657c 100644 --- a/docs/dev-guide/tscript/features.mdx +++ b/docs/dev-guide/tscript/features.mdx @@ -2,7 +2,6 @@ id: features title: Features - TypeScript SDK feature guide sidebar_label: Features - description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. slug: /dev-guide/typescript/features toc_max_heading_level: 3 diff --git a/docs/dev-guide/tscript/foundations.mdx b/docs/dev-guide/tscript/foundations.mdx index aa1f615b74..44a4c2548c 100644 --- a/docs/dev-guide/tscript/foundations.mdx +++ b/docs/dev-guide/tscript/foundations.mdx @@ -2,7 +2,6 @@ id: foundations title: Foundations - TypeScript SDK feature guide sidebar_label: Foundations - description: The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application – that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/typescript/foundations toc_max_heading_level: 2 diff --git a/docs/dev-guide/tscript/index.mdx b/docs/dev-guide/tscript/index.mdx index 7725000103..83785ba166 100644 --- a/docs/dev-guide/tscript/index.mdx +++ b/docs/dev-guide/tscript/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal TypeScript SDK development documentation sidebar_label: TypeScript SDK - description: Learn how to use the Temporal TypeScript SDK. slug: /dev-guide/typescript toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/introduction.mdx b/docs/dev-guide/tscript/introduction.mdx index 237b175406..188fb6d107 100644 --- a/docs/dev-guide/tscript/introduction.mdx +++ b/docs/dev-guide/tscript/introduction.mdx @@ -2,7 +2,6 @@ id: introduction title: Introduction to the Temporal TypeScript SDK sidebar_label: Introduction - description: Learn more about the Temporal TypeScript SDK. slug: /dev-guide/typescript/introduction toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/observability.mdx b/docs/dev-guide/tscript/observability.mdx index 203fe52e8d..8cf852a9cb 100644 --- a/docs/dev-guide/tscript/observability.mdx +++ b/docs/dev-guide/tscript/observability.mdx @@ -2,7 +2,6 @@ id: observability title: Observability - TypeScript SDK feature guide sidebar_label: Observability - description: Improve observability in your TypeScript-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. slug: /dev-guide/typescript/observability toc_max_heading_level: 3 diff --git a/docs/dev-guide/tscript/project-setup.mdx b/docs/dev-guide/tscript/project-setup.mdx index 379c6f1485..e11843a1e6 100644 --- a/docs/dev-guide/tscript/project-setup.mdx +++ b/docs/dev-guide/tscript/project-setup.mdx @@ -2,7 +2,6 @@ id: project-setup title: Set up a Temporal Application project - TypeScript SDK dev guide sidebar_label: Project setup - description: The project setup section of the Temporal TypeScript SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in TypeScript—that is, all the relevant steps to start a Workflow Execution that executes an Activity. slug: /dev-guide/typescript/project-setup toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/testing.mdx b/docs/dev-guide/tscript/testing.mdx index 72d7983aaa..b16392033e 100644 --- a/docs/dev-guide/tscript/testing.mdx +++ b/docs/dev-guide/tscript/testing.mdx @@ -2,7 +2,6 @@ id: testing title: Testing - TypeScript SDK feature guide sidebar_label: Testing - description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. slug: /dev-guide/typescript/testing toc_max_heading_level: 4 diff --git a/docs/dev-guide/tscript/versioning.mdx b/docs/dev-guide/tscript/versioning.mdx index e661909e84..5618e59062 100644 --- a/docs/dev-guide/tscript/versioning.mdx +++ b/docs/dev-guide/tscript/versioning.mdx @@ -2,7 +2,6 @@ id: versioning title: Versioning - TypeScript SDK feature guide sidebar_label: Versioning - description: The Versioning section of the Temporal TypeScript SDK developer's guide explains how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. slug: /dev-guide/typescript/versioning toc_max_heading_level: 4 diff --git a/docs/encyclopedia/activities.mdx b/docs/encyclopedia/activities.mdx index 26ecdeabfa..93fa7605c3 100644 --- a/docs/encyclopedia/activities.mdx +++ b/docs/encyclopedia/activities.mdx @@ -2,7 +2,6 @@ id: activities title: What is a Temporal Activity? sidebar_label: Activities - description: This guide provides a comprehensive overview of Temporal Activities. slug: /activities toc_max_heading_level: 4 diff --git a/docs/encyclopedia/clusters.mdx b/docs/encyclopedia/clusters.mdx index 3c1b618b2c..e245da7c31 100644 --- a/docs/encyclopedia/clusters.mdx +++ b/docs/encyclopedia/clusters.mdx @@ -2,7 +2,6 @@ id: clusters title: What is a Temporal Service? sidebar_label: Temporal Service - description: This guide provides a comprehensive overview of the Temporal Service. slug: /clusters toc_max_heading_level: 4 diff --git a/docs/encyclopedia/dataconversion.mdx b/docs/encyclopedia/dataconversion.mdx index 4ab988df73..2858b2c2a0 100644 --- a/docs/encyclopedia/dataconversion.mdx +++ b/docs/encyclopedia/dataconversion.mdx @@ -2,7 +2,6 @@ id: dataconversion title: How does Temporal handle application data? sidebar_label: Data conversion - description: This guide provides an overview of data handling using a Data Converter on the Temporal Platform. slug: /dataconversion toc_max_heading_level: 4 diff --git a/docs/encyclopedia/namespaces.mdx b/docs/encyclopedia/namespaces.mdx index 0fb4264216..f59ca0ee4b 100644 --- a/docs/encyclopedia/namespaces.mdx +++ b/docs/encyclopedia/namespaces.mdx @@ -2,7 +2,6 @@ id: namespaces title: What is a Temporal Namespace? sidebar_label: Namespaces - description: This guide provides a comprehensive overview of Namespaces. slug: /namespaces toc_max_heading_level: 4 diff --git a/docs/encyclopedia/retry-policies.mdx b/docs/encyclopedia/retry-policies.mdx index 08d260a308..277b25ec15 100644 --- a/docs/encyclopedia/retry-policies.mdx +++ b/docs/encyclopedia/retry-policies.mdx @@ -2,7 +2,6 @@ id: retry-policies title: What is a Temporal Retry Policy? sidebar_label: Retry Policies - description: A Retry Policy works in cooperation with the timeouts to provide fine controls to optimize the execution experience. slug: /retry-policies toc_max_heading_level: 4 diff --git a/docs/encyclopedia/temporal-sdks.mdx b/docs/encyclopedia/temporal-sdks.mdx index cf7824d82f..192dc1d3eb 100644 --- a/docs/encyclopedia/temporal-sdks.mdx +++ b/docs/encyclopedia/temporal-sdks.mdx @@ -2,7 +2,6 @@ id: temporal-sdks title: About Temporal SDKs sidebar_label: About the SDKs - description: Explore the components that make up a Temporal SDK and how they work to create a durable execution. toc_max_heading_level: 4 keywords: diff --git a/docs/encyclopedia/temporal.mdx b/docs/encyclopedia/temporal.mdx index 222471cc20..f325884149 100644 --- a/docs/encyclopedia/temporal.mdx +++ b/docs/encyclopedia/temporal.mdx @@ -2,7 +2,6 @@ id: temporal title: What is Temporal? sidebar_label: Temporal - description: Discover the Temporal Platform, a runtime for durable executions that consists of a Temporal Cluster and Worker Processes, plus SDKs in multiple languages. slug: /temporal toc_max_heading_level: 4 diff --git a/docs/encyclopedia/visibility.mdx b/docs/encyclopedia/visibility.mdx index 521bf79798..f4c06ede2f 100644 --- a/docs/encyclopedia/visibility.mdx +++ b/docs/encyclopedia/visibility.mdx @@ -2,7 +2,6 @@ id: visibility title: What is the Temporal Visibility feature? sidebar_label: Visibility - description: This guide provides a comprehensive overview of Temporal Visibility. slug: /visibility toc_max_heading_level: 4 diff --git a/docs/encyclopedia/workers.mdx b/docs/encyclopedia/workers.mdx index fe8ac738ed..afa655e450 100644 --- a/docs/encyclopedia/workers.mdx +++ b/docs/encyclopedia/workers.mdx @@ -2,7 +2,6 @@ id: workers title: What is a Temporal Worker? sidebar_label: Workers - description: There is a tight coupling between Temporal Task Queues and Worker Processes. slug: /workers toc_max_heading_level: 4 diff --git a/docs/encyclopedia/workflows.mdx b/docs/encyclopedia/workflows.mdx index 2608a3b319..282bbfda58 100644 --- a/docs/encyclopedia/workflows.mdx +++ b/docs/encyclopedia/workflows.mdx @@ -2,7 +2,6 @@ id: workflows title: What is a Temporal Workflow? sidebar_label: Workflows - description: This guide provides a comprehensive overview of Temporal Workflows. slug: /workflows toc_max_heading_level: 4 diff --git a/docs/evaluate/index.mdx b/docs/evaluate/index.mdx index f04df57997..c1d9fe0238 100644 --- a/docs/evaluate/index.mdx +++ b/docs/evaluate/index.mdx @@ -2,7 +2,6 @@ id: index title: Evaluate Temporal sidebar_label: Evaluate - description: Learn more about how to deploy a Temporal Application to production. collapsed: false toc_max_heading_level: 4 diff --git a/docs/evaluate/release-stages.mdx b/docs/evaluate/release-stages.mdx index 81d99e1e59..aa23f7510e 100644 --- a/docs/evaluate/release-stages.mdx +++ b/docs/evaluate/release-stages.mdx @@ -2,7 +2,6 @@ id: release-stages title: Temporal product release stages guide sidebar_label: Release stages - description: Learn more about Temporal product release stages toc_max_heading_level: 4 keywords: diff --git a/docs/evaluate/why-temporal.mdx b/docs/evaluate/why-temporal.mdx index b18de5552e..b6f782ffd9 100644 --- a/docs/evaluate/why-temporal.mdx +++ b/docs/evaluate/why-temporal.mdx @@ -2,14 +2,12 @@ id: why-temporal title: Why Temporal? sidebar_label: Why Temporal - description: This guide provides a short overview of Why Temporal. toc_max_heading_level: 4 keywords: - temporal - evaluate-temporal - why-temporal - tags: - temporal - evaluate-temporal diff --git a/docs/getting-started.mdx b/docs/getting-started.mdx index 0639322cf7..b5a65e4e01 100644 --- a/docs/getting-started.mdx +++ b/docs/getting-started.mdx @@ -3,7 +3,6 @@ id: getting-started title: Getting started with Temporal description: Learn how to get started using Temporal sidebar_label: Get started - tags: - getting-started --- diff --git a/docs/production-deployment/cloud/account-setup/certificates.mdx b/docs/production-deployment/cloud/account-setup/certificates.mdx index 44706f4901..0d8ada07c4 100644 --- a/docs/production-deployment/cloud/account-setup/certificates.mdx +++ b/docs/production-deployment/cloud/account-setup/certificates.mdx @@ -2,7 +2,6 @@ id: certificates title: Certificate management - Temporal Cloud feature guide sidebar_label: Certificates - description: Create certificates and use them to control access to Namespaces. slug: /cloud/certificates toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/account-setup/index.mdx b/docs/production-deployment/cloud/account-setup/index.mdx index 19568db68f..fa6e03a704 100644 --- a/docs/production-deployment/cloud/account-setup/index.mdx +++ b/docs/production-deployment/cloud/account-setup/index.mdx @@ -4,7 +4,6 @@ slug: /cloud/account-setup title: How to set up and manage your Temporal Cloud account description: Learn more about how to set up and manage your Temporal Cloud account, including certificates and users. sidebar_label: Account setup - tags: - temporal cloud - temporal cloud account diff --git a/docs/production-deployment/cloud/account-setup/namespaces.mdx b/docs/production-deployment/cloud/account-setup/namespaces.mdx index cfe2dfe043..1d78516120 100644 --- a/docs/production-deployment/cloud/account-setup/namespaces.mdx +++ b/docs/production-deployment/cloud/account-setup/namespaces.mdx @@ -2,7 +2,6 @@ id: namespaces title: Namespace management - Temporal Cloud feature guide sidebar_label: Namespaces - description: Create Namespaces, use Namespace endpoints for access, and obtain Namespace information. slug: /cloud/namespaces toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/account-setup/users.mdx b/docs/production-deployment/cloud/account-setup/users.mdx index 8c3dc3f145..976c4f979f 100644 --- a/docs/production-deployment/cloud/account-setup/users.mdx +++ b/docs/production-deployment/cloud/account-setup/users.mdx @@ -2,7 +2,6 @@ id: users title: User management - Temporal Cloud feature guide sidebar_label: Users - description: Invite users, set account level roles, and set Namespace-level positions for users. slug: /cloud/users toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/api-keys.mdx b/docs/production-deployment/cloud/api-keys.mdx index 35a2803c44..438057fdc2 100644 --- a/docs/production-deployment/cloud/api-keys.mdx +++ b/docs/production-deployment/cloud/api-keys.mdx @@ -2,7 +2,6 @@ id: api-keys title: API Keys - Temporal Cloud feature guide sidebar_label: API Keys - description: Temporal Cloud documentation, including explanations and usage. slug: /cloud/api-keys toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/audit-logging.mdx b/docs/production-deployment/cloud/audit-logging.mdx index d2156d793e..54c9a114db 100644 --- a/docs/production-deployment/cloud/audit-logging.mdx +++ b/docs/production-deployment/cloud/audit-logging.mdx @@ -2,7 +2,6 @@ id: audit-logging title: Audit Logging - Temporal Cloud feature guide sidebar_label: Audit Logging - description: Audit Logging provides forensic access information at the account, user, and Namespace level. Configure, consume, troubleshoot, and delete audit logs. slug: /cloud/audit-logging toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/export.mdx b/docs/production-deployment/cloud/export.mdx index 73e94d9d37..aadd6d4faf 100644 --- a/docs/production-deployment/cloud/export.mdx +++ b/docs/production-deployment/cloud/export.mdx @@ -2,7 +2,6 @@ id: export title: Export - Temporal Cloud feature guide sidebar_label: Export - description: Workflow History export allows users to export Closed Workflow Histories to a user's Cloud Storage Sink. slug: /cloud/export toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/get-started.mdx b/docs/production-deployment/cloud/get-started.mdx index 6596af5b1a..ac4e0339d4 100644 --- a/docs/production-deployment/cloud/get-started.mdx +++ b/docs/production-deployment/cloud/get-started.mdx @@ -2,7 +2,6 @@ id: get-started title: Get started with Temporal Cloud sidebar_label: Get started - description: Create an account, issue certificates, create a Namespace, invite users, and connect. slug: /cloud/get-started toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/index.mdx b/docs/production-deployment/cloud/index.mdx index 0201b95ea1..89db35a3e4 100644 --- a/docs/production-deployment/cloud/index.mdx +++ b/docs/production-deployment/cloud/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal Cloud guide sidebar_label: Temporal Cloud guide - description: Temporal Cloud documentation, including explanations and usage. slug: /cloud toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/index.mdx b/docs/production-deployment/cloud/introduction/index.mdx index edc08d1f8f..7154f55b31 100644 --- a/docs/production-deployment/cloud/introduction/index.mdx +++ b/docs/production-deployment/cloud/introduction/index.mdx @@ -2,7 +2,6 @@ id: index title: Introduction to Temporal Cloud sidebar_label: Introduction - description: Learn more about Temporal Cloud. slug: /cloud/introduction toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/limits.mdx b/docs/production-deployment/cloud/introduction/limits.mdx index 154215963f..8f8ed66c6d 100644 --- a/docs/production-deployment/cloud/introduction/limits.mdx +++ b/docs/production-deployment/cloud/introduction/limits.mdx @@ -2,7 +2,6 @@ id: limits title: System limits - Temporal Cloud sidebar_label: Limits - description: Learn more about Temporal Cloud defaults, limits, and configurable settings. slug: /cloud/limits toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/overview.mdx b/docs/production-deployment/cloud/introduction/overview.mdx index 3dcce96611..b6b087559a 100644 --- a/docs/production-deployment/cloud/introduction/overview.mdx +++ b/docs/production-deployment/cloud/introduction/overview.mdx @@ -2,7 +2,6 @@ id: overview title: Overview - Temporal Cloud sidebar_label: Overview - description: Learn more about Temporal Cloud. slug: /cloud/overview toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/pricing.mdx b/docs/production-deployment/cloud/introduction/pricing.mdx index 2a22f739d5..820a14b9be 100644 --- a/docs/production-deployment/cloud/introduction/pricing.mdx +++ b/docs/production-deployment/cloud/introduction/pricing.mdx @@ -2,7 +2,6 @@ id: pricing title: Pricing - Temporal Cloud sidebar_label: Pricing - description: Temporal Cloud pricing information slug: /cloud/pricing toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/security.mdx b/docs/production-deployment/cloud/introduction/security.mdx index 1f08d098fe..f35c032fa0 100644 --- a/docs/production-deployment/cloud/introduction/security.mdx +++ b/docs/production-deployment/cloud/introduction/security.mdx @@ -2,7 +2,6 @@ id: security title: Security model - Temporal Cloud sidebar_label: Security model - description: The security model of Temporal Cloud encompasses applications, data, and the Temporal Cloud platform. slug: /cloud/security toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/service-availability.mdx b/docs/production-deployment/cloud/introduction/service-availability.mdx index 21212bb1f0..0a059770d0 100644 --- a/docs/production-deployment/cloud/introduction/service-availability.mdx +++ b/docs/production-deployment/cloud/introduction/service-availability.mdx @@ -2,7 +2,6 @@ id: service-availability title: Service availability - Temporal Cloud sidebar_label: Availability - description: The operating envelope of Temporal Cloud includes availability, regions, throughput, and latency. slug: /cloud/service-availability toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/sla.mdx b/docs/production-deployment/cloud/introduction/sla.mdx index 006240a423..635e07b2c7 100644 --- a/docs/production-deployment/cloud/introduction/sla.mdx +++ b/docs/production-deployment/cloud/introduction/sla.mdx @@ -2,7 +2,6 @@ id: sla title: Service Level Agreement (SLA) - Temporal Cloud sidebar_label: SLA - description: Learn more about Temporal Cloud's Sevice Level Agreement (SLA). slug: /cloud/sla toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/introduction/support.mdx b/docs/production-deployment/cloud/introduction/support.mdx index 5d159fec39..d631e0ccaa 100644 --- a/docs/production-deployment/cloud/introduction/support.mdx +++ b/docs/production-deployment/cloud/introduction/support.mdx @@ -2,7 +2,6 @@ id: support title: Services, support, and training - Temporal Cloud sidebar_label: Support - description: Temporal Cloud users can reach out for help through our community Slack channel, or file a support ticket through Zendesk. slug: /cloud/support toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/metrics/index.mdx b/docs/production-deployment/cloud/metrics/index.mdx index 27d4e6a249..28038a4353 100644 --- a/docs/production-deployment/cloud/metrics/index.mdx +++ b/docs/production-deployment/cloud/metrics/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal Cloud observability through metrics sidebar_label: Metrics - description: Configure and track performance metrics for Temporal Cloud. slug: /cloud/metrics/ toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/operation-api.mdx b/docs/production-deployment/cloud/operation-api.mdx index f7b63958a4..b20d492c28 100644 --- a/docs/production-deployment/cloud/operation-api.mdx +++ b/docs/production-deployment/cloud/operation-api.mdx @@ -2,7 +2,6 @@ id: operation-api title: Operations API - Temporal Cloud feature guide sidebar_label: Cloud Ops API - description: Temporal Cloud Operations API. slug: /ops toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/saml.mdx b/docs/production-deployment/cloud/saml.mdx index 2b33ccf125..4e5b7c6e24 100644 --- a/docs/production-deployment/cloud/saml.mdx +++ b/docs/production-deployment/cloud/saml.mdx @@ -2,7 +2,6 @@ id: saml title: SAML authentication - Temporal Cloud feature guide sidebar_label: SAML - description: Integrate a SAML identity provider with your Temporal Cloud account. slug: /cloud/saml toc_max_heading_level: 4 diff --git a/docs/production-deployment/cloud/terraform-provider.mdx b/docs/production-deployment/cloud/terraform-provider.mdx index 3c314fa1b8..d980dbc59b 100644 --- a/docs/production-deployment/cloud/terraform-provider.mdx +++ b/docs/production-deployment/cloud/terraform-provider.mdx @@ -3,7 +3,6 @@ id: terraform-provider title: Temporal Cloud Terraform provider sidebar_label: Terraform provider description: Use the Temporal Cloud Terraform provider to manage Temporal Cloud resources. - tags: - temporal cloud - terraform diff --git a/docs/production-deployment/data-encryption.mdx b/docs/production-deployment/data-encryption.mdx index dee91db3a8..35f0896869 100644 --- a/docs/production-deployment/data-encryption.mdx +++ b/docs/production-deployment/data-encryption.mdx @@ -2,7 +2,6 @@ id: data-encryption title: Codec Server - Temporal Platform feature guide sidebar_label: Codecs and Encryption - description: This guide explains how to create and deploy a Codec Server to encrypt data with Temporal. slug: /production-deployment/data-encryption toc_max_heading_level: 4 diff --git a/docs/production-deployment/index.mdx b/docs/production-deployment/index.mdx index 01e8712de9..cc08661a7e 100644 --- a/docs/production-deployment/index.mdx +++ b/docs/production-deployment/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal Platform production deployments sidebar_label: Production deployments - description: Learn more about how to deploy a Temporal Application to production. slug: /production-deployment toc_max_heading_level: 4 diff --git a/docs/production-deployment/migration.mdx b/docs/production-deployment/migration.mdx index 2ee349342c..cf935d3d04 100644 --- a/docs/production-deployment/migration.mdx +++ b/docs/production-deployment/migration.mdx @@ -2,7 +2,6 @@ id: migration title: Migrate to Cloud sidebar_label: Migrate to Cloud - description: Migrate to Temporal Cloud from a Self-hosted Cluster. slug: /production-deployments/migration toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/archival.mdx b/docs/production-deployment/self-hosted-guide/archival.mdx index 4c86f42884..3834a56ec6 100644 --- a/docs/production-deployment/self-hosted-guide/archival.mdx +++ b/docs/production-deployment/self-hosted-guide/archival.mdx @@ -2,7 +2,6 @@ id: archival title: Self-hosted Archival setup sidebar_label: Archival - description: Learn how to setup the self-hosted Cluster Archival feature. slug: /self-hosted-guide/archival toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/checklist.mdx b/docs/production-deployment/self-hosted-guide/checklist.mdx index 54be4ffda9..5d5b81f618 100644 --- a/docs/production-deployment/self-hosted-guide/checklist.mdx +++ b/docs/production-deployment/self-hosted-guide/checklist.mdx @@ -2,7 +2,6 @@ id: checklist title: Temporal Platform's production readiness checklist sidebar_label: Prod checklist - description: Discover all the production level steps you can take to ensure a smooth deployment. slug: /self-hosted-guide/production-checklist toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/defaults.mdx b/docs/production-deployment/self-hosted-guide/defaults.mdx index 039b62a45e..08de0ddf31 100644 --- a/docs/production-deployment/self-hosted-guide/defaults.mdx +++ b/docs/production-deployment/self-hosted-guide/defaults.mdx @@ -2,7 +2,6 @@ id: defaults title: Self-hosted Temporal Cluster defaults sidebar_label: Defaults - description: Learn about the default limits for self-hosted Temporal Clusters. slug: /self-hosted-guide/defaults toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/index.mdx b/docs/production-deployment/self-hosted-guide/index.mdx index a953c50148..da9b7df82e 100644 --- a/docs/production-deployment/self-hosted-guide/index.mdx +++ b/docs/production-deployment/self-hosted-guide/index.mdx @@ -2,7 +2,6 @@ id: index title: Self-hosted Temporal Cluster guide sidebar_label: Self-hosted guide - description: This guide provides a comprehensive overview to deploy and operate a Temporal Cluster in a live environment. slug: /self-hosted-guide toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/monitoring.mdx b/docs/production-deployment/self-hosted-guide/monitoring.mdx index b4c45bb3dd..7f5c824b65 100644 --- a/docs/production-deployment/self-hosted-guide/monitoring.mdx +++ b/docs/production-deployment/self-hosted-guide/monitoring.mdx @@ -2,7 +2,6 @@ id: monitoring title: Monitor Temporal Platform metrics sidebar_label: Monitoring - description: Learn how to monitor metrics and health check a self-hosted Temporal Platform. slug: /self-hosted-guide/monitoring toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx b/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx index 9d76fe17de..17c6dcd538 100644 --- a/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx +++ b/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx @@ -2,7 +2,6 @@ id: multi-cluster-replication title: Self-hosted Multi-Cluster Replication sidebar_label: Multi-Cluster Replication - description: Learn how to setup Multi-Cluster Replication. slug: /self-hosted-guide/multi-cluster-replication toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/security.mdx b/docs/production-deployment/self-hosted-guide/security.mdx index f270c48f5a..23f6b2837e 100644 --- a/docs/production-deployment/self-hosted-guide/security.mdx +++ b/docs/production-deployment/self-hosted-guide/security.mdx @@ -2,7 +2,6 @@ id: security title: Temporal Platform security features sidebar_label: Security - description: This guide is an overview of the Temporal Platform security features. slug: /self-hosted-guide/security toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx index c9c07f4323..f29a6a98ff 100644 --- a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx +++ b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx @@ -2,7 +2,6 @@ id: server-frontend-api-reference title: Server Frontend API Reference sidebar_label: Server API - description: You can interact with Temporal Server via one of its APIs. slug: /self-hosted-guide/server-frontend-api-reference toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/setup.mdx b/docs/production-deployment/self-hosted-guide/setup.mdx index f78b74fc06..71a077c631 100644 --- a/docs/production-deployment/self-hosted-guide/setup.mdx +++ b/docs/production-deployment/self-hosted-guide/setup.mdx @@ -2,7 +2,6 @@ id: setup title: Introduction to the Self-hosted Temporal Cluster deployment guide sidebar_label: Setup - description: This guide provides a comprehensive overview to deploy and operate a Temporal Cluster in a live environment. slug: /self-hosted-guide/setup toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/upgrade-server.mdx b/docs/production-deployment/self-hosted-guide/upgrade-server.mdx index c7833026d9..88c4d89b77 100644 --- a/docs/production-deployment/self-hosted-guide/upgrade-server.mdx +++ b/docs/production-deployment/self-hosted-guide/upgrade-server.mdx @@ -2,7 +2,6 @@ id: upgrade-server title: Upgrade the Temporal Server sidebar_label: Upgrade server - description: Learn how to keep your Temporal Server up to date. slug: /self-hosted-guide/upgrade-server toc_max_heading_level: 4 diff --git a/docs/production-deployment/self-hosted-guide/visibility.mdx b/docs/production-deployment/self-hosted-guide/visibility.mdx index d477c55478..58afc55f58 100644 --- a/docs/production-deployment/self-hosted-guide/visibility.mdx +++ b/docs/production-deployment/self-hosted-guide/visibility.mdx @@ -2,7 +2,6 @@ id: visibility title: Self-hosted Visibility feature setup sidebar_label: Visibility - description: Learn how to set up the Temporal self-hosted Cluster Visibility feature. slug: /self-hosted-guide/visibility toc_max_heading_level: 4 diff --git a/docs/references/index.mdx b/docs/references/index.mdx index d2a88c5edf..6683d9b47d 100644 --- a/docs/references/index.mdx +++ b/docs/references/index.mdx @@ -2,7 +2,6 @@ id: index title: Temporal Platform references sidebar_label: References - description: Consult the Temporal Platform references for details about configurations, Commands, Events, metrics, and APIs. --- diff --git a/docs/security.mdx b/docs/security.mdx index 7a37fe3ade..1a4e340bb4 100644 --- a/docs/security.mdx +++ b/docs/security.mdx @@ -2,7 +2,6 @@ id: security title: Temporal Platform security sidebar_label: Security - description: Find resources about the security features of the Temporal Platform. slug: /security toc_max_heading_level: 4 diff --git a/docs/tctl-v1/index.mdx b/docs/tctl-v1/index.mdx index 25c2ced34e..2d8d19f767 100644 --- a/docs/tctl-v1/index.mdx +++ b/docs/tctl-v1/index.mdx @@ -2,7 +2,6 @@ id: index title: tctl v1.17 command reference sidebar_label: CLI (tctl) - description: The Temporal CLI (tctl) is a legacy command-line tool that you can use to interact with a Temporal Cluster. slug: /tctl-v1 toc_max_heading_level: 4 diff --git a/docs/troubleshooting/index.mdx b/docs/troubleshooting/index.mdx index 03f49ad742..15c14abe03 100644 --- a/docs/troubleshooting/index.mdx +++ b/docs/troubleshooting/index.mdx @@ -2,7 +2,6 @@ id: index title: Error Handling and Troubleshooting sidebar_label: Troubleshooting - description: This guide contains error handling and troubleshooting solutuions for Temporal edge cases. toc_max_heading_level: 4 keywords: diff --git a/docs/web-ui.mdx b/docs/web-ui.mdx index e04b757f3c..a6c58a99ee 100644 --- a/docs/web-ui.mdx +++ b/docs/web-ui.mdx @@ -2,7 +2,6 @@ id: web-ui title: Temporal Web UI sidebar_label: Web UI - description: Explore the intuitive web user interface (Web UI) for Temporal. Seamlessly monitor and manage your Namespaces, Workflows, Schedules, and other settings. toc_max_heading_level: 4 keywords: From 47120b625bb5e4653f5961671a207a8eb9b05b1d Mon Sep 17 00:00:00 2001 From: rachfop Date: Wed, 8 May 2024 13:17:09 -0700 Subject: [PATCH 07/26] Fix weird format issues --- .../asynchronous-activity-completion.mdx | 14 ++++++++++++++ docs/dev-guide/python/cancellation.mdx | 12 +++++++++++- docs/dev-guide/python/child-workflows.mdx | 11 ++++++++++- docs/dev-guide/python/continue-as-new.mdx | 9 ++++++++- docs/dev-guide/python/core-application.mdx | 17 ++++++++++++++++- docs/dev-guide/python/data-encryption.mdx | 11 ++++++++++- docs/dev-guide/python/debugging.mdx | 14 ++++++++++++-- docs/dev-guide/python/failure-detection.mdx | 14 +++++++++++++- docs/dev-guide/python/interrupt-workflow.mdx | 12 +++++++++++- docs/dev-guide/python/messages.mdx | 19 ++++++++++++++++++- docs/dev-guide/python/schedules.mdx | 16 +++++++++++++++- docs/dev-guide/python/timers.mdx | 9 ++++++++- docs/dev-guide/tscript/observability.mdx | 12 ++++++------ docs/encyclopedia/clusters.mdx | 6 ++---- docs/encyclopedia/dataconversion.mdx | 1 - docs/encyclopedia/visibility.mdx | 14 -------------- docs/encyclopedia/workflows.mdx | 1 - docs/getting-started.mdx | 5 ----- .../multi-cluster-replication.mdx | 11 ----------- .../server-frontend-api-reference.mdx | 3 --- .../self-hosted-guide/visibility.mdx | 8 -------- .../web-ui-environment-variables.mdx | 5 ++--- docs/web-ui.mdx | 13 ------------- 23 files changed, 156 insertions(+), 81 deletions(-) diff --git a/docs/dev-guide/python/asynchronous-activity-completion.mdx b/docs/dev-guide/python/asynchronous-activity-completion.mdx index 607f61ae76..a493a81feb 100644 --- a/docs/dev-guide/python/asynchronous-activity-completion.mdx +++ b/docs/dev-guide/python/asynchronous-activity-completion.mdx @@ -5,6 +5,20 @@ sidebar_label: Asynchronous Activity Completion description: Complete an Activity without waiting for execution to finish, using Temporal Client and Activity Function. slug: /dev-guide/python/asynchronous_activity_completion toc_max_heading_level: 2 +keywords: + - asynchronous activity completion + - temporal python activities + - async activity execution + - temporal task token + - temporal activity heartbeat + - async activity updates + - temporal client for activities + - activity function async completion +tags: + - python + - python-sdk + - activities + - asynchronous-completion --- ## Asynchronously complete an Activity diff --git a/docs/dev-guide/python/cancellation.mdx b/docs/dev-guide/python/cancellation.mdx index 3add76edb9..aa705ffbd6 100644 --- a/docs/dev-guide/python/cancellation.mdx +++ b/docs/dev-guide/python/cancellation.mdx @@ -6,8 +6,18 @@ description: Cancel an Activity from a Workflow, sending Heartbeats and setting slug: /dev-guide/python/cancellation toc_max_heading_level: 2 keywords: - - cancellation + - activity cancellation + - cancel activity from workflow + - temporal python activity cancellation + - activity heartbeats + - heartbeat timeout + - handling cancellation errors + - local activity cancellation tags: + - python + - python-sdk + - activities + - workflows - cancellation --- diff --git a/docs/dev-guide/python/child-workflows.mdx b/docs/dev-guide/python/child-workflows.mdx index 67a55dee10..aa9bc76f75 100644 --- a/docs/dev-guide/python/child-workflows.mdx +++ b/docs/dev-guide/python/child-workflows.mdx @@ -6,8 +6,17 @@ description: Spawn a new Workflow from within another Workflow, with options for slug: /dev-guide/python/child_workflows toc_max_heading_level: 2 keywords: - - child-workflows + - child workflow execution + - spawn child workflow + - child workflow events + - parent close policy + - child workflow options + - execute child workflow + - start child workflow tags: + - python + - python-sdk + - workflows - child-workflows --- diff --git a/docs/dev-guide/python/continue-as-new.mdx b/docs/dev-guide/python/continue-as-new.mdx index 379fbc2797..9ce1a3369a 100644 --- a/docs/dev-guide/python/continue-as-new.mdx +++ b/docs/dev-guide/python/continue-as-new.mdx @@ -6,8 +6,15 @@ description: Close a Workflow Execution and create a new one with the same Workf slug: /dev-guide/python/continue-as-new toc_max_heading_level: 2 keywords: - - continue-as-new + - continue-as-new workflow + - restart workflow + - fresh event history + - avoid large event histories + - temporal python continue-as-new tags: + - python + - python-sdk + - workflows - continue-as-new --- diff --git a/docs/dev-guide/python/core-application.mdx b/docs/dev-guide/python/core-application.mdx index dc54acc0b0..815b6b194a 100644 --- a/docs/dev-guide/python/core-application.mdx +++ b/docs/dev-guide/python/core-application.mdx @@ -6,8 +6,23 @@ description: Develop basic Temporal application with workflows & activities in P slug: /dev-guide/python/core_application toc_max_heading_level: 2 keywords: - - core-application + - temporal python core + - develop temporal workflow + - temporal python activities + - workflow logic requirements + - customizing workflow type + - activity parameters + - activity return values + - activity execution in workflow + - activity timeouts + - getting activity results + - temporal python worker + - registering workflow types tags: + - python + - python-sdk + - workflows + - activities - core-application --- diff --git a/docs/dev-guide/python/data-encryption.mdx b/docs/dev-guide/python/data-encryption.mdx index 3fd7ca81c9..36265e9b1f 100644 --- a/docs/dev-guide/python/data-encryption.mdx +++ b/docs/dev-guide/python/data-encryption.mdx @@ -6,9 +6,18 @@ description: The Converters and Codecs section of the Temporal Developer's guide slug: /dev-guide/python/data_encryption toc_max_heading_level: 2 keywords: - - data-encryption + - temporal python data encryption + - custom payload codec + - custom data converter + - payload conversion sequence + - custom payload converter + - converting custom types + - custom json encoding tags: + - python + - python-sdk - data-encryption + - data-conversion --- This page shows the following: diff --git a/docs/dev-guide/python/debugging.mdx b/docs/dev-guide/python/debugging.mdx index ea62da2b74..8b4469ea0f 100644 --- a/docs/dev-guide/python/debugging.mdx +++ b/docs/dev-guide/python/debugging.mdx @@ -6,9 +6,19 @@ description: The Debugging section of the Temporal Developer's guide covers the slug: /dev-guide/python/debugging toc_max_heading_level: 2 keywords: - - guide-context + - debugging temporal python + - temporal web ui + - temporal cli + - workflow replay + - tracing workflows + - logging workflows + - worker performance metrics + - server performance metrics tags: - - guide-context + - python + - python-sdk + - debugging + - observability --- ## Debugging {#debug} diff --git a/docs/dev-guide/python/failure-detection.mdx b/docs/dev-guide/python/failure-detection.mdx index 45a58de4cb..fefee09859 100644 --- a/docs/dev-guide/python/failure-detection.mdx +++ b/docs/dev-guide/python/failure-detection.mdx @@ -6,9 +6,21 @@ Description: Guidance on setting timeouts, retries, and heartbeat functionality slug: /dev-guide/python/failure_detection toc_max_heading_level: 2 keywords: - - failure-detection + - workflow timeouts + - workflow retries + - activity timeouts + - activity retry policy + - activity heartbeats + - heartbeat timeout tags: + - python + - python-sdk + - workflows + - activities - failure-detection + - timeouts + - retries + - heartbeats --- ## Workflow timeouts {#workflow-timeouts} diff --git a/docs/dev-guide/python/interrupt-workflow.mdx b/docs/dev-guide/python/interrupt-workflow.mdx index b19604efd5..402fe17ed2 100644 --- a/docs/dev-guide/python/interrupt-workflow.mdx +++ b/docs/dev-guide/python/interrupt-workflow.mdx @@ -6,9 +6,19 @@ description: Learn how to interrupt a workflow execution by canceling or termina slug: /dev-guide/python/interrupt_a_workflow_execution toc_max_heading_level: 2 keywords: - - interrupt-a-workflow-execution + - cancel workflow execution + - terminate workflow execution + - interrupt workflow execution + - graceful workflow cancelation + - forceful workflow termination + - workflow cancelation logic tags: + - python + - python-sdk + - workflows - interrupt-a-workflow-execution + - cancellation + - termination --- ## Interrupt a Workflow Execution {#interrupt-a-workflow-execution} diff --git a/docs/dev-guide/python/messages.mdx b/docs/dev-guide/python/messages.mdx index ce03565b6c..48914e214a 100644 --- a/docs/dev-guide/python/messages.mdx +++ b/docs/dev-guide/python/messages.mdx @@ -6,9 +6,26 @@ description: Explore using Signals in Temporal Python to send messages to Workfl slug: /dev-guide/python/messages toc_max_heading_level: 2 keywords: - - messages + - temporal python signals + - send signal from client + - send signal from workflow + - signal with start + - workflow queries + - sending queries + - workflow updates + - dynamic workflows + - dynamic activities + - dynamic signals + - dynamic queries tags: + - python + - python-sdk + - workflows - messages + - signals + - queries + - updates + - dynamic-handlers --- ## Develop with Signals {#signals} diff --git a/docs/dev-guide/python/schedules.mdx b/docs/dev-guide/python/schedules.mdx index f43470e03f..78b6a7c0d9 100644 --- a/docs/dev-guide/python/schedules.mdx +++ b/docs/dev-guide/python/schedules.mdx @@ -6,9 +6,23 @@ description: Discover how to effectively Schedule Workflows in Temporal Python, slug: /dev-guide/python/schedules toc_max_heading_level: 2 keywords: - - schedules + - temporal python schedule workflow + - create scheduled workflow + - backfill scheduled workflow + - delete scheduled workflow + - describe scheduled workflow + - list scheduled workflows + - pause scheduled workflow + - trigger scheduled workflow + - update scheduled workflow + - temporal cron jobs + - workflow start delay tags: + - python + - python-sdk + - workflows - schedules + - cron-jobs --- ## Schedule a Workflow {#schedule-a-workflow} diff --git a/docs/dev-guide/python/timers.mdx b/docs/dev-guide/python/timers.mdx index 5ae8cf65f2..8e7b8d3e5a 100644 --- a/docs/dev-guide/python/timers.mdx +++ b/docs/dev-guide/python/timers.mdx @@ -6,8 +6,15 @@ description: Learn how to use timers within Temporal Workflows to delay executio slug: /dev-guide/python/timers toc_max_heading_level: 2 keywords: - - timers + - temporal workflow timers + - delay workflow execution + - durable scheduling + - long-term task scheduling + - sleep in workflow tags: + - python + - python-sdk + - workflows - timers --- diff --git a/docs/dev-guide/tscript/observability.mdx b/docs/dev-guide/tscript/observability.mdx index 293f4b9e16..8bf7f0f613 100644 --- a/docs/dev-guide/tscript/observability.mdx +++ b/docs/dev-guide/tscript/observability.mdx @@ -130,12 +130,12 @@ export async function greet(name: string): Promise { -{/\* +{/* #### Customizing Activity logging with `ActivityOutboundCallsInterceptor` FIXME(JWH): Quick introduction to `ActivityOutboundCallsInterceptor.getLogAttributes()`. -\*/} +*/} ### Logging from Workflows @@ -164,12 +164,12 @@ export async function myWorkflow(name: string): Promise { The Workflow Context Logger tries to avoid reemitting log messages on Workflow Replays. -{/\* +{/* #### Customizing Workflow logging using `WorkflowOutboundCallsInterceptor` FIXME(JWH): Quick introduction to `WorkflowOutboundCallsInterceptor.getLogAttributes()`. -\*/} +*/} #### Limitations of Workflow logs @@ -262,8 +262,8 @@ Runtime.install({ Sinks enable one-way export of logs, metrics, and traces from the Workflow isolate to the Node.js environment. -{/_ -Workflows in Temporal may be replayed from the beginning of their history when resumed. In order for Temporal to recreate the exact state Workflow code was in, the code is required to be fully deterministic. To prevent breaking determinism, in the TypeScript SDK, Workflow code runs in an isolated execution environment and may not use any of the Node.js APIs or communicate directly with the outside world. _/} +{/* +Workflows in Temporal may be replayed from the beginning of their history when resumed. In order for Temporal to recreate the exact state Workflow code was in, the code is required to be fully deterministic. To prevent breaking determinism, in the TypeScript SDK, Workflow code runs in an isolated execution environment and may not use any of the Node.js APIs or communicate directly with the outside world. */} Sinks are written as objects with methods. Similar to Activities, they are declared in the Worker and then proxied in Workflow code, and it helps to share types between both. diff --git a/docs/encyclopedia/clusters.mdx b/docs/encyclopedia/clusters.mdx index 54bb4abdb6..d94a45c996 100644 --- a/docs/encyclopedia/clusters.mdx +++ b/docs/encyclopedia/clusters.mdx @@ -311,8 +311,6 @@ The [Visibility store](/self-hosted-guide/visibility) in your Temporal Service s With Temporal Server v1.21, you can set up [Dual Visibility](/visibility#dual-visibility) to migrate your Visibility store from one database to another. -{/\* A Visibility store can be configured to provide [atandard Visibility](/visibility#standard-visibility) and [advanced Visibility](/visibility#advanced-visibility) features. - Support for separate standard and advanced Visibility setups will be deprecated from Temporal Server v1.21 onwards. Check [Supported databases](/self-hosted-guide/visibility) for updates. \*/} ## What is Archival? {#archival} @@ -426,9 +424,9 @@ For more information on mTLS configuration, see [tls configuration reference](/r #### Authentication and authorization -{/_ commenting this very generic explanation out. Can include it back in if everyone feels strongly. +{/* commenting this very generic explanation out. Can include it back in if everyone feels strongly. **Authentication** is the process of verifying users who want to access your application are actually the users you want accessing it. -**Authorization** is the verification of applications and data that a user on your Temporal Service or application has access to. _/} +**Authorization** is the verification of applications and data that a user on your Temporal Service or application has access to. */} Temporal provides authentication interfaces that can be set to restrict access to your data. These protocols address three areas: servers, client connections, and users. diff --git a/docs/encyclopedia/dataconversion.mdx b/docs/encyclopedia/dataconversion.mdx index 491c99c3b9..32ed5409ff 100644 --- a/docs/encyclopedia/dataconversion.mdx +++ b/docs/encyclopedia/dataconversion.mdx @@ -79,7 +79,6 @@ It encodes values in the following order: - Protobuf JSON - JSON -{/_ commenting this out but include this in the TS how-to. In SDKs that cannot determine parameter types at runtime (for example, TypeScript), Protobufs aren't included in the default converter. Also, Chad: This is only true by default on converting from payloads, but not on converting to payloads. And we have documented how to fix it for converting from payloads: https://legacy-documentation-sdks.temporal.io/typescript/data-converters#protobufs._/} diff --git a/docs/encyclopedia/visibility.mdx b/docs/encyclopedia/visibility.mdx index 6b664ac059..7ab8d527f2 100644 --- a/docs/encyclopedia/visibility.mdx +++ b/docs/encyclopedia/visibility.mdx @@ -35,8 +35,6 @@ The [Visibility store](/self-hosted-guide/visibility) in your Temporal Cluster s With Temporal Server v1.21, you can set up [Dual Visibility](#dual-visibility) to migrate your Visibility store from one database to another. -{/\* A Visibility store can be configured to provide [atandard Visibility](/visibility#standard-visibility) and [advanced Visibility](/visibility#advanced-visibility) features. - Support for separate standard and advanced Visibility setups will be deprecated from Temporal Server v1.21 onwards. Check [Supported databases](/self-hosted-guide/visibility) for updates. \*/} ## What is standard Visibility? {#standard-visibility} @@ -113,8 +111,6 @@ List Filters support the following operators: {/* - **ORDER BY** */} -{/\* The **ORDER BY** operator is supported only when Elasticsearch is used as the Visibility store. - The **ORDER BY** operator is currently not supported in Temporal Cloud. Custom Search Attributes of the `Text` type cannot be used in **ORDER BY** clauses. \*/} @@ -198,11 +194,6 @@ WorkflowId = '' or WorkflowId = '' WorkflowId IN ('', '') ``` -{/\* ```sql -WorkflowId = '' order by StartTime desc - -````*/} - ```sql WorkflowId = '' and ExecutionStatus = 'Running' ```` @@ -227,11 +218,6 @@ ExecutionTime < '2021-08-28T15:04:05+00:00' or ExecutionTime > '2021-08-22T15:04 WorkflowType STARTS_WITH '' ``` -{/\* ```sql -order by ExecutionTime - -```` - ```sql order by StartTime desc, CloseTime asc ```` diff --git a/docs/encyclopedia/workflows.mdx b/docs/encyclopedia/workflows.mdx index 054f37127a..fe566ab072 100644 --- a/docs/encyclopedia/workflows.mdx +++ b/docs/encyclopedia/workflows.mdx @@ -806,7 +806,6 @@ The primary purpose of using a Memo is to enhance the organization and managemen Add your own metadata, such as notes or descriptions, to a Workflow Execution, which lets you annotate and categorize Workflow Executions based on developer-defined criteria. This feature is particularly useful when dealing with numerous Workflow Executions because it facilitates the addition of context, reminders, or any other relevant information that aids in understanding or tracking the Workflow Execution. -{/\* :::note Use Memos judiciously diff --git a/docs/getting-started.mdx b/docs/getting-started.mdx index aa4f97e0ef..b3ea084f79 100644 --- a/docs/getting-started.mdx +++ b/docs/getting-started.mdx @@ -40,8 +40,3 @@ Get started with the [Temporal TypeScript SDK](https://learn.temporal.io/getting [](https://learn.temporal.io/getting_started/typescript) -{/_ -[![](/get-started/dotnet.svg)](https://learn.temporal.io/getting_started/dotnet) -Get started with the [Temporal .NET SDK](https://learn.temporal.io/getting_started/dotnet). -[![](/get-started/ruby.svg)](https://learn.temporal.io/getting_started/ruby) -_/} diff --git a/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx b/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx index 1a564ad4f4..be8c6091c2 100644 --- a/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx +++ b/docs/production-deployment/self-hosted-guide/multi-cluster-replication.mdx @@ -504,17 +504,6 @@ clusterMetadata: Then you can use the Temporal CLI tool to add cluster connections. All operations should be executed in both Clusters. -{/* tctl -address 127.0.0.1:7233 admin cluster upsert-remote-cluster --frontend_address "localhost:8233" */} - -{/* tctl -address 127.0.0.1:8233 admin cluster upsert-remote-cluster --frontend_address "localhost:7233" */} - -{/_tctl -address 127.0.0.1:7233 admin cluster upsert-remote-cluster --frontend_address "localhost:8233" --enable_connection false -tctl -address 127.0.0.1:8233 admin cluster upsert-remote-cluster --frontend_address "localhost:7233" --enable_connection false_/} - -{/_tctl -address 127.0.0.1:7233 admin cluster remove-remote-cluster --cluster "clusterB" -tctl -address 127.0.0.1:8233 admin cluster remove-remote-cluster --cluster "clusterA"_/} - -{/* THIS MUST BE CHECKED FOR ACCURACY */} ```shell # Add a cluster diff --git a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx index d92bc41e91..17e1b03ccb 100644 --- a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx +++ b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx @@ -104,9 +104,6 @@ One downside compared to [command line](#with-command-line) is it doesn't show e -{/\* -TODO redo this section when we publish a stable HTTP API - ## HTTP API The Web UI uses [`temporalio/ui-server`](https://github.com/temporalio/ui-server), an HTTP proxy for the gRPC API. diff --git a/docs/production-deployment/self-hosted-guide/visibility.mdx b/docs/production-deployment/self-hosted-guide/visibility.mdx index 9f67d0ae36..e63104fa0d 100644 --- a/docs/production-deployment/self-hosted-guide/visibility.mdx +++ b/docs/production-deployment/self-hosted-guide/visibility.mdx @@ -387,14 +387,6 @@ We recommend using Elasticsearch for large-scale operations on the Temporal Clus To integrate Elasticsearch with your Temporal Cluster, edit the `persistence` section of your `development.yaml` configuration file to add Elasticsearch as the `visibilityStore`, and run the index schema setup commands. -{/\* :::note - -The following steps are needed only if you have a "plain" [Temporal Server Docker image](https://hub.docker.com/r/temporalio/server). - -If you operate a Temporal Cluster using our [Helm charts](https://github.com/temporalio/helm-charts) or -[Docker Compose](https://github.com/temporalio/docker-compose), the Elasticsearch index schema and index are created automatically using the [auto-setup Docker image](https://hub.docker.com/r/temporalio/auto-setup). - -::: \*/} **Persistence configuration** diff --git a/docs/references/web-ui-environment-variables.mdx b/docs/references/web-ui-environment-variables.mdx index 91bb86742c..f0e00757ef 100644 --- a/docs/references/web-ui-environment-variables.mdx +++ b/docs/references/web-ui-environment-variables.mdx @@ -21,7 +21,7 @@ You can use environment variables to dynamically alter the configuration of your These can be used in many environments such as Docker. For example: -{/\* ``` +``` docker run \ -e TEMPORAL_ADDRESS=127.0.0.1:7233 \ -e TEMPORAL_UI_PORT=8080 \ @@ -39,7 +39,7 @@ docker run \ -e TEMPORAL_TLS_SERVER_NAME=tls-server \ temporalio/ui: -```*/} +``` The environment variables are defined in the [UI server configuration template file](https://github.com/temporalio/ui-server/blob/main/docker/config_template.yaml) and described in more detail below. @@ -200,4 +200,3 @@ Forward-specified HTTP headers to direct from HTTP API requests to the Temporal ## `TEMPORAL_DISABLE_WRITE_ACTIONS` Disables any button in the UI that allows the user to modify Workflows or Activities. -``` diff --git a/docs/web-ui.mdx b/docs/web-ui.mdx index 6d1f99d40c..cadebc62e9 100644 --- a/docs/web-ui.mdx +++ b/docs/web-ui.mdx @@ -124,19 +124,6 @@ Click **Settings** to see and manage the list of users in your account and to se On self-hosted Temporal Clusters, manage your users, metrics, and logging in your [server configuration](/references/configuration). -{/\* -AB: Commenting because this is redundant now? Also this needs to be updated for self-hosted clusters. -Displays the following information: - -- Description of the Namespace. -- Owner: Namespace owner. -- Global?: Whether the Namespace is a Global Namespace -- Retention Period: Namespace Retention Period -- History Archival: Whether History Archival is enabled -- Visibility Archival: Whether Visibility Archival is enabled -- Failover Version: Namespace Failover Version -- Clusters: Cluster information \*/} - ### Archive On self-hosted Temporal Clusters, Archive shows [Archived](/clusters#archival) data of your Workflow Executions on the Namespace. From 712520c7268322e7599907d711f8768c23e9c378 Mon Sep 17 00:00:00 2001 From: rachfop Date: Thu, 9 May 2024 09:16:44 -0700 Subject: [PATCH 08/26] Adds TOC --- docs/dev-guide/python/child-workflows.mdx | 1 + docs/dev-guide/python/core-application.mdx | 34 ++-- docs/dev-guide/python/index.mdx | 173 +++++++++++++-------- docs/dev-guide/python/observability.mdx | 22 ++- docusaurus.config.js | 6 +- 5 files changed, 145 insertions(+), 91 deletions(-) diff --git a/docs/dev-guide/python/child-workflows.mdx b/docs/dev-guide/python/child-workflows.mdx index aa9bc76f75..6d116a4242 100644 --- a/docs/dev-guide/python/child-workflows.mdx +++ b/docs/dev-guide/python/child-workflows.mdx @@ -20,6 +20,7 @@ tags: - child-workflows --- + ## Start a Child Workflow Execution {#child-workflows} **How to start a Child Workflow Execution** diff --git a/docs/dev-guide/python/core-application.mdx b/docs/dev-guide/python/core-application.mdx index 815b6b194a..6fe698654f 100644 --- a/docs/dev-guide/python/core-application.mdx +++ b/docs/dev-guide/python/core-application.mdx @@ -6,24 +6,24 @@ description: Develop basic Temporal application with workflows & activities in P slug: /dev-guide/python/core_application toc_max_heading_level: 2 keywords: - - temporal python core - - develop temporal workflow - - temporal python activities - - workflow logic requirements - - customizing workflow type - - activity parameters - - activity return values - - activity execution in workflow - - activity timeouts - - getting activity results - - temporal python worker - - registering workflow types + - temporal python core + - develop temporal workflow + - temporal python activities + - workflow logic requirements + - customizing workflow type + - activity parameters + - activity return values + - activity execution in workflow + - activity timeouts + - getting activity results + - temporal python worker + - registering workflow types tags: - - python - - python-sdk - - workflows - - activities - - core-application + - python + - python-sdk + - workflows + - activities + - core-application --- ## Develop a basic Workflow {#develop-workflows} diff --git a/docs/dev-guide/python/index.mdx b/docs/dev-guide/python/index.mdx index 892bdd24b6..43c42aec67 100644 --- a/docs/dev-guide/python/index.mdx +++ b/docs/dev-guide/python/index.mdx @@ -3,7 +3,7 @@ id: index title: Temporal Python SDK development documentation sidebar_label: Python SDK description: Learn how to use the Temporal Python SDK. -slug: /dev-guide/python +slug: //dev-guide/python toc_max_heading_level: 4 keywords: - dev guide @@ -15,94 +15,141 @@ tags: This guide is meant to provide a comprehensive overview of the structures, primitives, and features used in [Temporal Application](/temporal#temporal-application) development. -## Project-setup +## Core application -The project setup section of the Temporal Python SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in Python—that is, all the relevant steps to start a Workflow Execution that executes an Activity. +Develop basic Temporal application with workflows & activities in Python using Temporal SDK. -- [Install the Temporal CLI](/dev-guide/python/project-setup#install-cli): Download and install the Temporal CLI for Mac, Linux, or Windows. -- [Choose a development Cluster](/dev-guide/python/project-setup#choose-dev-cluster): Discover which development Cluster you should choose -- [Boilerplate Temporal Application project code](/dev-guide/python/project-setup#boilerplate-project): Discover the minimum code I need to create a boilerplate Temporal Application. -- [Start Workflow using the Temporal CLI](/dev-guide/python/project-setup#start-workflow): Learn how to start a Temporal Workflow using the Temporal CLI -- [Add a testing framework](/dev-guide/python/project-setup#test-framework): How to add a testing framework to your Temporal Application. +- [Develop a basic Workflow](devguide/python/coreapplication#develop-a-basic-workflow) +- [Develop a basic Activity](devguide/python/coreapplication#develop-a-basic-activity) +- [Start an Activity Execution](devguide/python/coreapplication#start-a-nactivity-execution) +- [Run a Worker Processes](/dev-guide/python/core-application#run-a-worker-processes) -## Durable-execution -The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. +## Temporal Client -- [Retrieve a Workflow Execution's Event History](/dev-guide/python/durable-execution#retrieve-event-history): Learn how to retrieve your Workflow Execution's Event History -- [Add a Replay test](/dev-guide/python/durable-execution#add-replay-test): Define the code needed to run a Worker Process in Python. -- [Intrinsic non-deterministic logic](/dev-guide/python/durable-execution#intrinsic-non-deterministic-logic): This kind of logic prevents the Workflow code from executing to completion because the Workflow can take a different code path than the one expected from the Event History. -- [Non-deterministic code changes](/dev-guide/python/durable-execution#durability-through-replays): History Replay, sometimes also called Workflow Replay, is the mechanism that Temporal uses to reconstruct the state of a Workflow Execution. Temporal provides Durable Execution via this Replay Functionality. +Master the Temporal Python Client with our comprehensive guide that covers everything from initialization to Workflow Execution. -## Foundations +- [Connect to development Temporal Service](/dev-guide/python/temporal-clients#connect-to-development-temporal-service) +- [Connect to Temporal Cloud](/dev-guide/python/temporal-clients#connect-to-temporal-cloud) +- [Start a Workflow Execution](/dev-guide/python/temporal-clients#start-a-workflow-execution) -The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application – that is, all the relevant steps to start a Workflow Execution that executes an Activity. -- [How to install the Temporal CLI and run a development server](/dev-guide/typescript/foundations#run-a-development-server): How to run a service on your local system. -- [How to install a Temporal SDK](/dev-guide/python/foundations#install-a-temporal-sdk): A Temporal SDK provides a framework for Temporal Application development. -- [How to connect a Temporal Client to a Temporal Cluster](/dev-guide/python/foundations#connect-to-a-dev-cluster): When connecting a Temporal Client to a Temporal Cluster, you must provide the address and port number of the Temporal Cluster. -- [How to connect to Temporal Cloud](/dev-guide/python/foundations#connect-to-temporal-cloud): Use a compatible mTLS CA certificate and mTLS private key and your Cloud Namespace to connect to Temporal Cloud. -- [How to develop a basic Workflow](/dev-guide/python/foundations#develop-workflows): Workflows are the fundamental unit of a Temporal Application, and it all starts with the development of a Workflow Definition. -- [How to develop a basic Activity](/dev-guide/python/foundations#develop-activities): One of the primary things that Workflows do is orchestrate the execution of Activities. -- [How to start an Activity Execution](/dev-guide/python/foundations#activity-execution): Calls to spawn Activity Executions are written within a Workflow Definition. -- [How to run Worker Processes](/dev-guide/python/foundations#run-a-dev-worker): The Worker Process is where Workflow Functions and Activity Functions are executed. -- [How to start a Workflow Execution](/dev-guide/python/foundations#start-workflow-execution): Workflow Execution semantics rely on several parameters—that is, to start a Workflow Execution you must supply a Task Queue that will be used for the Tasks (one that a Worker is polling), the Workflow Type, language-specific contextual data, and Workflow Function parameters. +## Test suites -## Features +The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. -The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. +- [Test frameworks](devguide/python/testsuites#test-frameworks) +- [Testing Activities](devguide/python/testsuites#testing-activities) +- [Testing Workflows](devguide/python/testsuites#testing-workflows) +- [How to Replay a Workflow Execution](/dev-guide/python/test-suites#how-to-replay-a-workflowexecution) -- [How to develop with Signals](/dev-guide/python/features#signals): A Signal is a message sent to a running Workflow Execution -- [How to develop with Queries](/dev-guide/python/features#queries): A Query is a synchronous operation that is used to get the state of a Workflow Execution. -- [What is a Dynamic Handler](/dev-guide/python/features#dynamic-handler): Dynamic Handlers are Workflows, Activities, Signals, or Queries that are unnamed and invoked when no other named handler matches the call from the Server at runtime. -- [Workflow timeouts](/dev-guide/python/features#workflow-timeouts): Each Workflow timeout controls the maximum duration of a different aspect of a Workflow Execution. -- [How to set Activity timeouts](/dev-guide/python/features#activity-timeouts): Each Activity timeout controls the maximum duration of a different aspect of an Activity Execution. -- [How to Heartbeat an Activity](/dev-guide/python/features#activity-heartbeats): An Activity Heartbeat is a ping from the Worker that is executing the Activity to the Temporal Cluster. -- [How to asynchronously complete an Activity](/dev-guide/python/features#asynchronous-activity-completion): Asynchronous Activity Completion enables the Activity Function to return without the Activity Execution completing. -- [Cancel an Activity from a Workflow](/dev-guide/python/features#cancel-an-activity): An Activity can be canceled from within a Workflow if the Activity sends Heartbeats. -- [How to interrupt a Workflow Execution](/dev-guide/python/features#interrupt-a-workflow-execution): You can interrupt a Workflow Execution by canceling it or terminating it. -- [How to start a Child Workflow Execution](/dev-guide/python/features#child-workflows): A Child Workflow Execution is a Workflow Execution that is scheduled from within another Workflow using a Child Workflow API. -- [How to Continue-As-New](/dev-guide/python/features#continue-as-new): Continue-As-New enables a Workflow Execution to close successfully and create a new Workflow Execution in a single atomic operation if the number of Events in the Event History is becoming too large. -- [What is a Timer?](/dev-guide/python/features#timers): A Timer lets a Workflow sleep for a fixed time period. -- [How to Schedule a Workflow](/dev-guide/python/features#schedule-a-workflow): Schedule a Workflow. -- [How to use Temporal Cron Jobs](/dev-guide/python/features#temporal-cron-jobs): A Temporal Cron Job is the series of Workflow Executions that occur when a Cron Schedule is provided in the call to spawn a Workflow Execution. -- [How to use Start Delay](/dev-guide/python/features#start-delay): Set the `start_delay` option in your Workflow Options. -## Debugging +## Failure detection -The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. +- [Workflow timeouts](devguide/python/failuredetection#workflow-timeouts) +- [Set Activity timeouts](devguide/python/failuredetection#set-activity-timeouts) +- [Heartbeat an Activity](devguide/python/failuredetection#heartbeat-an-activity) -- [Debugging](/dev-guide/python/debugging#debug): Testing provides a framework to facilitate Workflow and integration testing. -## Testing -The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. +## Messages + +Explore using Signals in Temporal Python to send messages to Workflows, with details on defining, sending, and handling Signals, including customization options. + +- [Develop with Signals](/dev-guide/python/messages#develop-with-signals) +- [Develop with Queries](/dev-guide/python/messages#develop-with-queries) +- [Develop with Updates](/dev-guide/python/messages#develop-with-updates) +- [What is a Dynamic Handler](/dev-guide/python/messages#what-is-a-dynamic-handler) + + + + +## Cancellation + +Cancel an Activity from a Workflow, sending Heartbeats and setting a Heartbeat Timeout, and handling cancellation errors. + +- [Cancel an Activity from a Workflow](//dev-guide/python/cancellation) -- [Test frameworks](/dev-guide/python/testing#test-frameworks): Testing provides a framework to facilitate Workflow and integration testing. -- [Testing Activities](/dev-guide/python/testing#test-activities): Testing provides a framework to facilitate Workflow and integration testing. -- [Testing Workflows](/dev-guide/python/testing#test-workflows): Testing provides a framework to facilitate Workflow and integration testing. -- [How to Replay a Workflow Execution](/dev-guide/python/testing#replay): Replay recreates the exact state of a Workflow Execution. -## Observability -Improve observability in your Python-based Temporal Workflows. View which Workflow Executions are tracked by the Temporal Platform and the state of any Workflow Execution. +## Asynchronous Activity Completion + +Complete an Activity without waiting for execution to finish, using Temporal Client and Activity Function. + +- [Asynchronously complete an Activity](/dev-guide/python/asynchronous-activity-completion#asynchronously-complete-an-activity) + -- [How to emit metrics](/dev-guide/python/observability#metrics): Each Temporal SDK is capable of emitting an optional set of metrics from either the Client or the Worker process. -- [How to setup Tracing](/dev-guide/python/observability#tracing): Tracing allows you to view the call graph of a Workflow along with its Activities and any Child Workflows. -- [How to log from a Workflow](/dev-guide/python/observability#logging): Send logs and errors to a logging service, so that when things go wrong, you can see what happened. -- [How to use Visibility APIs](/dev-guide/python/observability#visibility): The term Visibility, within the Temporal Platform, refers to the subsystems and APIs that enable an operator to view Workflow Executions that currently exist within a Cluster. ## Versioning The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. -- [How to use the Python SDK Patching API](/dev-guide/python/versioning#python-sdk-patching-api): Heres a sample implementation of patching in new code using the Python SDK's patching API. -- [How to use Worker Versioning in Python](/dev-guide/python/versioning#worker-versioning): Version your Python Workers by using build ID-based versioning +- [Introduction to Versioning](/dev-guide/python/versioning#introduction-to-versioning) +- [How to use the Patching API](/dev-guide/python/versioning#how-to-use-the-patching-api) +- [How to use Worker Versioning](/dev-guide/python/versioning#how-touse-worker-versioning) + + + +## Observability + +Learn about observability tools for Temporal applications, covering metrics, tracing, logging, and visibility to monitor and troubleshoot Workflows. + +- [Emit metrics](/dev-guide/python/observability#metrics) +- [Setup Tracing](/dev-guide/python/observability#tracing) +- [Log from a Workflow](/dev-guide/python/observability#logging) +- [Use Visibility APIs](/dev-guide/python/observability#visibility) + +## Debugging + +The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. + +- [Debugging](/dev-guide/python/debugging#debugging) + + +## Schedules + +Discover how to effectively Schedule Workflows in Temporal Python, covering creation, management, and operations like backfilling, deleting, and triggering Scheduled Workflows for precise automation timing. + +- [Schedule a Workflow](/dev-guide/python/schedules#schedule-a-workflow) +- [Temporal Cron Jobs](/dev-guide/python/schedules#temporal-cron-jobs) +- [Start Delay](/dev-guide/python/schedules#start-delay) + + -## Converters +## Data encryption The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. -- [Custom Payload Codecs](/dev-guide/python/converters#custom-payload-codec): Create a custom `PayloadCodec` implementation and define your encryption/compression and decryption/decompression logic in the `encode` and `decode` functions. -- [Custom payload conversion sequence](/dev-guide/python/converters#conversion-sequence): Create your custom `PayloadConverter` and set it on a `DataConverter` in your Client options. -- [Custom Payload Converter](/dev-guide/python/converters#custom-payload-converter): Use a `CompositeDataConverter` to apply custom `PayloadConverter` in a specified order. +- [Custom Payload Codec](/dev-guide/python/data-encryption#custom-payload-codec) +- [Payload conversion](/dev-guide/python/data-encryption#payload-conversion) + + +## Child Workflows + +Spawn a new Workflow from within another Workflow, with options for Parent Close Policy and handling Child Workflow Events. + +- [Start a Child Workflow Execution](devguide/python/child-workflows) + + + +## Continue-As-New + +Close a Workflow Execution and create a new one with the same Workflow ID, new Run ID, and fresh Event History. + +- [Continue-As-New](/dev-guide/python/continueasnew#continue-as-new) + + +## Timers + +Learn how to use timers within Temporal Workflows to delay execution, enabling durable and long-term scheduling of tasks that can persist even if the worker or cluster goes down. + +- [What is a Timer](/dev-guide/python/timers#what-is-a-timer) + + + +## Interrupt a Workflow Execution + +Learn how to interrupt a workflow execution by canceling or terminating, including the differences and use cases for each method. + +- [Interrupt a Workflow Execution](/dev-guide/python/interrupt-workflow#interrupt-a-workflow-execution}) + diff --git a/docs/dev-guide/python/observability.mdx b/docs/dev-guide/python/observability.mdx index eeab9834af..66a15eb14f 100644 --- a/docs/dev-guide/python/observability.mdx +++ b/docs/dev-guide/python/observability.mdx @@ -40,7 +40,9 @@ This section covers features related to viewing the state of the application, in - [Logging](#logging) - [Visibility](#visibility) -## How to emit metrics {#metrics} +## Emit metrics {#metrics} + +**How to emit metrics** Each Temporal SDK is capable of emitting an optional set of metrics from either the Client or the Worker process. For a complete list of metrics capable of being emitted, see the [SDK metrics reference](/references/sdk-metrics). @@ -69,7 +71,9 @@ new_runtime = Runtime(telemetry=TelemetryConfig(metrics=PrometheusConfig(bind_ad my_client = await Client.connect("my.temporal.host:7233", runtime=new_runtime) ``` -## How to setup Tracing {#tracing} +## Setup Tracing {#tracing} + +**How to setup Tracing** Tracing allows you to view the call graph of a Workflow along with its Activities and any Child Workflows. @@ -87,7 +91,9 @@ Then the [`temporalio.contrib.opentelemetry.TracingInterceptor`](https://python. When your Client is connected, spans are created for all Client calls, Activities, and Workflow invocations on the Worker. Spans are created and serialized through the server to give one trace for a Workflow Execution. -## How to log from a Workflow {#logging} +## Log from a Workflow {#logging} + +**How to log from a Workflow** Send logs and errors to a logging service, so that when things go wrong, you can see what happened. @@ -117,17 +123,17 @@ Then in your Workflow, set your [`logger`](https://python.temporal.io/temporalio workflow.logger.info("Workflow input parameter: %s" % name) ``` -### How to provide a custom logger {#custom-logger} +### Custom logger {#custom-logger} Use a custom logger for logging. Use the built-in [Logging facility for Python](https://docs.python.org/3/library/logging.html) to set a custom logger. -## How to use Visibility APIs {#visibility} +## Visibility APIs {#visibility} The term Visibility, within the Temporal Platform, refers to the subsystems and APIs that enable an operator to view Workflow Executions that currently exist within a Cluster. -### How to use Search Attributes {#search-attributes} +### Use Search Attributes {#search-attributes} The typical method of retrieving a Workflow Execution is by its Workflow Id. @@ -197,7 +203,7 @@ To set custom Search Attributes, use the `search_attributes` parameter of the [' ) ``` -### How to upsert Search Attributes {#upsert-search-attributes} +### Upsert Search Attributes {#upsert-search-attributes} You can upsert Search Attributes to add or update Search Attributes from within Workflow code. @@ -218,7 +224,7 @@ The keys are added to or replace the existing Search Attributes, similar to [`di workflow.upsert_search_attributes({"CustomKeywordField": ["new-value"]}) ``` -### How to remove a Search Attribute from a Workflow {#remove-search-attribute} +### Remove a Search Attribute from a Workflow {#remove-search-attribute} To remove a Search Attribute that was previously set, set it to an empty array: `[]`. diff --git a/docusaurus.config.js b/docusaurus.config.js index 718f1cd835..b45ebb3dde 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -9,9 +9,9 @@ module.exports = async function createConfigAsync() { tagline: "Build invincible applications", url: "https://docs.temporal.io", baseUrl: "/", - onBrokenAnchors: "warn", - onBrokenLinks: "warn", - onBrokenMarkdownLinks: "warn", + onBrokenAnchors: "throw", + onBrokenLinks: "throw", + onBrokenMarkdownLinks: "throw", favicon: "img/favicon.svg", organizationName: "temporalio", // Usually your GitHub org/user name. projectName: "temporal-documentation", // Usually your repo name. From 6ca5cb9e91d7e0c12b3e11010efb8ee607bb9039 Mon Sep 17 00:00:00 2001 From: rachfop Date: Thu, 9 May 2024 09:19:54 -0700 Subject: [PATCH 09/26] Fix slug --- docs/dev-guide/python/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev-guide/python/index.mdx b/docs/dev-guide/python/index.mdx index 43c42aec67..b17ed3728c 100644 --- a/docs/dev-guide/python/index.mdx +++ b/docs/dev-guide/python/index.mdx @@ -3,7 +3,7 @@ id: index title: Temporal Python SDK development documentation sidebar_label: Python SDK description: Learn how to use the Temporal Python SDK. -slug: //dev-guide/python +slug: /dev-guide/python toc_max_heading_level: 4 keywords: - dev guide From 1e48df1782dba484e45ffa0e3f35345d4de720f0 Mon Sep 17 00:00:00 2001 From: rachfop Date: Thu, 9 May 2024 10:40:19 -0700 Subject: [PATCH 10/26] Add python stuff --- .../asynchronous-activity-completion.mdx | 2 +- docs/dev-guide/python/child-workflows.mdx | 2 +- docs/dev-guide/python/core-application.mdx | 2 +- docs/dev-guide/python/data-encryption.mdx | 2 +- docs/dev-guide/python/debugging.mdx | 2 +- docs/dev-guide/python/durable-execution.mdx | 400 ----- docs/dev-guide/python/failure-detection.mdx | 2 +- docs/dev-guide/python/features.mdx | 1292 ----------------- docs/dev-guide/python/foundations.mdx | 926 ------------ docs/dev-guide/python/index.mdx | 52 +- docs/dev-guide/python/interrupt-workflow.mdx | 4 +- docs/dev-guide/python/project-setup.mdx | 971 ------------- docs/dev-guide/python/test-suites.mdx | 2 +- docs/encyclopedia/activities.mdx | 14 +- docs/encyclopedia/retry-policies.mdx | 4 +- docs/encyclopedia/workflows.mdx | 20 +- docusaurus.config.js | 1 - 17 files changed, 55 insertions(+), 3643 deletions(-) delete mode 100644 docs/dev-guide/python/durable-execution.mdx delete mode 100644 docs/dev-guide/python/features.mdx delete mode 100644 docs/dev-guide/python/foundations.mdx delete mode 100644 docs/dev-guide/python/project-setup.mdx diff --git a/docs/dev-guide/python/asynchronous-activity-completion.mdx b/docs/dev-guide/python/asynchronous-activity-completion.mdx index a493a81feb..70520fafe6 100644 --- a/docs/dev-guide/python/asynchronous-activity-completion.mdx +++ b/docs/dev-guide/python/asynchronous-activity-completion.mdx @@ -3,7 +3,7 @@ id: asynchronous-activity-completion title: Asynchronous Activity Completion sidebar_label: Asynchronous Activity Completion description: Complete an Activity without waiting for execution to finish, using Temporal Client and Activity Function. -slug: /dev-guide/python/asynchronous_activity_completion +slug: /dev-guide/python/asynchronous-activity-completion toc_max_heading_level: 2 keywords: - asynchronous activity completion diff --git a/docs/dev-guide/python/child-workflows.mdx b/docs/dev-guide/python/child-workflows.mdx index 6d116a4242..b32ce39a05 100644 --- a/docs/dev-guide/python/child-workflows.mdx +++ b/docs/dev-guide/python/child-workflows.mdx @@ -3,7 +3,7 @@ id: child-workflows title: Child Workflows sidebar_label: Child Workflows description: Spawn a new Workflow from within another Workflow, with options for Parent Close Policy and handling Child Workflow Events. -slug: /dev-guide/python/child_workflows +slug: /dev-guide/python/child-workflows toc_max_heading_level: 2 keywords: - child workflow execution diff --git a/docs/dev-guide/python/core-application.mdx b/docs/dev-guide/python/core-application.mdx index 6fe698654f..8690a1f7f3 100644 --- a/docs/dev-guide/python/core-application.mdx +++ b/docs/dev-guide/python/core-application.mdx @@ -3,7 +3,7 @@ id: core-application title: Core application sidebar_label: Core application description: Develop basic Temporal application with workflows & activities in Python using Temporal SDK. -slug: /dev-guide/python/core_application +slug: /dev-guide/python/core-application toc_max_heading_level: 2 keywords: - temporal python core diff --git a/docs/dev-guide/python/data-encryption.mdx b/docs/dev-guide/python/data-encryption.mdx index 36265e9b1f..4eb51e98da 100644 --- a/docs/dev-guide/python/data-encryption.mdx +++ b/docs/dev-guide/python/data-encryption.mdx @@ -3,7 +3,7 @@ id: data-encryption title: Data encryption sidebar_label: Data encryption description: The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. -slug: /dev-guide/python/data_encryption +slug: /dev-guide/python/data-encryption toc_max_heading_level: 2 keywords: - temporal python data encryption diff --git a/docs/dev-guide/python/debugging.mdx b/docs/dev-guide/python/debugging.mdx index 8b4469ea0f..89c7355c60 100644 --- a/docs/dev-guide/python/debugging.mdx +++ b/docs/dev-guide/python/debugging.mdx @@ -33,7 +33,7 @@ You can debug production Workflows using: - [Web UI](/web-ui) - [Temporal CLI](/cli) -- [Replay](/dev-guide/python/testing#replay) +- [Replay](/dev-guide/python/test-suites#replay) - [Tracing](/dev-guide/python/observability#tracing) - [Logging](/dev-guide/python/observability#logging) diff --git a/docs/dev-guide/python/durable-execution.mdx b/docs/dev-guide/python/durable-execution.mdx deleted file mode 100644 index 00fe86198a..0000000000 --- a/docs/dev-guide/python/durable-execution.mdx +++ /dev/null @@ -1,400 +0,0 @@ ---- -id: durable-execution -title: Develop code that durably executes - Python SDK dev guide -sidebar_label: Develop for durability -description: The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. -slug: /dev-guide/python/durable-execution -toc_max_heading_level: 4 -keywords: - - determinism - - developer-guide-doc-type - - durable execution - - event history - - go sdk - - introduction-doc-type - - logger - - python sdk - - replay - - replay test - - replayer - - sleep - - testing - - tests - - time skipping - - timer - - workflow testing -tags: - - determinism - - developer-guide-doc-type - - durable-execution - - event-history - - go-sdk - - introduction-doc-type - - logger - - python-sdk - - replay - - replay-test - - replayer - - sleep - - testing - - tests - - time-skipping - - timer - - workflow-testing ---- - -When it comes to the Temporal Platform's ability to durably execute code, the SDK's ability to [Replay](/encyclopedia/temporal-sdks#replays) a Workflow Execution is a major aspect of that. -This chapter introduces the development patterns which enable that. - -:::competency Develop for a Durable Execution - -This chapter of the Temporal Python SDK developer's guide introduces best practices to developing deterministic Workflows that can be Replayed, enabling a [Durable Execution](/temporal#durable-execution). - -By the end of this section you will know basic best practices for Workflow Definition development. - -Learning objectives: - -- Identify SDK API calls that map to Events -- Recognize non-deterministic Workflow code -- Explain how Workflow code execution progresses - -The information in this chapter is also available in the [Temporal 102 course](https://learn.temporal.io/courses/temporal_102/). - -::: - -This chapter builds on the [Construct a new Temporal Application project](/dev-guide/python/project-setup) chapter and relies on the Background Check use case and sample applications as a means to contextualize the information. - -This chapter walks through the following sequence: - -- Retrieve a Workflow Execution's Event History -- Add a Replay test to your application -- Intrinsic non-deterministic logic -- Non-deterministic code changes - -## Retrieve a Workflow Execution's Event History {#retrieve-event-history} - -There are a few ways to view and download a Workflow Execution's [Event History](/workflows#event-history). -We recommend starting off by using either the Temporal CLI or the Web UI to access it. - -### Using the Temporal CLI - -Use the Temporal CLI's `temporal workflow show` command to save your Workflow Execution's Event History to a local file. -Run the command from the `/tests` directory so that the file saves alongside the other testing files. - -```text -. -├── backgroundcheck.py -├── main.py -├── ssntraceactivity.py -└── tests - ├── __init__.py - ├── backgroundcheck_workflow_history.json - ├── conftest.py - └── replay_dacx_test.py -``` - -**Local dev server** - -If you have been following along with the earlier chapters of this guide, your Workflow Id might be something like `backgroundcheck_workflow`. - -```shell -temporal workflow show \ - --workflow-id backgroundcheck_workflow \ - --namespace backgroundcheck_namespace \ - --output json > tests/backgroundcheck_workflow_history.json -``` - -:::info Workflow Id returns the most recent Workflow Execution - -The most recent Event History for that Workflow Id is returned when you only use the Workflow Id to identify the Workflow Execution. -Use the `--run-id` option as well to get the Event History of an earlier Workflow Execution by the same Workflow Id. - -::: - -**Temporal Cloud** - -For Temporal Cloud, remember to either provide the paths to your certificate and private keys as command options, or set those paths as environment variables: - -```shell -temporal workflow show \ - --workflow-id backgroundcheck_workflow \ - --namespace backgroundcheck_namespace \ - --tls-cert-path /path/to/ca.pem \ - --tls-key-path /path/to/ca.key \ - --output json > tests/backgroundcheck_workflow_history.json -``` - -**Self-hosted Temporal Cluster** - -For self-hosted environments, you might be using the Temporal CLI command alias: - -```shell -temporal_docker workflow show \ - --workflow-id backgroundcheck_workflow \ - --namespace backgroundcheck_namespace \ - --output json > tests/backgroundcheck_workflow_history.json -``` - -### Via the UI - -A Workflow Execution's Event History is also available in the Web UI. - -Navigate to the Workflows page in the UI and select the Workflow Execution. - -
-
-

Select a Workflow Execution from the Workflows page

-
-
- Select a Workflow Execution from the Workflows page -
-
- -From the Workflow details page you can copy the Event History from the JSON tab and paste it into the `backgroundcheck_workflow_history.json` file. - -
-
-

Copy Event History JSON object from the Web UI

-
-
- Copy Event History JSON object from the Web UI -
-
- -## Add a Replay test {#add-replay-test} - -Add the Replay test to the set of application tests. -The Replayer is available from the [Replayer](https://python.temporal.io/temporalio.worker.Replayer.html) class in the SDK. -Register the Workflow Definition and then specify an existing Event History to compare to. - -Run the tests in the test directory (pytest). -If the Workflow Definition and the Event History are incompatible, then the test fails. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - - - - - -@pytest.mark.asyncio -async def test_replay_workflow_history_from_file(): - async with await WorkflowEnvironment.start_time_skipping(): - with open("tests/backgroundcheck_workflow_history.json", "r") as f: - history_json = json.load(f) -``` - -[WorkflowEnvironment](https://python.temporal.io/temporalio.testing.WorkflowEnvironment.html) is a class in the Temporal Python SDK that provides a testing suite for running Workflows and Activity code. -[start_time_skipping()](https://python.temporal.io/temporalio.testing.WorkflowEnvironment.html#start_time_skipping) is a method that allows you to skip time in a Workflow Execution. -By skipping time, you can quickly test how Workflows behave over extended periods of time without needing to wait in real-time. - -### Why add a Replay test? {#why-replay-test} - -The Replay test is important because it verifies whether the current Workflow code (Workflow Definition) remains compatible with the Event Histories of earlier Workflow Executions. - -A failed Replay test typically indicates that the Workflow code exhibits non-deterministic behavior. -In other words, for a specific input, the Workflow code can follow different code paths during each execution, resulting in distinct sequences of Events. -The Temporal Platform's ability to ensure durable execution depends on the SDK's capability to re-execute code and return to the most recent state of the Workflow Function execution. - -The Replay test executes the same steps as the SDK and verifies compatibility. - -Workflow code becomes non-deterministic primarily through two main avenues: - -1. **[Intrinsic non-deterministic logic](#intrinsic-non-deterministic-logic):** This occurs when Workflow state or branching logic within the Workflow gets determined by factors beyond the SDK's control. -2. **[Non-deterministic code changes](#durability-through-replays):** When you change your Workflow code and deploy those changes while there are still active Workflow Executions relying on older code versions. - -## Intrinsic non-deterministic logic {#intrinsic-non-deterministic-logic} - -"Intrinsic non-determinism" refers to types of Workflow code that can disrupt the completion of a Workflow by diverging from the expected code path based on the Event History. -For instance, using a random number to decide which Activities to execute is a classic example of intrinsic non-deterministic code. - -Luckily, for Python developers, the Python SDK employs a sort of “Sandbox” environment that either wraps many of the typical non-deterministic calls, making them safe to use, or prevents you from running the code in the first place. - -Calls that are disallowed will cause a Workflow Task to fail with a "Restricted Workflow Access" error, necessitating code modification for the Workflow to proceed. - -Calls such as `random.randint()` are actually caught by the SDK, so that the resulting number persists and doesn’t cause deterministic issues. - -However the sandbox is not foolproof and non-deterministic issues can still occur. - -Developers are encouraged to use the SDK’s APIs when possible and avoid potentially intrinsically non-deterministic code: - -- **Random Number Generation:** - - Replace `random.randint()` with `workflow.random().randint()`. -- **Time Management:** - - Use `workflow.now()` instead of `datetime.now()` or `workflow.time()` instead `time.time()` for current time. - - Leverage the custom `asyncio` event loop in Workflows; use `asyncio.sleep()` as needed. - -Read more about [How the Python Sandbox works](/encyclopedia/python-sdk-sandbox) for details. - -Other common ways to introduce non-deterministic issues into a Workflow: - -1. **External System Interaction:** - - Avoid direct external API calls, file I/O operations, or interactions with other services. - - Utilize Activities for these operations. -2. **Data Structure Iteration:** - - Use Python dictionaries as they are deterministically ordered. -3. **Run Id Usage:** - - Be cautious with storing or evaluating the run Id. - -## Non-deterministic code changes {#durability-through-replays} - -The most important thing to take away from the section is to make sure you have an application versioning plan whenever you are developing and maintaining a Temporal Application that will eventually deploy to a production environment. - -Versioning APIs and versioning strategies are covered in other parts of the developer's guide, this chapter sets the stage to understand why and how to approach those strategies. - -{/* TODO ^ update with links to those places */} - -### The Event History - -Inspect the Event History of a recent Background Check Workflow using the `temporal workflow show` command: - -```shell -temporal workflow show \ - --workflow-id backgroundcheck_workflow \ - --namespace backgroundcheck_namespace -``` - -You should see output similar to this: - -```shell -Progress: - ID Time Type - 1 2023-10-25T20:28:03Z WorkflowExecutionStarted - 2 2023-10-25T20:28:03Z WorkflowTaskScheduled - 3 2023-10-25T20:28:03Z WorkflowTaskStarted - 4 2023-10-25T20:28:03Z WorkflowTaskCompleted - 5 2023-10-25T20:28:03Z ActivityTaskScheduled - 6 2023-10-25T20:28:03Z ActivityTaskStarted - 7 2023-10-25T20:28:03Z ActivityTaskCompleted - 8 2023-10-25T20:28:03Z WorkflowTaskScheduled - 9 2023-10-25T20:28:03Z WorkflowTaskStarted - 10 2023-10-25T20:28:03Z WorkflowTaskCompleted - 11 2023-10-25T20:28:03Z WorkflowExecutionCompleted - -Result: - Status: COMPLETED - Output: ["pass"] -``` - -The preceding output shows eleven Events in the Event History ordered in a particular sequence. -All Events are created by the Temporal Server in response to either a request coming from a Temporal Client, or a [Command](/workflows#command) coming from the Worker. - -Let's take a closer look: - -- `WorkflowExecutionStarted`: This Event is created in response to the request to start the Workflow Execution. -- `WorkflowTaskScheduled`: This Event indicates a Workflow Task is in the Task Queue. -- `WorkflowTaskStarted`: This Event indicates that a Worker successfully polled the Task and started evaluating Workflow code. -- `WorkflowTaskCompleted`: This Event indicates that the Worker suspended execution and made as much progress that it could. -- `ActivityTaskScheduled`: This Event indicates that the ExecuteActivity API was called and the Worker sent the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command to the Server. -- `ActivityTaskStarted`: This Event indicates that the Worker successfully polled the Activity Task and started evaluating Activity code. -- `ActivityTaskCompleted`: This Event indicates that the Worker completed evaluation of the Activity code and returned any results to the Server. - In response, the Server schedules another Workflow Task to finish evaluating the Workflow code resulting in the remaining Events, `WorkflowTaskScheduled`.`WorkflowTaskStarted`, `WorkflowTaskCompleted`, `WorkflowExecutionCompleted`. - -:::info Event reference - -The [Event reference](/references/events) serves as a source of truth for all possible Events in the Workflow Execution's Event History and the data that is stored in them. - -::: - -### Add a call to sleep {#add-sleep-call} - -In the following sample, we add a couple of logging statements and a Timer to the Workflow code to see how this affects the Event History. - -Use the `asyncio.sleep()` API to cause the Workflow to sleep for a minute before the call to execute the Activity. -The Temporal Python SDK offers deterministic implementations to the following API calls: - -- [workflow.now()](https://python.temporal.io/temporalio.workflow.html#now) -- [workflow.random()](https://python.temporal.io/temporalio.workflow.html#random) -- [workflow.time_ns()](https://python.temporal.io/temporalio.workflow.html#time_ns) -- [workflow.time()](https://python.temporal.io/temporalio.workflow.html#time) -- [workflow.uuid4()](https://python.temporal.io/temporalio.workflow.html#uuid4) - -Use the `workflow.logger` API to log from Workflows to avoid seeing repeated logs from the Replay of the Workflow code. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -import asyncio -from datetime import timedelta - -from temporalio import workflow - -with workflow.unsafe.imports_passed_through(): - from ssntraceactivity import ssn_trace_activity - -@workflow.defn() -class BackgroundCheck: - @workflow.run - async def run(self, ssn: str) -> str: - random_number = workflow.random().randint(1, 100) - if random_number < 50: - await asyncio.sleep(60) - workflow.logger.info("Sleeping for 60 seconds") - return await workflow.execute_activity( - ssn_trace_activity, - ssn, - schedule_to_close_timeout=timedelta(seconds=5), - ) -``` - -### Inspect the new Event History {#inspect-new-event-history} - -After updating your Workflow code to include the logging and Timer, run your tests again. -You should expect to see the `TestReplayWorkflowHistoryFromFile` test fail. -This is because the code we added creates new Events and alters the Event History sequence. - -To get this test to pass, we must get an updated Event History JSON file. -[Start a new Workflow](/dev-guide/python/project-setup#start-workflow) and after it is complete [download the Event History as a JSON object](#retrieve-event-history). - -:::info Double check Task Queue names - -Reminder that this guide jumps between several sample applications using multiple Task Queues. -Make sure you are starting Workflows on the same Task Queue that the Worker is listening to. -And, always make sure that all Workers listening to the same Task Queue are registered with the same Workflows and Activities. - -::: - -If you inspect the new Event History, you will see two new Events in response to the `asyncio.sleep()` API call which send the [StartTimer Command](/references/commands#starttimer) to the Server: - -- `TimerStarted` -- `TimerFired` - -However, it is also important to note that you don't see any Events related to logging. -And if you were to remove the Sleep call from the code, there wouldn't be a compatibility issue with the previous code. -This is to highlight that only certain code changes within Workflow code is non-deterministic. -The basic thing to remember is that if the API call causes a [Command](/references/commands) to create Events in the Workflow History that takes a new path from the existing Event History then it is a non-deterministic change. - -This becomes a critical aspect of Workflow development when there are running Workflows that have not yet completed and rely on earlier versions of the code. - -Practically, that means non-deterministic changes include but are not limited to the following: - -- Adding, removing, reordering an Activity call inside a Workflow Execution -- Switching the Activity Type used in a call to `ExecuteActivity` -- Adding or removing a Timer -- Altering the execution order of Activities or Timers relative to one another - -The following are a few examples of changes that do not lead to non-deterministic errors: - -- Modifying non-Command generating statements in a Workflow Definition, such as logging statements -- Changing attributes in the `ActivityOptions` -- Modifying code inside of an Activity Definition diff --git a/docs/dev-guide/python/failure-detection.mdx b/docs/dev-guide/python/failure-detection.mdx index fefee09859..676b6923e0 100644 --- a/docs/dev-guide/python/failure-detection.mdx +++ b/docs/dev-guide/python/failure-detection.mdx @@ -3,7 +3,7 @@ id: failure-detection title: Failure detection sidebar_label: Failure detection Description: Guidance on setting timeouts, retries, and heartbeat functionality for Workflows and Activities in Python with Temporal. -slug: /dev-guide/python/failure_detection +slug: /dev-guide/python/failure-detection toc_max_heading_level: 2 keywords: - workflow timeouts diff --git a/docs/dev-guide/python/features.mdx b/docs/dev-guide/python/features.mdx deleted file mode 100644 index 409f58dda6..0000000000 --- a/docs/dev-guide/python/features.mdx +++ /dev/null @@ -1,1292 +0,0 @@ ---- -id: features -title: Features - Python SDK feature guide -sidebar_label: Features -sidebar_position: 5 -description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. -toc_max_heading_level: 5 -keywords: - - activity - - child workflow - - client - - code sample - - continue-as-new - - cron - - developer-guide - - developer-guide-doc-type - - dynamic activity - - dynamic query - - dynamic signal - - dynamic workflow - - explanation - - guide-context - - how-to - - parent close policy - - python - - python sdk - - query - - retry policy - - schedule - - scheduled workflow execution - - schedules - - sdk - - signal - - signal with start - - sleep - - timeout - - timer - - timers - - update - - workflow - - workflow-execution -tags: - - activity - - child-workflow - - client - - code-sample - - continue-as-new - - cron - - developer-guide - - developer-guide-doc-type - - dynamic-activity - - dynamic-query - - dynamic-signal - - dynamic-workflow - - explanation - - guide-context - - how-to - - parent-close-policy - - python - - python-sdk - - query - - retry-policy - - schedule - - scheduled-workflow-execution - - schedules - - sdk - - signal - - signal-with-start - - sleep - - timeout - - timer - - timers - - update - - workflow - - workflow-execution ---- - -The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. - -In this section you can find the following: - -- [How to develop Signals](#signals) -- [How to develop Queries](#queries) -- [How to start a Child Workflow Execution](#child-workflows) -- [How to start a Temporal Cron Job](#temporal-cron-jobs) -- [How to use Continue-As-New](#continue-as-new) -- [How to set Workflow timeouts & retries](#workflow-timeouts) -- [How to set Activity timeouts & retries](#activity-timeouts) -- [How to Heartbeat an Activity](#activity-heartbeats) -- [How to Asynchronously complete an Activity](#asynchronous-activity-completion) -- [How to Schedule a Workflow](#schedule-a-workflow) -- [How to use a Temporal Cron Job](#temporal-cron-jobs) -- [How to use Start Delay](#start-delay) - -## How to develop with Signals {#signals} - -A [Signal](/workflows#signal) is a message sent to a running Workflow Execution. - -Signals are defined in your code and handled in your Workflow Definition. -Signals can be sent to Workflow Executions from a Temporal Client or from another Workflow Execution. - -A Signal has a name and can have arguments. - -- The name, also called a Signal type, is a string. -- The arguments must be serializable. - To define a Signal, set the Signal decorator [`@workflow.signal`](https://python.temporal.io/temporalio.workflow.html#signal) on the Signal function inside your Workflow. - -Non-dynamic methods can only have positional arguments. -Temporal suggests taking a single argument that is an object or data class of fields that can be added to as needed. - -Return values from Signal methods are ignored. - -**Customize names** - -You can have a name parameter to customize the Signal's name, otherwise it defaults to the name of the Signal method. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... - @workflow.signal - async def submit_greeting(self, name: str) -> None: - await self._pending_greetings.put(name) - - @workflow.signal - def exit(self) -> None: -# ... - @workflow.signal(name="Custom Signal Name") - async def custom_signal(self, name: str) -> None: - await self._pending_greetings.put(name) -``` - -Workflows listen for Signals by the Signal's name. - -To send a Signal to the Workflow, use the [signal](https://python.temporal.io/temporalio.client.WorkflowHandle.html#signal) method from the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -# ... -# ... - await handle.signal(GreetingWorkflow.submit_greeting, "User 1") -``` - -### How to send a Signal from a Temporal Client {#send-signal-from-client} - -When a Signal is sent successfully from the Temporal Client, the [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the Event History of the Workflow that receives the Signal. - -To send a Signal from the Client, use the [signal()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#signal) function on the Workflow handle. - -To get the Workflow handle, you can use any of the following options. - -- Use the [get_workflow_handle()](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle) method. -- Use the [get_workflow_handle_for()](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle_for) method to get a type-safe Workflow handle by its Workflow Id. -- Use the [start_workflow()](https://python.temporal.io/temporalio.client.Client.html#start_workflow) to start a Workflow and return its handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -# ... -# ... - client = await Client.connect("localhost:7233") - handle = await client.start_workflow( - GreetingWorkflow.run, - id="your-greeting-workflow", - task_queue="signal-tq", - ) - await handle.signal(GreetingWorkflow.submit_greeting, "User 1") -``` - -### How to send a Signal from a Workflow {#send-signal-from-workflow} - -A Workflow can send a Signal to another Workflow, in which case it's called an _External Signal_. - -When an External Signal is sent: - -- A [SignalExternalWorkflowExecutionInitiated](/references/events#signalexternalworkflowexecutioninitiated) Event appears in the sender's Event History. -- A [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the recipient's Event History. - -Use [`get_external_workflow_handle_for`](https://python.temporal.io/temporalio.workflow.html#get_external_workflow_handle_for) to get a typed Workflow handle to an existing Workflow by its identifier. -Use [`get_external_workflow_handle`](https://python.temporal.io/temporalio.workflow.html#get_external_workflow_handle) when you don't know the type of the other Workflow. - -:::note - -The Workflow Type passed is only for type annotations and not for validation. - -::: - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn -class WorkflowB: - @workflow.run - async def run(self) -> None: - handle = workflow.get_external_workflow_handle_for(WorkflowA.run, "workflow-a") - await handle.signal(WorkflowA.your_signal, "signal argument") -``` - -### How to Signal-With-Start {#signal-with-start} - -Signal-With-Start is used from the Client. -It takes a Workflow Id, Workflow arguments, a Signal name, and Signal arguments. - -If there's a Workflow running with the given Workflow Id, it will be signaled. If there isn't, a new Workflow will be started and immediately signaled. - -To send a Signal-With-Start in Python, use the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) method and pass the `start_signal` argument with the name of your Signal. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -# ... -# ... -async def main(): - client = await Client.connect("localhost:7233") - await client.start_workflow( - GreetingWorkflow.run, - id="your-signal-with-start-workflow", - task_queue="signal-tq", - start_signal="submit_greeting", - start_signal_args=["User Signal with Start"], - ) -``` - -## How to develop with Queries {#queries} - -A [Query](/workflows#query) is a synchronous operation that is used to get the state of a Workflow Execution. - -### How to define a Query {#define-query} - -A Query has a name and can have arguments. - -- The name, also called a Query type, is a string. -- The arguments must be [serializable](/dataconversion). - -To define a Query, set the Query decorator [`@workflow.query`](https://python.temporal.io/temporalio.workflow.html#query) on the Query function inside your Workflow. - -**Customize names** - -You can have a name parameter to customize the Query's name, otherwise it defaults to the name of the Query method. - -:::note - -You can either set the `name` or the `dynamic` parameter in a Query's decorator, but not both. - -::: - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.query - def greeting(self) -> str: - return self._greeting -``` - -### How to handle a Query {#handle-query} - -Queries are handled by your Workflow. - -Don’t include any logic that causes [Command](/workflows#command) generation within a Query handler (such as executing Activities). -Including such logic causes unexpected behavior. - -To send a Query to the Workflow, use the [`query`](https://python.temporal.io/temporalio.client.WorkflowHandle.html#query) method from the [`WorkflowHandle`](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - - -# ... - result = await handle.query(GreetingWorkflow.greeting) -``` - -### How to send a Query {#send-query} - -Queries are sent from a Temporal Client. - -To send a Query to a Workflow Execution from Client code, use the `query()` method on the Workflow handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - result = await handle.query(GreetingWorkflow.greeting) -``` - -## How to develop with Updates {#updates} - -An [Update](/workflows#update) is an operation that can mutate the state of a Workflow Execution and return a response. - -### How to define an Update {#define-update} - -Workflow Updates handlers are methods in your Workflow Definition designed to handle updates. -These updates can be triggered during the lifecycle of a Workflow Execution. - -**Define an Update Handler** - -To define an update handler, use the [@workflow.update](https://python.temporal.io/temporalio.workflow.html#update) decorator on a method within your Workflow. This decorator can be applied to both asynchronous and synchronous methods. - -- **Decorator Usage:** Apply `@workflow.update` to the method intended to handle updates. -- **Overriding:** If a method with this decorator is overridden, the overriding method should also be decorated with `@workflow.update`. -- **Validator Method:** Optionally, you can define a validator method for the update handler. This validator is specified using `@update_handler_method_name.validator` and is invoked before the update handler. -- **Method Parameters:** Update handlers should only use positional parameters. For non-dynamic methods, it's recommended to use a single parameter that is an object or data class, which allows for future expansion of fields. -- **Return Values:** The update handler can return a serializable value. This value is sent back to the caller of the update. - -```python -# ... - @workflow.update - async def update_workflow_status(self) -> str: - self.is_complete = True - return "Workflow status updated" -``` - -### How to send an Update from a Temporal Client {#send-update-from-client} - -To send a Workflow Update from a Temporal Client, call the [execute_update](https://python.temporal.io/temporalio.client.WorkflowHandle.html#execute_update) method on the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. - -```python -# ... - update_result = await handle.execute_update( - HelloWorldWorkflow.update_workflow_status - ) - print(f"Update Result: {update_result}") -``` - -## What is a Dynamic Handler {#dynamic-handler} - -Temporal supports Dynamic Workflows, Activities, Signals, and Queries. -These are unnamed handlers that are invoked if no other statically defined handler with the given name exists. - -Dynamic Handlers provide flexibility to handle cases where the names of Workflows, Activities, Signals, or Queries aren't known at run time. - -:::caution - -Dynamic Handlers should be used judiciously as a fallback mechanism rather than the primary approach. -Overusing them can lead to maintainability and debugging issues down the line. - -Instead, Workflows, Activities, Signals, and Queries should be defined statically whenever possible, with clear names that indicate their purpose. -Use static definitions as the primary way of structuring your Workflows. - -Reserve Dynamic Handlers for cases where the handler names are not known at compile time and need to be looked up dynamically at runtime. -They are meant to handle edge cases and act as a catch-all, not as the main way of invoking logic. - -::: - -### How to set a Dynamic Workflow {#set-a-dynamic-workflow} - -A Dynamic Workflow in Temporal is a Workflow that is invoked dynamically at runtime if no other Workflow with the same name is registered. -A Workflow can be made dynamic by adding `dynamic=True` to the `@workflow.defn` decorator. -You must register the Workflow with the [Worker](https://python.temporal.io/temporalio.worker.html) before it can be invoked. - -The Workflow Definition must then accept a single argument of type `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn(dynamic=True) -class DynamicWorkflow: - @workflow.run - async def run(self, args: Sequence[RawValue]) -> str: - name = workflow.payload_converter().from_payload(args[0].payload, str) - return await workflow.execute_activity( - default_greeting, - YourDataClass("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set a Dynamic Activity {#set-a-dynamic-activity} - -A Dynamic Activity in Temporal is an Activity that is invoked dynamically at runtime if no other Activity with the same name is registered. -An Activity can be made dynamic by adding `dynamic=True` to the `@activity.defn` decorator. -You must register the Activity with the [Worker](https://python.temporal.io/temporalio.worker.html) before it can be invoked. - -The Activity Definition must then accept a single argument of type `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.activity.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@activity.defn(dynamic=True) -async def dynamic_greeting(args: Sequence[RawValue]) -> str: - arg1 = activity.payload_converter().from_payload(args[0].payload, YourDataClass) - return ( - f"{arg1.greeting}, {arg1.name}!\nActivity Type: {activity.info().activity_type}" - ) -# ... -@workflow.defn -class GreetingWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - "unregistered_activity", - YourDataClass("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set a Dynamic Signal {#set-a-dynamic-signal} - -A Dynamic Signal in Temporal is a Signal that is invoked dynamically at runtime if no other Signal with the same input is registered. -A Signal can be made dynamic by adding `dynamic=True` to the `@signal.defn` decorator. - -The Signal Handler should accept `self`, a string input, and a `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.signal(dynamic=True) - async def dynamic_signal(self, name: str, args: Sequence[RawValue]) -> None: - await self._pending_greetings.put(name) -``` - -### How to set a Dynamic Query {#set-a-dynamic-query} - -A Dynamic Query in Temporal is a Query that is invoked dynamically at runtime if no other Query with the same name is registered. -A Query can be made dynamic by adding `dynamic=True` to the `@query.defn` decorator. - -The Query Handler should accept `self`, a string name, and a `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.query(dynamic=True) - def dynamic_query(self, input: str, args: Sequence[RawValue]) -> str: - return self._greeting -``` - -## Workflow timeouts {#workflow-timeouts} - -Each Workflow timeout controls the maximum duration of a different aspect of a Workflow Execution. - -Workflow timeouts are set when [starting the Workflow Execution](#workflow-timeouts). - -- **[Workflow Execution Timeout](/workflows#workflow-execution-timeout)** - restricts the maximum amount of time that a single Workflow Execution can be executed. -- **[Workflow Run Timeout](/workflows#workflow-run-timeout):** restricts the maximum amount of time that a single Workflow Run can last. -- **[Workflow Task Timeout](/workflows#workflow-task-timeout):** restricts the maximum amount of time that a Worker can execute a Workflow Task. - -Set the timeout to either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. - -Available timeouts are: - -- `execution_timeout` -- `run_timeout` -- `task_timeout` - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - result = await client.execute_workflow( - YourWorkflow.run, - "your timeout argument", - id="your-workflow-id", - task_queue="your-task-queue", - # Set Workflow Timeout duration - execution_timeout=timedelta(seconds=2), - # run_timeout=timedelta(seconds=2), - # task_timeout=timedelta(seconds=2), - ) -``` - -### Workflow retries {#workflow-retries} - -A Retry Policy can work in cooperation with the timeouts to provide fine controls to optimize the execution experience. - -Use a [Retry Policy](/retry-policies) to retry a Workflow Execution in the event of a failure. - -Workflow Executions do not retry by default, and Retry Policies should be used with Workflow Executions only in certain situations. - -Set the Retry Policy to either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - handle = await client.execute_workflow( - YourWorkflow.run, - "your retry policy argument", - id="your-workflow-id", - task_queue="your-task-queue", - retry_policy=RetryPolicy(maximum_interval=timedelta(seconds=2)), - ) -``` - -## How to set Activity timeouts {#activity-timeouts} - -Each Activity timeout controls the maximum duration of a different aspect of an Activity Execution. - -The following timeouts are available in the Activity Options. - -- **[Schedule-To-Close Timeout](/activities#schedule-to-close-timeout):** is the maximum amount of time allowed for the overall [Activity Execution](/activities#activity-execution). -- **[Start-To-Close Timeout](/activities#start-to-close-timeout):** is the maximum time allowed for a single [Activity Task Execution](/workers#activity-task-execution). -- **[Schedule-To-Start Timeout](/activities#schedule-to-start-timeout):** is the maximum amount of time that is allowed from when an [Activity Task](/workers#activity-task) is scheduled to when a [Worker](/workers#worker) starts that Activity Task. - -An Activity Execution must have either the Start-To-Close or the Schedule-To-Close Timeout set. - -Activity options are set as keyword arguments after the Activity arguments. - -Available timeouts are: - -- schedule_to_close_timeout -- schedule_to_start_timeout -- start_to_close_timeout - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - activity_timeout_result = await workflow.execute_activity( - your_activity, - YourParams(greeting, "Activity Timeout option"), - # Activity Execution Timeout - start_to_close_timeout=timedelta(seconds=10), - # schedule_to_start_timeout=timedelta(seconds=10), - # schedule_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set an Activity Retry Policy {#activity-retries} - -A Retry Policy works in cooperation with the timeouts to provide fine controls to optimize the execution experience. - -Activity Executions are automatically associated with a default [Retry Policy](/retry-policies) if a custom one is not provided. - -To create an Activity Retry Policy in Python, set the [RetryPolicy](https://python.temporal.io/temporalio.common.RetryPolicy.html) class within the [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) or [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) function. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.common import RetryPolicy -# ... - activity_result = await workflow.execute_activity( - your_activity, - YourParams(greeting, "Retry Policy options"), - start_to_close_timeout=timedelta(seconds=10), - # Retry Policy - retry_policy=RetryPolicy( - backoff_coefficient=2.0, - maximum_attempts=5, - initial_interval=timedelta(seconds=1), - maximum_interval=timedelta(seconds=2), - # non_retryable_error_types=["ValueError"], - ), - ) -``` - -## How to Heartbeat an Activity {#activity-heartbeats} - -An [Activity Heartbeat](/activities#activity-heartbeat) is a ping from the [Worker Process](/workers#worker-process) that is executing the Activity to the [Temporal Cluster](/clusters). -Each Heartbeat informs the Temporal Cluster that the [Activity Execution](/activities#activity-execution) is making progress and the Worker has not crashed. -If the Cluster does not receive a Heartbeat within a [Heartbeat Timeout](/activities#heartbeat-timeout) time period, the Activity will be considered failed and another [Activity Task Execution](/workers#activity-task-execution) may be scheduled according to the Retry Policy. - -Heartbeats may not always be sent to the Cluster—they may be [throttled](/activities#throttling) by the Worker. - -Activity Cancellations are delivered to Activities from the Cluster when they Heartbeat. Activities that don't Heartbeat can't receive a Cancellation. -Heartbeat throttling may lead to Cancellation getting delivered later than expected. - -Heartbeats can contain a `details` field describing the Activity's current progress. -If an Activity gets retried, the Activity can access the `details` from the last Heartbeat that was sent to the Cluster. - -To Heartbeat an Activity Execution in Python, use the [`heartbeat()`](https://python.temporal.io/temporalio.activity.html#heartbeat) API. - -```python -@activity.defn -async def your_activity_definition() -> str: - activity.heartbeat("heartbeat details!") -``` - -In addition to obtaining cancellation information, Heartbeats also support detail data that persists on the server for retrieval during Activity retry. -If an Activity calls `heartbeat(123, 456)` and then fails and is retried, `heartbeat_details` returns an iterable containing `123` and `456` on the next Run. - -#### How to set a Heartbeat Timeout {#heartbeat-timeout} - -A [Heartbeat Timeout](/activities#heartbeat-timeout) works in conjunction with [Activity Heartbeats](/activities#activity-heartbeat). - -[`heartbeat_timeout`](https://python.temporal.io/temporalio.worker.StartActivityInput.html#heartbeat_timeout) is a class variable for the [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) function used to set the maximum time between Activity Heartbeats. - -```python -workflow.start_activity( - activity="your-activity", - schedule_to_close_timeout=timedelta(seconds=5), - heartbeat_timeout=timedelta(seconds=1), -) -``` - -`execute_activity()` is a shortcut for [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) that waits on its result. - -To get just the handle to wait and cancel separately, use `start_activity()`. `execute_activity()` should be used in most cases unless advanced task capabilities are needed. - -```python -workflow.execute_activity( - activity="your-activity", - name, - schedule_to_close_timeout=timedelta(seconds=5), - heartbeat_timeout=timedelta(seconds=1), -) -``` - -## How to asynchronously complete an Activity {#asynchronous-activity-completion} - -[Asynchronous Activity Completion](/activities#asynchronous-activity-completion) enables the Activity Function to return without the Activity Execution completing. - -There are three steps to follow: - -1. The Activity provides the external system with identifying information needed to complete the Activity Execution. - Identifying information can be a [Task Token](/activities#task-token), or a combination of Namespace, Workflow Id, and Activity Id. -2. The Activity Function completes in a way that identifies it as waiting to be completed by an external system. -3. The Temporal Client is used to Heartbeat and complete the Activity. - -To mark an Activity as completing asynchronously, do the following inside the Activity. - -```python -# Capture token for later completion -captured_token = activity.info().task_token -activity.raise_complete_async() -``` - -To update an Activity outside the Activity, use the [get_async_activity_handle()](https://python.temporal.io/temporalio.client.Client.html#get_async_activity_handle) method to get the handle of the Activity. - -```python -handle = my_client.get_async_activity_handle(task_token=captured_token) -``` - -Then, on that handle, you can call the results of the Activity, `heartbeat`, `complete`, `fail`, or `report_cancellation` method to update the Activity. - -```python -await handle.complete("Completion value.") -``` - -## Cancel an Activity from a Workflow {#cancel-an-activity} - -Canceling an Activity from within a Workflow requires that the Activity Execution sends Heartbeats and sets a Heartbeat Timeout. -If the Heartbeat is not invoked, the Activity cannot receive a cancellation request. -When any non-immediate Activity is executed, the Activity Execution should send Heartbeats and set a [Heartbeat Timeout](/activities#heartbeat-timeout) to ensure that the server knows it is still working. - -When an Activity is canceled, an error is raised in the Activity at the next available opportunity. -If cleanup logic needs to be performed, it can be done in a `finally` clause or inside a caught cancel error. -However, for the Activity to appear canceled the exception needs to be re-raised. - -:::note - -Unlike regular Activities, [Local Activities](/activities#local-activity) can be canceled if they don't send Heartbeats. -Local Activities are handled locally, and all the information needed to handle the cancellation logic is available in the same Worker process. - -::: - -To cancel an Activity from a Workflow Execution, call the [cancel()](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.cancel) method on the Activity handle that is returned from [start_activity()](https://python.temporal.io/temporalio.workflow.html#start_activity). - -```python -@activity.defn -async def cancellable_activity(input: ComposeArgsInput) -> NoReturn: - try: - while True: - print("Heartbeating cancel activity") - await asyncio.sleep(0.5) - activity.heartbeat("some details") - except asyncio.CancelledError: - print("Activity cancelled") - raise - - -@activity.defn -async def run_activity(input: ComposeArgsInput): - print("Executing activity") - return input.arg1 + input.arg2 - -@workflow.defn - class GreetingWorkflow: - @workflow.run - async def run(self, input: ComposeArgsInput) -> None: - activity_handle = workflow.start_activity( - cancellable_activity, - ComposeArgsInput(input.arg1, input.arg2), - start_to_close_timeout=timedelta(minutes=5), - heartbeat_timeout=timedelta(seconds=30), - ) - - await asyncio.sleep(3) - activity_handle.cancel() -``` - -:::note - -The Activity handle is a Python task. -By calling `cancel()`, you're essentially requesting the task to be canceled. - -::: - -## How to interrupt a Workflow Execution {#interrupt-a-workflow-execution} - -You can interrupt a Workflow Execution in one of the following ways: - -- [Cancel](#cancel) -- [Terminate](#terminate) - -The following are the main differences between canceling and terminating a Workflow in Temporal: - -##### Cancel - -Canceling a Workflow provides a graceful way to stop Workflow Execution. -This action resembles sending a `SIGTERM` to a process. - -- The system records a `WorkflowExecutionCancelRequested` event in the Workflow History. -- A Workflow Task gets scheduled to process the cancelation. -- The Workflow code can handle the cancelation and execute any cleanup logic. -- The system doesn't forcefully stop the Workflow. - -For more information, see [How to cancel a Workflow Execution](#cancel-a-workflow-execution). - -##### Terminate - -Terminating a Workflow forcefully stops Workflow Execution. -This action resembles killing a process. - -- The system records a `WorkflowExecutionTerminated` event in the Workflow History. -- The termination forcefully and immediately stops the Workflow Execution. -- The Workflow code gets no chance to handle termination. -- A Workflow Task doesn't get scheduled. - -For more information, see [How to terminate a Workflow Execution](#terminate-a-workflow-execution). - -##### Summary - -In summary: - -- Canceling provides a graceful way to stop the Workflow and allows it to handle cancelation logic. -- Termination forcefully stops the Workflow and prevents any further events. - -In most cases, canceling is preferable because it allows the Workflow to finish gracefully. -Terminate only if the Workflow is stuck and cannot be canceled normally. - -### How to cancel a Workflow Execution in Python {#cancel-a-workflow-execution} - -To cancel a Workflow Execution in Python, use the [cancel()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#cancel) function on the Workflow handle. - -```python -await client.get_workflow_handle("your_workflow_id").cancel() -``` - -### How to terminate a Workflow Execution in Python {#terminate-a-workflow-execution} - -To terminate a Workflow Execution in Python, use the [terminate()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#terminate) function on the Workflow handle. - -```python -await client.get_workflow_handle("your_workflow_id").terminate() -``` - -## How to start a Child Workflow Execution {#child-workflows} - -A [Child Workflow Execution](/encyclopedia/child-workflows) is a Workflow Execution that is scheduled from within another Workflow using a Child Workflow API. - -When using a Child Workflow API, Child Workflow related Events ([StartChildWorkflowExecutionInitiated](/references/events#startchildworkflowexecutioninitiated), [ChildWorkflowExecutionStarted](/references/events#childworkflowexecutionstarted), [ChildWorkflowExecutionCompleted](/references/events#childworkflowexecutioncompleted), etc...) are logged in the Workflow Execution Event History. - -Always block progress until the [ChildWorkflowExecutionStarted](/references/events#childworkflowexecutionstarted) Event is logged to the Event History to ensure the Child Workflow Execution has started. -After that, Child Workflow Executions may be abandoned using the default _Abandon_ [Parent Close Policy](/encyclopedia/child-workflows#parent-close-policy) set in the Child Workflow Options. - -To be sure that the Child Workflow Execution has started, first call the Child Workflow Execution method on the instance of Child Workflow future, which returns a different future. - -Then get the value of an object that acts as a proxy for a result that is initially unknown, which is what waits until the Child Workflow Execution has spawned. - -To spawn a Child Workflow Execution in Python, use the [`execute_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#execute_child_workflow) function which starts the Child Workflow and waits for completion or -use the [`start_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#start_child_workflow) function to start a Child Workflow and return its handle. -This is useful if you want to do something after it has only started, or to get the Workflow/Run ID, or to be able to signal it while running. - -:::note - -`execute_child_workflow()` is a helper function for `start_child_workflow()` plus `await handle`. - -::: - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn -class ComposeGreetingWorkflow: - @workflow.run - async def run(self, input: ComposeGreetingInput) -> str: - return f"{input.greeting}, {input.name}!" - - -@workflow.defn -class GreetingWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_child_workflow( - ComposeGreetingWorkflow.run, - ComposeGreetingInput("Hello", name), - id="hello-child-workflow-workflow-child-id", -# ... - ) -``` - -#### How to set a Parent Close Policy {#parent-close-policy} - -A [Parent Close Policy](/encyclopedia/child-workflows#parent-close-policy) determines what happens to a Child Workflow Execution if its Parent changes to a Closed status (Completed, Failed, or Timed Out). - -The default Parent Close Policy option is set to terminate the Child Workflow Execution. - -Set the `parent_close_policy` parameter inside the [`start_child_workflow`](https://python.temporal.io/temporalio.workflow.html#start_child_workflow) function or the [`execute_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#execute_child_workflow) function to specify the behavior of the Child Workflow when the Parent Workflow closes. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.workflow import ParentClosePolicy -# ... -# ... -@workflow.defn -class ComposeGreetingWorkflow: - @workflow.run - async def run(self, input: ComposeGreetingInput) -> str: - return f"{input.greeting}, {input.name}!" - - -@workflow.defn -class GreetingWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_child_workflow( - ComposeGreetingWorkflow.run, - ComposeGreetingInput("Hello", name), - id="hello-child-workflow-workflow-child-id", - parent_close_policy=ParentClosePolicy.ABANDON, - ) -``` - -## How to Continue-As-New {#continue-as-new} - -[Continue-As-New](/workflows#continue-as-new) enables a Workflow Execution to close successfully and create a new Workflow Execution in a single atomic operation if the number of Events in the Event History is becoming too large. -The Workflow Execution spawned from the use of Continue-As-New has the same Workflow Id, a new Run Id, and a fresh Event History and is passed all the appropriate parameters. - -To Continue-As-New in Python, call the [`continue_as_new()`](https://python.temporal.io/temporalio.workflow.html#continue_as_new) function from inside your Workflow, which will stop the Workflow immediately and Continue-As-New. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn -class LoopingWorkflow: - @workflow.run - async def run(self, iteration: int) -> None: - if iteration == 5: - return - await asyncio.sleep(10) - workflow.continue_as_new(iteration + 1) -``` - -## What is a Timer? {#timers} - -A Workflow can set a durable timer for a fixed time period. -In some SDKs, the function is called `sleep()`, and in others, it's called `timer()`. - -A Workflow can sleep for months. -Timers are persisted, so even if your Worker or Temporal Cluster is down when the time period completes, as soon as your Worker and Cluster are back up, the `sleep()` call will resolve and your code will continue executing. - -Sleeping is a resource-light operation: it does not tie up the process, and you can run millions of Timers off a single Worker. - -To set a Timer in Python, call the [`asyncio.sleep()`](https://docs.python.org/3/library/asyncio-task.html#sleeping) function and pass the duration in seconds you want to wait before continuing. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - await asyncio.sleep(10) -``` - -## How to Schedule a Workflow {#schedule-a-workflow} - -Scheduling Workflows is a crucial aspect of any automation process, especially when dealing with time-sensitive tasks. By scheduling a Workflow, you can automate repetitive tasks, reduce the need for manual intervention, and ensure timely execution of your business processes - -Use any of the following action to help Schedule a Workflow Execution and take control over your automation process. - -### How to Create a Scheduled Workflow {#create} - -The create action enables you to create a new Schedule. When you create a new Schedule, a unique Schedule ID is generated, which you can use to reference the Schedule in other Schedule commands. - -To create a Scheduled Workflow Execution in Python, use the [create_schedule()](https://python.temporal.io/temporalio.client.Client.html#create_schedule) -asynchronous method on the Client. -Then pass the Schedule ID and the Schedule object to the method to create a Scheduled Workflow Execution. -Set the `action` parameter to `ScheduleActionStartWorkflow` to start a Workflow Execution. -Optionally, you can set the `spec` parameter to `ScheduleSpec` to specify the schedule or set the `intervals` parameter to `ScheduleIntervalSpec` to specify the interval. -Other options include: `cron_expressions`, `skip`, `start_at`, and `jitter`. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - await client.create_schedule( - "workflow-schedule-id", - Schedule( - action=ScheduleActionStartWorkflow( - YourSchedulesWorkflow.run, - "my schedule arg", - id="schedules-workflow-id", - task_queue="schedules-task-queue", - ), - spec=ScheduleSpec( - intervals=[ScheduleIntervalSpec(every=timedelta(minutes=2))] - ), - state=ScheduleState(note="Here's a note on my Schedule."), - ), - ) -``` - -### How to Backfill a Scheduled Workflow {#backfill} - -The backfill action executes Actions ahead of their specified time range. This command is useful when you need to execute a missed or delayed Action, or when you want to test the Workflow before its scheduled time. - -To Backfill a Scheduled Workflow Execution in Python, use the [backfill()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#backfill) asynchronous -method on the Schedule Handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -import asyncio -from datetime import datetime, timedelta - -from temporalio.client import Client, ScheduleBackfill, ScheduleOverlapPolicy - - - -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - now = datetime.utcnow() - ( - await handle.backfill( - ScheduleBackfill( - start_at=now - timedelta(minutes=10), - end_at=now - timedelta(minutes=9), - overlap=ScheduleOverlapPolicy.ALLOW_ALL, - ), - ), - ) -``` - -### How to Delete a Scheduled Workflow {#delete} - -The delete action enables you to delete a Schedule. When you delete a Schedule, it does not affect any Workflows that were started by the Schedule. - -To delete a Scheduled Workflow Execution in Python, use the [delete()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#delete) asynchronous method on the Schedule Handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - - - -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - await handle.delete() -``` - -### How to Describe a Scheduled Workflow {#describe} - -The describe action shows the current Schedule configuration, including information about past, current, and future Workflow Runs. This command is helpful when you want to get a detailed view of the Schedule and its associated Workflow Runs. - -To describe a Scheduled Workflow Execution in Python, use the [describe()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#delete) asynchronous method on the Schedule Handle. -You can get a complete list of the attributes of the Scheduled Workflow Execution from the [ScheduleDescription](https://python.temporal.io/temporalio.client.ScheduleDescription.html) class. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - desc = await handle.describe() - - print(f"Returns the note: {desc.schedule.state.note}") -``` - -### How to List a Scheduled Workflow {#list} - -The list action lists all the available Schedules. This command is useful when you want to view a list of all the Schedules and their respective Schedule IDs. - -To list all schedules, use the [list_schedules()](https://python.temporal.io/temporalio.client.Client.html#list_schedules) asynchronous method on the Client. -If a schedule is added or deleted, it may not be available in the list immediately. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main() -> None: - client = await Client.connect("localhost:7233") - async for schedule in await client.list_schedules(): - print(f"List Schedule Info: {schedule.info}.") -``` - -### How to Pause a Scheduled Workflow {#pause} - -The pause action enables you to pause and unpause a Schedule. When you pause a Schedule, all the future Workflow Runs associated with the Schedule are temporarily stopped. This command is useful when you want to temporarily halt a Workflow due to maintenance or any other reason. - -To pause a Scheduled Workflow Execution in Python, use the [pause()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#pause) asynchronous method on the Schedule Handle. -You can pass a `note` to the `pause()` method to provide a reason for pausing the schedule. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - await handle.pause(note="Pausing the schedule for now") -``` - -### How to Trigger a Scheduled Workflow {#trigger} - -The trigger action triggers an immediate action with a given Schedule. By default, this action is subject to the Overlap Policy of the Schedule. This command is helpful when you want to execute a Workflow outside of its scheduled time. - -To trigger a Scheduled Workflow Execution in Python, use the [trigger()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#trigger) asynchronous method on the Schedule Handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - await handle.trigger() -``` - -### How to Update a Scheduled Workflow {#update} - -The update action enables you to update an existing Schedule. This command is useful when you need to modify the Schedule's configuration, such as changing the start time, end time, or interval. - -Create a function that takes `ScheduleUpdateInput` and returns `ScheduleUpdate`. -To update a Schedule, use a callback to build the update from the description. -The following example updates the Schedule to use a new argument. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - async def update_schedule_simple(input: ScheduleUpdateInput) -> ScheduleUpdate: - schedule_action = input.description.schedule.action - - if isinstance(schedule_action, ScheduleActionStartWorkflow): - schedule_action.args = ["my new schedule arg"] - return ScheduleUpdate(schedule=input.description.schedule) -``` - -## How to use Temporal Cron Jobs {#temporal-cron-jobs} - -A [Temporal Cron Job](/workflows#temporal-cron-job) is the series of Workflow Executions that occur when a Cron Schedule is provided in the call to spawn a Workflow Execution. - -A Cron Schedule is provided as an option when the call to spawn a Workflow Execution is made. - -You can set each Workflow to repeat on a schedule with the `cron_schedule` option from either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - result = await client.execute_workflow( - CronWorkflow.run, - id="your-workflow-id", - task_queue="your-task-queue", - cron_schedule="* * * * *", - ) - print(f"Results: {result}") -``` - -## How to use Start Delay {#start-delay} - -Use the `start_delay` to schedule a Workflow Execution at a specific one-time future point rather than on a recurring schedule. - -Use the `start_delay` option in either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods in the Client. - -```python -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - start_delay=timedelta(hours=1, minutes=20, seconds=30) - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` diff --git a/docs/dev-guide/python/foundations.mdx b/docs/dev-guide/python/foundations.mdx deleted file mode 100644 index 9845ddc52b..0000000000 --- a/docs/dev-guide/python/foundations.mdx +++ /dev/null @@ -1,926 +0,0 @@ ---- -id: foundations -title: Foundations - Python SDK feature guide -sidebar_label: Foundations -description: The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application – that is, all the relevant steps to start a Workflow Execution that executes an Activity. -toc_max_heading_level: 4 -keywords: - - activity - - activity definition - - activity execution - - api reference - - cli - - cli-feature - - cluster - - code sample - - code samples - - developer-guide - - developer-guide-doc-type - - guide-context - - how-to-doc-type - - python - - python sdk - - sdk - - task queue - - temporal client - - temporal cloud - - timeout - - worker - - workflow - - workflow execution - - workflow parameters - - workflow return values -tags: - - activity - - activity-definition - - activity-execution - - api-reference - - cli - - cli-feature - - cluster - - code-sample - - code-samples - - developer-guide - - developer-guide-doc-type - - guide-context - - how-to-doc-type - - python - - python-sdk - - sdk - - task-queue - - temporal-client - - temporal-cloud - - timeout - - worker - - workflow - - workflow-execution - - workflow-parameters - - workflow-return-values ---- - -The Foundations section of the Temporal Developer's guide covers the minimum set of concepts and implementation details needed to build and run a [Temporal Application](/temporal#temporal-application)—that is, all the relevant steps to start a [Workflow Execution](#develop-workflows) that executes an [Activity](#develop-activities). - -In this section you can find the following: - -- [Run a development Cluster](/dev-guide/typescript/foundations#run-a-development-server) -- [Connect to a dev Cluster](#connect-to-a-dev-cluster) -- [Connect to Temporal Cloud](#connect-to-temporal-cloud) -- [Develop a Workflow](#develop-workflows) -- [Develop an Activity](#develop-activities) -- [Start an Activity Execution](#activity-execution) -- [Run a dev Worker](#run-a-dev-worker) -- [Run a Temporal Cloud Worker](#run-a-dev-worker) -- [Start a Workflow Execution](#start-workflow-execution) - -## How to install the Temporal CLI and run a development server {#run-a-development-server} - -This section describes how to install the [Temporal CLI](/cli) and run a development Cluster. -The local development Cluster comes packaged with the [Temporal Web UI](/web-ui). - -For information on deploying and running a self-hosted production Cluster, see the [Self-hosted guide](/self-hosted-guide), or sign up for [Temporal Cloud](/cloud) and let us run your production Cluster for you. - -Temporal CLI is a tool for interacting with a Temporal Cluster from the command line and it includes a distribution of the Temporal Server and Web UI. -This local development Cluster runs as a single process with zero runtime dependencies and it supports persistence to disk and in-memory mode through SQLite. - -**Install the Temporal CLI** - -Choose one of the following install methods to install the Temporal CLI. - - - - -- Install the Temporal CLI with Homebrew. - - ```bash - brew install temporal - ``` - -- Install the Temporal CLI with cURL. - - ```bash - curl -sSf https://temporal.download/cli.sh | sh - ``` - -- Install the Temporal CLI from CDN. - 1. Select the platform and architecture needed. - - - Download for Darwin amd64 - - - - Download for Darwin arm64 - - 2. Extract the downloaded archive. - 3. Add the `temporal` binary to your PATH. - - - - -- Install the Temporal CLI with cURL. - - ```bash - curl -sSf https://temporal.download/cli.sh | sh - ``` - -- Install the Temporal CLI from CDN. - 1. Select the platform and architecture needed. - - - Download for Linux amd64 - - - - Download for Linux arm64 - - 2. Extract the downloaded archive. - 3. Add the `temporal` binary to your PATH. - - - - -- Install the Temporal CLI from CDN. - 1. Select the platform and architecture needed and download the binary. - - - Download for Windows amd64 - - - - Download for Windows arm64 - - 2. Extract the downloaded archive. - 3. Add the `temporal.exe` binary to your PATH. - - - - -**Start the Temporal Development Server** - -Start the Temporal Development Server by using the `server start-dev` command. - -```bash -temporal server start-dev -``` - -This command automatically starts the Web UI, creates the default [Namespace](/namespaces), and uses an in-memory database. - -The Temporal Server should be available on `localhost:7233` and the Temporal Web UI should be accessible at [`http://localhost:8233`](http://localhost:8233/). - -The server's startup configuration can be customized using command line options. -For a full list of options, run: - -```bash -temporal server start-dev --help -``` - -## How to install a Temporal SDK {#install-a-temporal-sdk} - -A [Temporal SDK](/encyclopedia/temporal-sdks) provides a framework for [Temporal Application](/temporal#temporal-application) development. - -An SDK provides you with the following: - -- A [Temporal Client](/encyclopedia/temporal-sdks#temporal-client) to communicate with a [Temporal Cluster](/clusters). -- APIs to develop [Workflows](/workflows). -- APIs to create and manage [Worker Processes](/workers#worker). -- APIs to author [Activities](/activities#activity-definition). - -[![Python 3.7+](https://img.shields.io/pypi/pyversions/temporalio.svg?style=for-the-badge)](https://pypi.org/project/temporalio) -[![PyPI](https://img.shields.io/pypi/v/temporalio.svg?style=for-the-badge)](https://pypi.org/project/temporalio) - -To install the latest version of the Temporal Python package, run the following command. - -```bash -pip install temporalio -``` - -### How to find the Python SDK API reference {#api-reference} - -The Temporal Python SDK API reference is published on [python.temporal.io](https://python.temporal.io/index.html). - -### Where are SDK-specific code examples? {#code-samples} - -You can find a complete list of executable code samples in [Temporal's GitHub repository](https://github.com/temporalio?q=samples-&type=all&language=&sort=). - -Additionally, several of the [Tutorials](https://learn.temporal.io) are backed by a fully executable template application. - -- [Python samples library](https://github.com/temporalio/samples-python) - -## How to connect a Temporal Client to a Temporal Cluster {#connect-to-a-dev-cluster} - -A [Temporal Client](/encyclopedia/temporal-sdks#temporal-client) enables you to communicate with the [Temporal Cluster](/clusters). -Communication with a Temporal Cluster includes, but isn't limited to, the following: - -- Starting Workflow Executions. -- Sending Signals to Workflow Executions. -- Sending Queries to Workflow Executions. -- Getting the results of a Workflow Execution. -- Providing an Activity Task Token. - -:::caution - -A Temporal Client cannot be initialized and used inside a Workflow. -However, it is acceptable and common to use a Temporal Client inside an Activity to communicate with a Temporal Cluster. - -::: - -When you are running a Cluster locally (such as the [Temporal CLI](https://docs.temporal.io/cli/server#start-dev)), the number of connection options you must provide is minimal. -Many SDKs default to the local host or IP address and port that Temporalite and [Docker Compose](https://github.com/temporalio/docker-compose) serve (`127.0.0.1:7233`). - -Use the `connect()` method on the Client class to create and connect to a Temporal Client to the Temporal Cluster. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -## How to connect to Temporal Cloud {#connect-to-temporal-cloud} - -When you connect to [Temporal Cloud](/cloud), you need to provide additional connection and client options that include the following: - -- The [Temporal Cloud Namespace Id](/cloud/namespaces#temporal-cloud-namespace-id). -- The [Namespace's gRPC endpoint](/cloud/namespaces#temporal-cloud-grpc-endpoint). - An endpoint listing is available at the [Temporal Cloud Website](https://cloud.temporal.io/namespaces) on each Namespace detail page. - The endpoint contains the Namespace Id and port. -- mTLS CA certificate. -- mTLS private key. - -For more information about managing and generating client certificates for Temporal Cloud, see [How to manage certificates in Temporal Cloud](/cloud/certificates). - -For more information about configuring TLS to secure inter- and intra-network communication for a Temporal Cluster, see [Temporal Customization Samples](https://github.com/temporalio/samples-server). - -Use the `connect()` method on the Client class to create and connect to a Temporal Client to the Temporal Cluster. -Then specify the [TLSConfig](https://python.temporal.io/temporalio.service.TLSConfig.html) arguments to connect to a Temporal Cluster with TLS enabled. -The `client_cert` must be combined with `client_private_key` to authenticate the Client. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client, TLSConfig -# ... -# ... -async def main(): - with open("client-cert.pem", "rb") as f: - client_cert = f.read() - with open("client-private-key.pem", "rb") as f: - client_private_key = f.read() - client = await Client.connect( - "your-custom-namespace.tmprl.cloud:7233", - namespace=".", - tls=TLSConfig( - client_cert=client_cert, - client_private_key=client_private_key, - # domain=domain, # TLS domain - # server_root_ca_cert=server_root_ca_cert, # ROOT CA to validate the server cert - ), - ) -``` - -## How to develop a basic Workflow {#develop-workflows} - -Workflows are the fundamental unit of a Temporal Application, and it all starts with the development of a [Workflow Definition](/workflows#workflow-definition). - -In the Temporal Python SDK programming model, Workflows are defined as classes. - -Specify the `@workflow.defn` decorator on the Workflow class to identify a Workflow. - -Use the `@workflow.run` to mark the entry point method to be invoked. This must be set on one asynchronous method defined on the same class as `@workflow.defn`. Run methods have positional parameters. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to define Workflow parameters {#workflow-parameters} - -Temporal Workflows may have any number of custom parameters. -However, we strongly recommend that objects are used as parameters, so that the object's individual fields may be altered without breaking the signature of the Workflow. -All Workflow Definition parameters must be serializable. - -Workflow parameters are the method parameters of the singular method decorated with `@workflow.run`. -These can be any data type Temporal can convert, including [`dataclasses`](https://docs.python.org/3/library/dataclasses.html) when properly type-annotated. -Technically this can be multiple parameters, but Temporal strongly encourages a single `dataclass` parameter containing all input fields. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from dataclasses import dataclass -# ... -# ... -@dataclass -class YourParams: - greeting: str - name: str -``` - -### How to define Workflow return parameters {#workflow-return-values} - -Workflow return values must also be serializable. -Returning results, returning errors, or throwing exceptions is fairly idiomatic in each language that is supported. -However, Temporal APIs that must be used to get the result of a Workflow Execution will only ever receive one of either the result or the error. - -To return a value of the Workflow, use `return` to return an object. - -To return the results of a Workflow Execution, use either `start_workflow()` or `execute_workflow()` asynchronous methods. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to customize your Workflow Type {#workflow-type} - -Workflows have a Type that are referred to as the Workflow name. - -The following examples demonstrate how to set a custom name for your Workflow Type. - -You can customize the Workflow name with a custom name in the decorator argument. For example, `@workflow.defn(name="your-workflow-name")`. If the name parameter is not specified, the Workflow name defaults to the function name. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How develop Workflow logic {#workflow-logic-requirements} - -Workflow logic is constrained by [deterministic execution requirements](/workflows#deterministic-constraints). -Therefore, each language is limited to the use of certain idiomatic techniques. -However, each Temporal SDK provides a set of APIs that can be used inside your Workflow to interact with external (to the Workflow) application code. - -Workflow code must be deterministic. This means: - -- no threading -- no randomness -- no external calls to processes -- no network I/O -- no global state mutation -- no system date or time - -All API safe for Workflows used in the [`temporalio.workflow`](https://python.temporal.io/temporalio.workflow.html) must run in the implicit [`asyncio` event loop](https://docs.python.org/3/library/asyncio-eventloop.html) and be _deterministic_. - -## How to develop a basic Activity {#develop-activities} - -One of the primary things that Workflows do is orchestrate the execution of Activities. -An Activity is a normal function or method execution that's intended to execute a single, well-defined action (either short or long-running), such as querying a database, calling a third-party API, or transcoding a media file. -An Activity can interact with world outside the Temporal Platform or use a Temporal Client to interact with a Cluster. -For the Workflow to be able to execute the Activity, we must define the [Activity Definition](/activities#activity-definition). - -You can develop an Activity Definition by using the `@activity.defn` decorator. -Register the function as an Activity with a custom name through a decorator argument, for example `@activity.defn(name="your_activity")`. - -:::note - -The Temporal Python SDK supports multiple ways of implementing an Activity: - -- Asynchronously using [`asyncio`](https://docs.python.org/3/library/asyncio.html) -- Synchronously multithreaded using [`concurrent.futures.ThreadPoolExecutor`](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) -- Synchronously multiprocess using [`concurrent.futures.ProcessPoolExecutor`](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and [`multiprocessing.managers.SyncManager`](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.managers.SyncManager) - -Blocking the async event loop in Python would turn your asynchronous program into a synchronous program that executes serially, defeating the entire purpose of using `asyncio`. -This can also lead to potential deadlock, and unpredictable behavior that causes tasks to be unable to execute. -Debugging these issues can be difficult and time consuming, as locating the source of the blocking call might not always be immediately obvious. - -Due to this, consider not make blocking calls from within an asynchronous Activity, or use an async safe library to perform -these actions. -If you must use a blocking library, consider using a synchronous Activity instead. - -::: - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import activity -# ... -# ... -@activity.defn(name="your_activity") -async def your_activity(input: YourParams) -> str: - return f"{input.greeting}, {input.name}!" -``` - -### How to develop Activity Parameters {#activity-parameters} - -There is no explicit limit to the total number of parameters that an [Activity Definition](/activities#activity-definition) may support. -However, there is a limit to the total size of the data that ends up encoded into a gRPC message Payload. - -A single argument is limited to a maximum size of 2 MB. -And the total size of a gRPC message, which includes all the arguments, is limited to a maximum of 4 MB. - -Also, keep in mind that all Payload data is recorded in the [Workflow Execution Event History](/workflows#event-history) and large Event Histories can affect Worker performance. -This is because the entire Event History could be transferred to a Worker Process with a [Workflow Task](/workers#workflow-task). - -{/* TODO link to gRPC limit section when available */} - -Some SDKs require that you pass context objects, others do not. -When it comes to your application data—that is, data that is serialized and encoded into a Payload—we recommend that you use a single object as an argument that wraps the application data passed to Activities. -This is so that you can change what data is passed to the Activity without breaking a function or method signature. - -Activity parameters are the function parameters of the function decorated with `@activity.defn`. -These can be any data type Temporal can convert, including dataclasses when properly type-annotated. -Technically this can be multiple parameters, but Temporal strongly encourages a single dataclass parameter containing all input fields. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import activity -from your_dataobject_dacx import YourParams - -# ... -# ... -@activity.defn(name="your_activity") -async def your_activity(input: YourParams) -> str: - return f"{input.greeting}, {input.name}!" -``` - -### How to define Activity return values {#activity-return-values} - -All data returned from an Activity must be serializable. - -There is no explicit limit to the amount of data that can be returned by an Activity, but keep in mind that all return values are recorded in a [Workflow Execution Event History](/workflows#event-history). - -An Activity Execution can return inputs and other Activity values. - -The following example defines an Activity that takes a string as input and returns a string. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@activity.defn(name="your_activity") -async def your_activity(input: YourParams) -> str: - return f"{input.greeting}, {input.name}!" -``` - -### How to customize your Activity Type {#activity-type} - -Activities have a Type that are referred to as the Activity name. -The following examples demonstrate how to set a custom name for your Activity Type. - -You can customize the Activity name with a custom name in the decorator argument. For example, `@activity.defn(name="your-activity")`. -If the name parameter is not specified, the Activity name defaults to the function name. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@activity.defn(name="your_activity") -async def your_activity(input: YourParams) -> str: - return f"{input.greeting}, {input.name}!" -``` - -## How to start an Activity Execution {#activity-execution} - -Calls to spawn [Activity Executions](/activities#activity-execution) are written within a [Workflow Definition](/workflows#workflow-definition). -The call to spawn an Activity Execution generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command. -This results in the set of three [Activity Task](/workers#activity-task) related Events ([ActivityTaskScheduled](/references/events#activitytaskscheduled), [ActivityTaskStarted](/references/events#activitytaskstarted), and ActivityTask[Closed])in your Workflow Execution Event History. - -A single instance of the Activities implementation is shared across multiple simultaneous Activity invocations. -Activity implementation code should be _idempotent_. - -The values passed to Activities through invocation parameters or returned through a result value are recorded in the Execution history. -The entire Execution history is transferred from the Temporal service to Workflow Workers when a Workflow state needs to recover. -A large Execution history can thus adversely impact the performance of your Workflow. - -Therefore, be mindful of the amount of data you transfer through Activity invocation parameters or Return Values. -Otherwise, no additional limitations exist on Activity implementations. - -To spawn an Activity Execution, use the [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) operation from within your Workflow Definition. - -`execute_activity()` is a shortcut for [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) that waits on its result. - -To get just the handle to wait and cancel separately, use `start_activity()`. -In most cases, use `execute_activity()` unless advanced task capabilities are needed. - -A single argument to the Activity is positional. Multiple arguments are not supported in the type-safe form of `start_activity()` or `execute_activity()` and must be supplied by the `args` keyword argument. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set the required Activity Timeouts {#required-timeout} - -Activity Execution semantics rely on several parameters. -The only required value that needs to be set is either a [Schedule-To-Close Timeout](/activities#start-to-close-timeout) or a [Start-To-Close Timeout](/activities#start-to-close-timeout). -These values are set in the Activity Options. - -Activity options are set as keyword arguments after the Activity arguments. - -Available timeouts are: - -- schedule_to_close_timeout -- schedule_to_start_timeout -- start_to_close_timeout - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - activity_timeout_result = await workflow.execute_activity( - your_activity, - YourParams(greeting, "Activity Timeout option"), - # Activity Execution Timeout - start_to_close_timeout=timedelta(seconds=10), - # schedule_to_start_timeout=timedelta(seconds=10), - # schedule_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to get the results of an Activity Execution {#get-activity-results} - -The call to spawn an [Activity Execution](/activities#activity-execution) generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command and provides the Workflow with an Awaitable. -Workflow Executions can either block progress until the result is available through the Awaitable or continue progressing, making use of the result when it becomes available. - -Use [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) to start an Activity and return its handle, [`ActivityHandle`](https://python.temporal.io/temporalio.workflow.ActivityHandle.html). Use [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) to return the results. - -You must provide either `schedule_to_close_timeout` or `start_to_close_timeout`. - -`execute_activity()` is a shortcut for `await start_activity()`. An asynchronous `execute_activity()` helper is provided which takes the same arguments as `start_activity()` and `await`s on the result. `execute_activity()` should be used in most cases unless advanced task capabilities are needed. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... -@workflow.defn(name="YourWorkflow") -class YourWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - your_activity, - YourParams("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -## How to run Worker Processes {#run-a-dev-worker} - -The [Worker Process](/workers#worker-process) is where Workflow Functions and Activity Functions are executed. - -- Each [Worker Entity](/workers#worker-entity) in the Worker Process must register the exact Workflow Types and Activity Types it may execute. -- Each Worker Entity must also associate itself with exactly one [Task Queue](/workers#task-queue). -- Each Worker Entity polling the same Task Queue must be registered with the same Workflow Types and Activity Types. - -A [Worker Entity](/workers#worker-entity) is the component within a Worker Process that listens to a specific Task Queue. - -Although multiple Worker Entities can be in a single Worker Process, a single Worker Entity Worker Process may be perfectly sufficient. -For more information, see the [Worker tuning guide](/dev-guide/worker-performance). - -A Worker Entity contains a Workflow Worker and/or an Activity Worker, which makes progress on Workflow Executions and Activity Executions, respectively. - -To develop a Worker, use the `Worker()` constructor and add your Client, Task Queue, Workflows, and Activities as arguments. -The following code example creates a Worker that polls for tasks from the Task Queue and executes the Workflow. -When a Worker is created, it accepts a list of Workflows in the workflows parameter, a list of Activities in the activities parameter, or both. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -from temporalio.worker import Worker -# ... -# ... -async def main(): - client = await Client.connect("localhost:7233") - worker = Worker( - client, - task_queue="your-task-queue", - workflows=[YourWorkflow], - activities=[your_activity], - ) - await worker.run() - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -### How to register types {#register-types} - -All Workers listening to the same Task Queue name must be registered to handle the exact same Workflows Types and Activity Types. - -If a Worker polls a Task for a Workflow Type or Activity Type it does not know about, it fails that Task. -However, the failure of the Task does not cause the associated Workflow Execution to fail. - -When a `Worker` is created, it accepts a list of Workflows in the `workflows` parameter, a list of Activities in the `activities` parameter, or both. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - worker = Worker( - client, - task_queue="your-task-queue", - workflows=[YourWorkflow], - activities=[your_activity], - ) - await worker.run() - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -## How to start a Workflow Execution {#start-workflow-execution} - -[Workflow Execution](/workflows#workflow-execution) semantics rely on several parameters—that is, to start a Workflow Execution you must supply a Task Queue that will be used for the Tasks (one that a Worker is polling), the Workflow Type, language-specific contextual data, and Workflow Function parameters. - -In the examples below, all Workflow Executions are started using a Temporal Client. -To spawn Workflow Executions from within another Workflow Execution, use either the [Child Workflow](features#child-workflows) or External Workflow APIs. - -See the [Customize Workflow Type](#workflow-type) section to see how to customize the name of the Workflow Type. - -A request to spawn a Workflow Execution causes the Temporal Cluster to create the first Event ([WorkflowExecutionStarted](/references/events#workflowexecutionstarted)) in the Workflow Execution Event History. -The Temporal Cluster then creates the first Workflow Task, resulting in the first [WorkflowTaskScheduled](/references/events#workflowtaskscheduled) Event. - -To start a Workflow Execution in Python, use either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods in the Client. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -### How to set a Workflow's Task Queue {#set-task-queue} - -In most SDKs, the only Workflow Option that must be set is the name of the [Task Queue](/workers#task-queue). - -For any code to execute, a Worker Process must be running that contains a Worker Entity that is polling the same Task Queue name. - -To set a Task Queue in Python, specify the `task_queue` argument when executing a Workflow with either [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) methods. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -### How to set a Workflow Id {#workflow-id} - -You must set a [Workflow Id](/workflows#workflow-id). - -When setting a Workflow Id, we recommended mapping it to a business process or business entity identifier, such as an order identifier or customer identifier. - -To set a Workflow Id in Python, specify the `id` argument when executing a Workflow with either [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) methods. - -The `id` argument should be a unique identifier for the Workflow Execution. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - ) - - print(f"Result: {result}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -### How to get the results of a Workflow Execution {#get-workflow-results} - -If the call to start a Workflow Execution is successful, you will gain access to the Workflow Execution's Run Id. - -The Workflow Id, Run Id, and Namespace may be used to uniquely identify a Workflow Execution in the system and get its result. - -It's possible to both block progress on the result (synchronous execution) or get the result at some other point in time (asynchronous execution). - -In the Temporal Platform, it's also acceptable to use Queries as the preferred method for accessing the state and results of Workflow Executions. - -Use [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`get_workflow_handle()`](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle) to return a Workflow handle. -Then use the [`result`](https://python.temporal.io/temporalio.client.WorkflowHandle.html#result) method to await on the result of the Workflow. - -To get a handle for an existing Workflow by its Id, you can use [`get_workflow_handle()`](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle), or use [`get_workflow_handle_for()`](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle_for) for type safety. - -Then use [`describe()`](https://python.temporal.io/temporalio.client.workflowhandle#describe) to get the current status of the Workflow. -If the Workflow does not exist, this call fails. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - handle = client.get_workflow_handle( - workflow_id="your-workflow-id", - ) - results = await handle.result() - print(f"Result: {results}") - - -if __name__ == "__main__": - asyncio.run(main()) -``` diff --git a/docs/dev-guide/python/index.mdx b/docs/dev-guide/python/index.mdx index b17ed3728c..a344324b77 100644 --- a/docs/dev-guide/python/index.mdx +++ b/docs/dev-guide/python/index.mdx @@ -8,6 +8,7 @@ toc_max_heading_level: 4 keywords: - dev guide - python + - introduction tags: - dev-guide - python @@ -17,38 +18,39 @@ This guide is meant to provide a comprehensive overview of the structures, primi ## Core application -Develop basic Temporal application with workflows & activities in Python using Temporal SDK. +Develop basic Temporal application with Workflows and Activities in Python using Temporal SDK. -- [Develop a basic Workflow](devguide/python/coreapplication#develop-a-basic-workflow) -- [Develop a basic Activity](devguide/python/coreapplication#develop-a-basic-activity) -- [Start an Activity Execution](devguide/python/coreapplication#start-a-nactivity-execution) -- [Run a Worker Processes](/dev-guide/python/core-application#run-a-worker-processes) +- [Develop a basic Workflow](/dev-guide/python/core-application#develop-workflows) +- [Develop a basic Activity](/dev-guide/python/core-application#develop-activities) +- [Start an Activity Execution](/dev-guide/python/core-application#activity-execution) +- [Run a Worker Processes](/dev-guide/python/core-application#run-a-dev-worker) ## Temporal Client Master the Temporal Python Client with our comprehensive guide that covers everything from initialization to Workflow Execution. -- [Connect to development Temporal Service](/dev-guide/python/temporal-clients#connect-to-development-temporal-service) +- [Connect to development Temporal Service](/dev-guide/python/temporal-clients#connect-to-development-service) - [Connect to Temporal Cloud](/dev-guide/python/temporal-clients#connect-to-temporal-cloud) -- [Start a Workflow Execution](/dev-guide/python/temporal-clients#start-a-workflow-execution) +- [Start a Workflow Execution](/dev-guide/python/temporal-clients#start-workflow-execution) + ## Test suites The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. -- [Test frameworks](devguide/python/testsuites#test-frameworks) -- [Testing Activities](devguide/python/testsuites#testing-activities) -- [Testing Workflows](devguide/python/testsuites#testing-workflows) -- [How to Replay a Workflow Execution](/dev-guide/python/test-suites#how-to-replay-a-workflowexecution) +- [Test frameworks](/dev-guide/python/test-suites#test-frameworks) +- [Testing Activities](/dev-guide/python/test-suites#test-activities) +- [Testing Workflows](/dev-guide/python/test-suites#test-workflows) +- [How to Replay a Workflow Execution](/dev-guide/python/test-suites#replay) ## Failure detection -- [Workflow timeouts](devguide/python/failuredetection#workflow-timeouts) -- [Set Activity timeouts](devguide/python/failuredetection#set-activity-timeouts) -- [Heartbeat an Activity](devguide/python/failuredetection#heartbeat-an-activity) +- [Workflow timeouts](/dev-guide/python/failure-detection#workflow-timeouts) +- [Set Activity timeouts](/dev-guide/python/failure-detection#activity-timeouts) +- [Heartbeat an Activity](/dev-guide/python/failure-detection#activity-heartbeats) @@ -56,10 +58,10 @@ The Testing section of the Temporal Developer's guide covers the many ways to te Explore using Signals in Temporal Python to send messages to Workflows, with details on defining, sending, and handling Signals, including customization options. -- [Develop with Signals](/dev-guide/python/messages#develop-with-signals) -- [Develop with Queries](/dev-guide/python/messages#develop-with-queries) -- [Develop with Updates](/dev-guide/python/messages#develop-with-updates) -- [What is a Dynamic Handler](/dev-guide/python/messages#what-is-a-dynamic-handler) +- [Develop with Signals](/dev-guide/python/messages#signals) +- [Develop with Queries](/dev-guide/python/messages#queries) +- [Develop with Updates](/dev-guide/python/messages#updates) +- [What is a Dynamic Handler](/dev-guide/python/messages#dynamic-handler) @@ -68,7 +70,7 @@ Explore using Signals in Temporal Python to send messages to Workflows, with det Cancel an Activity from a Workflow, sending Heartbeats and setting a Heartbeat Timeout, and handling cancellation errors. -- [Cancel an Activity from a Workflow](//dev-guide/python/cancellation) +- [Cancel an Activity from a Workflow](//dev-guide/python/cancellation#cancel-an-activity) @@ -85,8 +87,8 @@ Complete an Activity without waiting for execution to finish, using Temporal Cli The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. - [Introduction to Versioning](/dev-guide/python/versioning#introduction-to-versioning) -- [How to use the Patching API](/dev-guide/python/versioning#how-to-use-the-patching-api) -- [How to use Worker Versioning](/dev-guide/python/versioning#how-touse-worker-versioning) +- [How to use the Patching API](/dev-guide/python/versioning#python-sdk-patching-api) +- [How to use Worker Versioning](/dev-guide/python/versioning#worker-versioning) @@ -128,7 +130,7 @@ The Converters and Codecs section of the Temporal Developer's guide provides gui Spawn a new Workflow from within another Workflow, with options for Parent Close Policy and handling Child Workflow Events. -- [Start a Child Workflow Execution](devguide/python/child-workflows) +- [Start a Child Workflow Execution](/dev-guide/python/child-workflows) @@ -136,14 +138,14 @@ Spawn a new Workflow from within another Workflow, with options for Parent Close Close a Workflow Execution and create a new one with the same Workflow ID, new Run ID, and fresh Event History. -- [Continue-As-New](/dev-guide/python/continueasnew#continue-as-new) +- [Continue-As-New](/dev-guide/python/continue-as-new) ## Timers Learn how to use timers within Temporal Workflows to delay execution, enabling durable and long-term scheduling of tasks that can persist even if the worker or cluster goes down. -- [What is a Timer](/dev-guide/python/timers#what-is-a-timer) +- [What is a Timer](/dev-guide/python/timers) @@ -151,5 +153,5 @@ Learn how to use timers within Temporal Workflows to delay execution, enabling d Learn how to interrupt a workflow execution by canceling or terminating, including the differences and use cases for each method. -- [Interrupt a Workflow Execution](/dev-guide/python/interrupt-workflow#interrupt-a-workflow-execution}) +- [Interrupt a Workflow Execution](/dev-guide/python/interrupt-a-workflow-execution) diff --git a/docs/dev-guide/python/interrupt-workflow.mdx b/docs/dev-guide/python/interrupt-workflow.mdx index 402fe17ed2..5014c4a604 100644 --- a/docs/dev-guide/python/interrupt-workflow.mdx +++ b/docs/dev-guide/python/interrupt-workflow.mdx @@ -2,8 +2,8 @@ id: interrupt-a-workflow-execution title: Interrupt a Workflow Execution sidebar_label: Interrupt a Workflow Execution -description: Learn how to interrupt a workflow execution by canceling or terminating, including the differences and use cases for each method. -slug: /dev-guide/python/interrupt_a_workflow_execution +description: Learn how to interrupt a Workflow Execution by canceling or terminating, including the differences and use cases for each method. +slug: /dev-guide/python/interrupt-a-workflow-execution toc_max_heading_level: 2 keywords: - cancel workflow execution diff --git a/docs/dev-guide/python/project-setup.mdx b/docs/dev-guide/python/project-setup.mdx deleted file mode 100644 index f37c8d8544..0000000000 --- a/docs/dev-guide/python/project-setup.mdx +++ /dev/null @@ -1,971 +0,0 @@ ---- -id: project-setup -title: Set up a Temporal Application project - Python SDK dev guide -sidebar_label: Project setup -description: The project setup section of the Temporal Python SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in Python—that is, all the relevant steps to start a Workflow Execution that executes an Activity. -slug: /dev-guide/python/project-setup -toc_max_heading_level: 4 -keywords: - - activity - - cloud certificate - - code sample - - dev guide - - developer guide - - docker - - go sdk - - introduction - - project setup - - python sdk - - self-hosted - - temporal cli - - temporal client - - temporal cloud - - test framework - - testing - - worker - - workflow -tags: - - activity - - cloud-certificate - - code-sample - - dev-guide - - developer-guide - - docker - - go-sdk - - introduction - - project-setup - - python-sdk - - self-hosted - - temporal-cli - - temporal-client - - temporal-cloud - - test-framework - - testing - - worker - - workflow ---- - -This section covers how to use a terminal, a code editor, and a development Cluster to create a Namespace, write a single Activity Workflow, run a Worker that talks to your development Cluster, run a Workflow using the temporal CLI, add a testing framework, and view Workflows in the Web UI. - -:::competency Construct a new Temporal Application project - -This section of the Temporal Python SDK developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application using Python. - -By the end of this section you will know how to construct a new Temporal Application project. - -::: - -:::info Choose your development environment - -There are three ways to follow this guide: - -- [Use a local dev server](#local-dev-server) -- [Use Temporal Cloud](#temporal-cloud) -- [Use a self-hosted environment such as Docker](#self-hosted-temporal-cluster) - -Read more in the [Choose a development Cluster](#choose-dev-cluster) section on this page. - -::: - -## Install the Temporal CLI {#install-cli} - -**How to download and install the Temporal CLI** - -The Temporal CLI is available on MacOS, Windows, and Linux. - -### MacOS - -**How to install the Temporal CLI on Mac OS** - -Choose one of the following install methods to install the Temporal CLI on MacOS: - -**Install the Temporal CLI with Homebrew** - -```bash -brew install temporal -``` - -**Install the Temporal CLI with cURL** - -```bash -curl -sSf https://temporal.download/cli.sh | sh -``` - -**Install the Temporal CLI from CDN** - -1. Select the platform and architecture needed. - -- Download for Darwin amd64: https://temporal.download/cli/archive/latest?platform=darwin&arch=amd64 -- Download for Darwin arm64: https://temporal.download/cli/archive/latest?platform=darwin&arch=arm64 - -2. Extract the downloaded archive. - -3. Add the `temporal` binary to your PATH. - -### Linux - -**How to install the Temporal CLI on Linux** - -Choose one of the following install methods to install the Temporal CLI on Linux: - -**Install the Temporal CLI with cURL** - -```bash -curl -sSf https://temporal.download/cli.sh | sh -``` - -**Install the Temporal CLI from CDN** - -1. Select the platform and architecture needed. - -- Download for Linux amd64: https://temporal.download/cli/archive/latest?platform=linux&arch=amd64 -- Download for Linux arm64: https://temporal.download/cli/archive/latest?platform=linux&arch=arm64 - -2. Extract the downloaded archive. - -3. Add the `temporal` binary to your PATH. - -### Windows - -**How to install the Temporal CLI on Windows** - -Follow these instructions to install the Temporal CLI on Windows: - -**Install the Temporal CLI from CDN** - -1. Select the platform and architecture needed and download the binary. - -- Download for Windows amd64: https://temporal.download/cli/archive/latest?platform=windows&arch=amd64 -- Download for Windows arm64: https://temporal.download/cli/archive/latest?platform=windows&arch=arm64 - -2. Extract the downloaded archive. - -3. Add the `temporal.exe` binary to your PATH. - -## Choose a development Cluster {#choose-dev-cluster} - -**Which development Cluster should you choose?** - -We recommend choosing a development environment based on your requirements. - -The source code for the Temporal Server (the orchestrating component of the Temporal Cluster) is licensed under the MIT open source license. So, in theory, anyone can take the Temporal Server code and run their Temporal Platform in any number of creative ways. - -However, for most developers we recommend starting by choosing one of the following: - -- [Local development server](#local-dev-server) -- [Temporal Cloud](#temporal-cloud) -- [Self-hosted Temporal Cluster](#self-hosted-temporal-cluster) - -:::info Temporal does not directly run your code - -Keep in mind that in every scenario, the “Temporal Platform” does not host and run your Workers (application code). -It is up to you, the developer, to host your application code. -The Temporal Platform ensures that properly written code durably executes in the face of platform-level failures. - -::: - -### Local dev server - -**When to use a local development server?** - -We recommend using the local development server if you are new to Temporal, or want to start something from scratch and don’t have a self-hosted environment ready or want to pay for a Temporal Cloud account. - -The Temporal CLI comes bundled with a development server and provides a fast way to start running Temporal Applications. - -However, the local development server does not emit any metrics. -If you are eager to to set up Cluster-level metrics for performance tuning, we recommend using a self-hosted Cluster or Temporal Cloud. - -#### Start the dev server - -**How to start a local development server** - -If you have successfully installed the Temporal CLI, open a new terminal and run the following command: - -```bash -temporal server start-dev --db-filename temporal.db -``` - -This command automatically starts the Temporal Web UI, creates a default Namespace, and creates a persistence database. - -The Temporal Web UI serves to [http://localhost:8233](http://localhost:8233/). - -For more command details and options, see the [CLI reference](/cli/server#start-dev) - -#### Create a custom Namespace - -**How to create a Namespace on the development server** - -The development server does automatically create a default Namespace (named "default") when it starts up. -However, you will create a custom one for our application. -Since this is something recommended at a production level, it's recommend practicing it with the development server. - -Use the `temporal operator namespace create` command using the Temporal CLI to create a Namespace on the development server. - -```bash -temporal operator namespace create backgroundcheck_namespace -``` - -For command details and options, see the [CLI reference](/cli/operator#create). - -### Temporal Cloud - -**When to use Temporal Cloud** - -If you do not have a Temporal Cloud Account, you can request one using the link on the [Get started with Temporal Cloud](https://docs.temporal.io/cloud/get-started) guide. - -We recommend starting off with Temporal Cloud if you already have a production use case, or need to move a scalable proof of concept into production. - -In other words, Temporal Cloud is perfect if you are ready to run at scale and don’t want the overhead of managing your own self-hosted Cluster. - -To create a Namespace in Temporal Cloud, follow the instructions in [How to create a Namespace](/cloud/namespaces#create-a-namespace). - -:::info Safely store your certificate and private key - -Store certificates and private keys generated for your Namespace as files or environment variables in your project. -You need access to your certificate and key to run your Workers and start Workflows. - -For more information on certificate requirements, see [How to manage certificates in Temporal Cloud](/cloud/certificates). - -::: - -### Self-hosted Temporal Cluster - -We recommend using a self-hosted environment if you are starting something new and need to scale with production-level features, but don’t yet need or want to pay for Temporal Cloud. - -For example, running a self-hosted Cluster lets you try different databases, view Cluster metrics, use custom [Search Attributes](/visibility#search-attribute), and even play with the [Archival](/clusters#archival) feature. - -For the purposes of this guide, we show how to use a self-hosted environment that runs completely out of Docker. -We acknowledge that it takes a fair amount of experience to elevate from a self-hosted environment in Docker to something that can run at an enterprise production scale. -The self-hosted information in this guide should help you make more informed decisions. - -To follow along with self-hosted parts of this guide, install the following: - -- [Docker](https://docs.docker.com/engine/install) -- [Docker Compose](https://docs.docker.com/compose/install). - -Then, clone the [temporalio/docker-compose](https://github.com/temporalio/docker-compose.git) repository. - -Change directory into the root of the project. - -Run the `docker compose up` command. - -```shell -git clone https://github.com/temporalio/docker-compose.git -cd docker-compose -docker compose up -``` - -Create a command alias for the Temporal CLI: - -```shell -alias temporal_docker="docker exec temporal-admin-tools temporal" -``` - -Create a Namespace. - -```shell -temporal_docker operator namespace create backgroundcheck_namespace -``` - -## Boilerplate Temporal Application project code {#boilerplate-project} - -**What is the minimum code I need to create a boilerplate Temporal Application?** - -Let’s start with a single Activity Workflow and register those functions with a Worker. - -After we get the Worker running and have started a Workflow Execution, we will add a testing framework. - -### Project structure - -You can organize Temporal Application code to suit various needs in a way that aligns with the idiomatic style of the language you are working in. -This includes structuring your files according to your organization's best practices. - -However, there are some general ways to think about organizing code. - -The best practice is to group Workflows together, Activities together, and separate your Worker process into a standalone file. -Often this happens respectively per use case, business process, or domain. - -For monorepo-style organizational techniques, consider a designated Workflow directory for each use case and place each Workflow in its own file, but also maintain a dedicated place for shared Activities. - -For example, your project structure could look like this: - -```text -/monorepo - /shared_activities - | payment.py - | send_email.py - /background_check - /workflows - | background_check_workflow.py - /activities - | ssn_trace_activity.py - /worker - | main.py - /loan_application - /workflows - | loan_application_workflow.py - /activities - | credit_check_activity.py - /worker - | main.py - /tests - | pytest.ini - | workflow_tests.py - | activity_tests.py -``` - -If you are following along with this guide, your project will look like this: - -```text -/backgroundcheck - /workflows - | background_check_workflow.py - /activities - | ssn_trace_activity.py - /worker - | main.py - /tests - | pytest.ini - | workflow_tests.py - | activity_tests.py -``` - -### Initialize Python project dependency framework - -In Python, you’d typically use `pip` and `virtualenv` or `venv` for dependency management and environment isolation. - -For more information, see [Creating Virtual Environments](https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-virtual-environments). - -Set up a virtual environment for the project and initialize it using `pip`. - -```bash -mkdir background_check -cd background_check -python -m venv venv -source venv/bin/activate # On Windows, use `venv\Scripts\activate` -pip install temporalio -``` - -After activation, any Python command you run will use the virtual environment's isolated Python interpreter and libraries. -Remember to always activate the virtual environment when working on this project. - -### Boilerplate Workflow code {#workflow-code} - -In the Temporal Python SDK programming model, a Workflow Definition is defined as a class. -The `BackgroundCheck class` below is an example of a basic Workflow Definition. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from datetime import timedelta - -from temporalio import workflow - -with workflow.unsafe.imports_passed_through(): - from activities.ssntraceactivity_dacx import ssn_trace_activity - - - -@workflow.defn -class BackgroundCheck: - @workflow.run - async def run(self, ssn: str) -> str: - return await workflow.execute_activity( - ssn_trace_activity, - ssn, - schedule_to_close_timeout=timedelta(seconds=5), - ) -``` - -Use the `@workflow.defn` decorator on the `BackgroundCheck` class to identify a Workflow. - -Use the `@workflow.run` to mark the entry point method to be invoked. This must be set on one asynchronous method defined on the same class as `@workflow.defn`. - -Run methods have positional parameters. - -In this example, pass in the Activity name, `ssn_trace_activity` and an argument, `ssn`. -We get into the best practices around Workflow params and returns in the one of the next sections. - -### Boilerplate Activity code {#activity-code} - -In the Temporal Python SDK programming model, an Activity is a function and can be used as an instance method of a class -You can use asynchronous, synchronous multithreaded, and synchronous multiprocess/other functions to define an Activity. - -Below is an example of an Activity defined as a function. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import activity - - - -@activity.defn -async def ssn_trace_activity(ssn) -> str: - return "pass" -``` - -The `ssn_trace_activity` function passes a string and returns `pass`. - -An Activity Definition can support as many other custom parameters as needed; however, all parameters must be serializable. - -The default data converter supports converting multiple types including: - -- `None` -- `bytes` -- `google.protobuf.message.Message` - As JSON when encoding, but has ability to decode binary proto from other languages -- Anything that can be converted to JSON including: - - Anything that `[json.dump](https://docs.python.org/3/library/json.html#json.dump)` supports natively - - [dataclasses](https://docs.python.org/3/library/dataclasses.html) - - Iterables including ones JSON dump may not support by default, e.g. `set` - - Any class with a `dict()` method and a static `parse_obj()` method, e.g. [Pydantic models](https://pydantic-docs.helpmanual.io/usage/models) - - The default data converter is deprecated for Pydantic models and will warn if used since not all fields work. See [this sample](https://github.com/temporalio/samples-python/tree/main/pydantic_converter) for the recommended approach. - - [IntEnum, StrEnum](https://docs.python.org/3/library/enum.html) based enumerates - - [UUID](https://docs.python.org/3/library/uuid.html) - -This notably doesn't include any `date`, `time`, or `datetime` objects as they may not work across SDKs. - -Users are strongly encouraged to use a single `dataclass` for parameter and return types so fields with defaults can be easily added without breaking compatibility. - -### Run a dev server Worker {#dev-server-worker} - -To run a Worker Process with a local development server, define the following steps in code: - -- Initialize a Temporal Client. -- Create a new Worker by passing the Client to creation call. -- Register the application's Workflow and Activity functions. -- Call run on the Worker. - -In regards to organization, we recommend keeping Worker code separate from Workflow and Activity code. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -import asyncio - -from temporalio.client import Client -from temporalio.worker import Worker - -from activities.ssntraceactivity_dacx import ssn_trace_activity -from workflows.backgroundcheck_dacx import BackgroundCheck - - - -async def main(): - client = await Client.connect("localhost:7233", namespace="backgroundcheck_namespace") - - worker = Worker( - client, - namespace="backgroundcheck_namespace", - task_queue="backgroundcheck-boilerplate-task-queue", - workflows=[BackgroundCheck], - activities=[ssn_trace_activity], - ) - - await worker.run() - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -### Run a Temporal Cloud Worker {#cloud-worker} - -A Temporal Cloud Worker requires that you specify the following in the Client connection options: - -- Temporal Cloud Namespace -- Temporal Cloud Address -- Certificate and private key associated with the Namespace - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -import asyncio -import os - -from temporalio.client import Client, TLSConfig -from temporalio.worker import Worker - -from activities.ssntraceactivity_dacx import ssn_trace_activity -from workflows.backgroundcheck_dacx import BackgroundCheck - - - -async def main(): - with open(os.getenv("TEMPORAL_MTLS_TLS_CERT"), "rb") as f: - client_cert = f.read() - - with open(os.getenv("TEMPORAL_MTLS_TLS_KEY"), "rb") as f: - client_key = f.read() - - client = await Client.connect( - os.getenv("TEMPORAL_HOST_URL"), - namespace=os.getenv("TEMPORAL_NAMESPACE"), - tls=TLSConfig( - client_cert=client_cert, - client_private_key=client_key, - ), - ) - - worker = Worker( - client, - task_queue="backgroundcheck-boilerplate-task-queue", - workflows=[BackgroundCheck], - activities=[ssn_trace_activity], - ) - await worker.run() - - -if __name__ == "__main__": - asyncio.run(main()) - -``` - -To run a Temporal Cloud Worker, you'll change some parameters in your Client connection code, such as updating the namespace and gRPC endpoint. -You'll use: - -- The [Temporal Cloud Namespace Id](https://docs.temporal.io/cloud/namespaces#temporal-cloud-namespace-id). -- The [Namespace's gRPC endpoint](https://docs.temporal.io/cloud/namespaces#temporal-cloud-grpc-endpoint). - The endpoint uses this format `(namespace.unique_id.tmprl.cloud:port)`. -- [Paths to the SSL certificate (.pem) and private key (.key)](https://docs.temporal.io/cloud/saml#integrate-saml-with-your-temporal-cloud-account) registered to your Namespace and stored on your Worker's file system. - -### Run a Self-hosted Worker {#dockerfile} - -To deploy a self-hosted Worker to your Docker environment, you need to configure your Worker with the appropriate IP address and port. - -#### Confirm network - -The default `docker-compose.yml` file in the `temporalio/docker-compose` repo has the Temporal Server exposed on port 7233 on the `temporal-network`. - -```yml -services: - # ... - temporal: - container_name: temporal - # ... - networks: - - temporal-network - ports: - - 7233:7233 - # ... - # ... -``` - -If you are using a different or customized docker compose file, you can see the available networks by using the following command: - -```shell -docker network ls -``` - -#### Confirm IP address - -Get the IP address of the Docker network that the containers are using. - -To do that, first inspect the network: - -```shell -docker network inspect temporal-network -``` - -Look for the container named `temporal`. - -Example output: - -```json -[ - { - "Name": "temporal-network", - // ... - "Containers": { - // ... - "53cf62f0cc6cfd2a9627a2b5a4c9f48ffe5a858f0ef7b2eaa51bf7ea8fd0e86f": { - "Name": "temporal", - // ... - "IPv4Address": "172.18.0.4/16" - // ... - } - // ... - } - // ... - } -] -``` - -Copy the IP address part. - -#### Customize Client options {#self-hosted-client-options} - -Set IP address, port, and Namespace in the Temporal Client options. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -import asyncio - -from temporalio.client import Client -from temporalio.worker import Worker - -from activities.ssntraceactivity_dacx import ssn_trace_activity -from workflows.backgroundcheck_dacx import BackgroundCheck - - - -async def main(): - client = await Client.connect( - "172.18.0.4:7233" # The IP address of the Temporal Server on your network. - ) - - worker = Worker( - client, - task_queue="backgroundcheck-boilerplate-task-queue", - workflows=[BackgroundCheck], - activities=[ssn_trace_activity], - ) - await worker.run() - - -if __name__ == "__main__": - asyncio.run(main()) -``` - -#### Build and deploy Docker image {#dockerfile} - -:::note - -This Dockerfile is used to containerize the Background Check application so that it can run seamlessly in any environment that supports Docker. - -::: - -Add a Docker file to the root of your Background Check application project. - -Name the file `Dockerfile`, with no extensions, and add the following configuration: - -```dockerfile -FROM python:3.11 - -RUN mkdir /app - -COPY . /app - -COPY pyproject.toml /app - -WORKDIR /app - -RUN pip3 install poetry - -RUN poetry config virtualenvs.create false - -RUN poetry install - -CMD [ "poetry", "run", "python", "/app/run_worker.py" ] -``` - -Then build the Docker image using the following command: - -```shell -docker build . -t backgroundcheck-worker-image:latest -``` - -Now run the Worker on the same network as the Temporal Cluster containers using the following command: - -```shell -docker run --network temporal-network backgroundcheck-worker-image:latest -``` - -## Start Workflow using the Temporal CLI {#start-workflow} - -**How to start a Workflow using the Temporal CLI** - -You can use the Temporal CLI to start a Workflow whether you are using a local development server, Temporal Cloud, or are in a self-hosted environment. -However, you need to provide additional options to the command when operating with the Temporal Cloud or self-hosted environments. - -### Local dev Server - -**How to start a Workflow with the Temporal CLI while using the local development server** - -Use the Temporal CLI `temporal workflow start` command to start your Workflow. - -```shell -temporal workflow start \ - --task-queue backgroundcheck-boilerplate-task-queue \ - --type BackgroundCheck \ - --input '"555-55-5555"' \ - --namespace backgroundcheck_namespace -``` - -For more details, see the [temporal workflow start](/cli/workflow#start) command API reference. - -After you start the Workflow, you can see it in the Temporal Platform. -Use the Temporal CLI or the Temporal Web UI to monitor the Workflow's progress. - -#### List Workflows - -Use the 'temporal workflow list` command to list all of the Workflows in the Namespace: - -```shell -temporal workflow list \ - --namespace backgroundcheck_namespace -``` - -#### View in Web UI - -You can also use the Web UI to see the Workflows associated with the Namespace. - -The local development server starts the Web UI at [http://localhost:8233](http://localhost:8233). - -When you visit for the first time, the Web UI directs you to [http://localhost:8233/namespaces/default/workflows](http://localhost:8233/namespaces/default/workflows). - -Use the Namespace dropdown to select the project Namespace you created earlier. - -
-
-

Web UI Namespace selection

-
-
- Web UI Namespace selection -
-
- -You should now be at [http://localhost:8233/namespaces/backgroundcheck_namespace/workflows](http://localhost:8233/namespaces/backgroundcheck_namespace/workflows). - -### Temporal Cloud - -**How to start a Workflow with Temporal CLI when using Temporal Cloud** - -Run the `temporal workflow start` command, and make sure to specify the certificate and private key arguments. - -```shell -temporal workflow start \ - --task-queue backgroundcheck-boilerplate-task-queue-cloud \ - --type BackgroundCheck \ - --tls-cert-path ca.pem \ - --tls-key-path ca.key \ - --input '"555-55-5555"' \ - --namespace . \ - --address ..tmprl.cloud: -``` - -Make sure that the certificate path, private key path, Namespace, and address argument values match your project. - -:::info Use environment variables - -Use environment variables as a way to quickly switch between a local dev server and Temporal Cloud, for example. - -You can customize the environment names to be anything you want. - -```shell -# set Cloud env variables -temporal env set cloud.namespace . -temporal env set cloud.address ..tmprl.cloud: -temporal env set cloud.tls-cert-path ca.pem -temporal env set cloud.tls-key-path ca.key -# set local env variables -temporal env set local.namespace -``` - -In this way, you can just provide a single `--env` command option when using the Temporal CLI rather than specifying each connection option in every command. - -```shell -temporal workflow start \ - # ... - --env cloud \ - # ... -``` - -::: - -#### List Workflows - -Run the `temporal workflow list` command, and make sure to specify the certificate and private key arguments. - -```shell -temporal workflow list \ - --tls-cert-path ca.pem \ - --tls-key-path ca.key \ - --namespace . \ - --address ..tmprl.cloud: -``` - -#### View in Web UI - -Visit the Workflows page of your Cloud Namespace. -The URL will look something like the following: - -```text -https://cloud.temporal.io/namespaces/./workflows -``` - -
-
-

View Workflows in the Cloud UI

-
-
- View Workflows in the Cloud UI -
-
- -### Self-hosted - -**How to start a Workflow with the Temporal CLI when using a Self-hosted Cluster** - -Use your Temporal CLI alias to run the `temporal workflow start` command and start your Workflow. - -```shell -temporal_docker workflow start \ - --task-queue backgroundcheck-boilerplate-task-queue-self-hosted \ - --type BackgroundCheck \ - --input '"555-55-5555"' \ - --namespace backgroundcheck_namespace -``` - -#### List Workflows - -Using your Temporal CLI alias, run the `temporal workflow list` command. -This command lists the Workflows Executions within the Namespace: - -```shell -temporal_docker workflow list \ - --namespace backgroundcheck_namespace -``` - -#### View in the Web UI - -When you visit for the first time, the Web UI directs you to [http://localhost:8233/namespaces/default/workflows](http://localhost:8080/namespaces/default/workflows). - -Use the Namespace dropdown to select the project Namespace you created earlier. - -You should now be at [http://localhost:8080/namespaces/backgroundcheck_namespace/workflows](http://localhost:8080/namespaces/backgroundcheck_namespace/workflows). - -## Add a testing framework {#test-framework} - -Each Temporal SDK has a testing suite that can be used in conjunction with a typical language specific testing framework. -In the Temporal Python SDK, the testing package (https://python.temporal.io/temporalio.testing.html) provides a test environment in which the Workflow and Activity code may be run for test purposes. - -The `BackgroundCheck` Workflow code checks the following conditions: - -1. It receives a social security number and a unique ID as input parameters. -2. It starts a new Activity `ssn_trace_activity` with the input SSN. -3. It waits for the Activity to complete and returns the result. -4. If the Activity returns "pass", it logs a message indicating that the background check passed. -5. If the Activity returns "fail", it raises an exception indicating that the background check failed. - -We can also perform a Workflow Replay test, and we'll provide detailed coverage of this topic in another section. - -### Add Workflow function tests {#test-workflow-code} - -This is a unit test written in Python using the pytest library. - -The test checks the `execute_workflow` method of the `BackgroundCheck` Workflow. - -The test creates a new `WorkflowEnvironment` and a `Worker` with a Task Queue and the `BackgroundCheck` Workflow and `ssn_trace_activity` activity. - -Then, it executes the `BackgroundCheck.run` method with a social security number and a unique ID, and asserts that the result is equal to "pass". - -The test is marked with `@pytest.mark.asyncio` to indicate that it is an asynchronous test. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -import uuid - -import pytest - -from temporalio.testing import WorkflowEnvironment -from temporalio.worker import Worker - -from activities.ssntraceactivity_dacx import ssn_trace_activity -from workflows.backgroundcheck_dacx import BackgroundCheck -# ... -@pytest.mark.asyncio -async def test_execute_workflow(): - task_queue_name = str(uuid.uuid4()) - async with await WorkflowEnvironment.start_time_skipping() as env: - async with Worker( - env.client, - task_queue=task_queue_name, - workflows=[BackgroundCheck], - activities=[ssn_trace_activity], - ): - assert "pass" == await env.client.execute_workflow( - BackgroundCheck.run, - "555-55-5555", - id=str(uuid.uuid4()), - task_queue=task_queue_name, - ) -``` - -### Add Activity function tests {#test-activity-code} - -This is a Python using the [pytest](https://pytest.org) framework and the [ActivityEnvironment](https://python.temporal.io/temporalio.testing.ActivityEnvironment.html) class from the Temporal Python SDK. -It tests the `ssn_trace_activity` function from the activities module. -The function takes a social security number as input and returns a string indicating whether the SSN is valid or not. -The test checks if the function returns "pass" when given the SSN "55-55-555". - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -import pytest -from temporalio.testing import ActivityEnvironment -from activities.ssntraceactivity_dacx import ssn_trace_activity - - - - -@pytest.mark.asyncio -async def test_ssn_trace_activity() -> str: - activity_environment = ActivityEnvironment() - expected_output = "pass" - assert expected_output == await activity_environment.run( - ssn_trace_activity, "55-55-555" - ) -``` diff --git a/docs/dev-guide/python/test-suites.mdx b/docs/dev-guide/python/test-suites.mdx index 60f8047f9a..0440601901 100644 --- a/docs/dev-guide/python/test-suites.mdx +++ b/docs/dev-guide/python/test-suites.mdx @@ -3,7 +3,7 @@ id: test-suites title: Test suites sidebar_label: Test suites description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. -slug: /dev-guide/python/test_suites +slug: /dev-guide/python/test-suites toc_max_heading_level: 2 keywords: - developer-guide diff --git a/docs/encyclopedia/activities.mdx b/docs/encyclopedia/activities.mdx index 8ed5352fac..67c908e57e 100644 --- a/docs/encyclopedia/activities.mdx +++ b/docs/encyclopedia/activities.mdx @@ -39,7 +39,7 @@ An Activity Definition is the code that defines the constraints of an [Activity - [How to develop an Activity Definition using the Go SDK](/dev-guide/go/foundations#activity-definition) - [How to develop an Activity Definition using the Java SDK](/dev-guide/java/foundations#develop-activities) - [How to develop an Activity Definition using the PHP SDK](/dev-guide/php/foundations#develop-activities) -- [How to develop an Activity Definition using the Python SDK](/dev-guide/python/foundations#develop-activities) +- [How to develop an Activity Definition using the Python SDK](/dev-guide/python/core-applicaton#develop-activities) - [How to develop an Activity Definition using the TypeScript SDK](/dev-guide/typescript/foundations#develop-activities) The term 'Activity Definition' is used to refer to the full set of primitives in any given language SDK that provides an access point to an Activity Function Definition——the method or function that is invoked for an [Activity Task Execution](/workers#activity-task-execution). @@ -123,7 +123,7 @@ An Activity Execution is the full chain of [Activity Task Executions](/workers#a - [How to start an Activity Execution using the Go SDK](/dev-guide/go/foundations#activity-execution) - [How to start an Activity Execution using the Java SDK](/dev-guide/java/foundations#activity-execution) - [How to start an Activity Execution using the PHP SDK](/dev-guide/php/foundations#activity-execution) -- [How to start an Activity Execution using the Python SDK](/dev-guide/python/foundations#activity-execution) +- [How to start an Activity Execution using the Python SDK](/dev-guide/python/core-applicaton#activity-execution) - [How to start an Activity Execution using the TypeScript SDK](/dev-guide/typescript/foundations#activity-execution)
@@ -206,7 +206,7 @@ In other words, it's a limit for how long an Activity Task can be enqueued. - [How to set a Schedule-To-Start Timeout using the Go SDK](/dev-guide/go/features#activity-timeouts) - [How to set a Schedule-To-Start Timeout using the Java SDK](/dev-guide/java/features#activity-timeouts) - [How to set a Schedule-To-Start Timeout using the PHP SDK](/dev-guide/php/features#activity-timeouts) -- [How to set a Schedule-To-Start Timeout using the Python SDK](/dev-guide/python/features#activity-timeouts) +- [How to set a Schedule-To-Start Timeout using the Python SDK](/dev-guide/python/failure-detection#activity-timeouts) - [How to set a Schedule-To-Start Timeout using the TypeScript SDK](/dev-guide/typescript/features#activity-timeouts) The moment that the Task is picked by the Worker from the Task Queue is considered to be the start of the Activity Task for the purposes of the Schedule-To-Start Timeout and associated metrics. @@ -266,7 +266,7 @@ A Start-To-Close Timeout is the maximum time allowed for a single [Activity Task - [How to set a Start-To-Close Timeout using the Go SDK](/dev-guide/go/features#activity-timeouts) - [How to set a Start-To-Close Timeout using the Java SDK](/dev-guide/java/features#activity-timeouts) - [How to set a Start-To-Close Timeout using the PHP SDK](/dev-guide/php/features#activity-timeouts) -- [How to set a Start-To-Close Timeout using the Python SDK](/dev-guide/python/features#activity-timeouts) +- [How to set a Start-To-Close Timeout using the Python SDK](/dev-guide/python/failure-detection#activity-timeouts) - [How to set a Start-To-Close Timeout using the TypeScript SDK](/dev-guide/typescript/features#activity-timeouts) **The default Start-To-Close Timeout is the same as the default [Schedule-To-Close Timeout](#schedule-to-close-timeout).** @@ -384,7 +384,7 @@ Each ping informs the Temporal Cluster that the Activity Execution is making pro - [How to Heartbeat an Activity using the Go SDK](/dev-guide/go/features#activity-heartbeats) - [How to Heartbeat an Activity using the Java SDK](/dev-guide/java/features#activity-heartbeats) - [How to Heartbeat an Activity using the PHP SDK](/dev-guide/php/features#activity-heartbeats) -- [How to Heartbeat an Activity using the Python SDK](/dev-guide/python/features#activity-heartbeats) +- [How to Heartbeat an Activity using the Python SDK](/dev-guide/python/failure-detection#activity-heartbeats) - [How to Heartbeat an Activity using the TypeScript SDK](/dev-guide/typescript/features#activity-heartbeats) Activity Heartbeats work in conjunction with a [Heartbeat Timeout](#heartbeat-timeout). @@ -457,7 +457,7 @@ A Heartbeat Timeout is the maximum time between [Activity Heartbeats](#activity- - [How to set a Heartbeat Timeout using the Go SDK](/dev-guide/go/features#heartbeat-timeout) - [How to set a Heartbeat Timeout using the Java SDK](/dev-guide/java/features#heartbeat-timeout) - [How to set a Heartbeat Timeout using the PHP SDK](/dev-guide/php/features#heartbeat-timeout) -- [How to set a Heartbeat Timeout using the Python SDK](/dev-guide/python/features#heartbeat-timeout) +- [How to set a Heartbeat Timeout using the Python SDK](/dev-guide/python/failure-detection#heartbeat-timeout) - [How to set a Heartbeat Timeout using the TypeScript SDK](/dev-guide/typescript/features#heartbeat-timeout)
@@ -485,7 +485,7 @@ How to complete an Activity Asynchronously in: - [Go](/dev-guide/go/features#asynchronous-activity-completion) - [Java](/dev-guide/java/features#asynchronous-activity-completion) - [PHP](/dev-guide/php/features#asynchronous-activity-completion) -- [Python](/dev-guide/python/features#asynchronous-activity-completion) +- [Python](/dev-guide/python/asynchronous-activity-completion#asynchronously-complete-an-activity) - [TypeScript](/dev-guide/typescript/features#asynchronous-activity-completion) #### When to use Async Completion diff --git a/docs/encyclopedia/retry-policies.mdx b/docs/encyclopedia/retry-policies.mdx index 277b25ec15..2c86a7d1c8 100644 --- a/docs/encyclopedia/retry-policies.mdx +++ b/docs/encyclopedia/retry-policies.mdx @@ -25,7 +25,7 @@ A Retry Policy is a collection of attributes that instructs the Temporal Server - [How to set a custom Retry Policy for an Activity in Go](/dev-guide/go/features#activity-retries) - [How to set a custom Retry Policy for an Activity in Java](/dev-guide/java/features#activity-retries) - [How to set a custom Retry Policy for an Activity in PHP](/dev-guide/php/features#activity-retries) -- [How to set a custom Retry Policy for an Activity in Python](/dev-guide/python/features#activity-retries) +- [How to set a custom Retry Policy for an Activity in Python](/dev-guide/python/failure-detection#activity-retries) - [How to set a custom Retry Policy for an Activity in TypeScript](/dev-guide/typescript/features#activity-retries) --- @@ -33,7 +33,7 @@ A Retry Policy is a collection of attributes that instructs the Temporal Server - [How to set a Retry Policy for a Workflow in Go](/dev-guide/go/features#workflow-retries) - [How to set a Retry Policy for a Workflow in Java](/dev-guide/java/features#workflow-retries) - [How to set a Retry Policy for a Workflow in PHP](/dev-guide/php/features#workflow-retries) -- [How to set a Retry Policy for a Workflow in Python](/dev-guide/python/features#workflow-retries) +- [How to set a Retry Policy for a Workflow in Python](/dev-guide/python/failure-detection#workflow-retries) - [How to set a Retry Policy for a Workflow in TypeScript](/dev-guide/typescript/features#workflow-retries)
diff --git a/docs/encyclopedia/workflows.mdx b/docs/encyclopedia/workflows.mdx index fe566ab072..cb673a3f2e 100644 --- a/docs/encyclopedia/workflows.mdx +++ b/docs/encyclopedia/workflows.mdx @@ -350,7 +350,7 @@ If a failure occurs, the Workflow Execution picks up where the last recorded eve - [How to use Replay APIs using the Go SDK](/dev-guide/go/testing#replay) - [How to use Replay APIs using the Java SDK](/dev-guide/java/testing#replay) -- [How to use Replay APIs using the Python SDK](/dev-guide/python/testing#replay) +- [How to use Replay APIs using the Python SDK](/dev-guide/python/test-suites#replay) - [How to use Replay APIs using the TypeScript SDK](/dev-guide/typescript/testing#replay) ### Commands and awaitables @@ -790,7 +790,7 @@ Workers consume no additional resources while waiting for a Timer to fire, so a - [How to set Timers in Go](/dev-guide/go/features#timers) - [How to set Timers in Java](/dev-guide/java/features#timers) - [How to set Timers in PHP](/dev-guide/php/features#timers) -- [How to set Timers in Python](/dev-guide/python/features#timers) +- [How to set Timers in Python](/dev-guide/python/timers) - [How to set Timers in TypeScript](/dev-guide/typescript/features#timers) The duration of a Timer is fixed, and your Workflow might specify a value as short as one second or as long as several years. @@ -827,7 +827,7 @@ A Signal is an asynchronous request to a [Workflow Execution](#workflow-executio - [How to develop, send, and handle Signals in Go](/dev-guide/go/features#signals) - [How to develop, send, and handle Signals in Java](/dev-guide/java/features#signals) - [How to develop, send, and handle Signals in PHP](/dev-guide/php/features#signals) -- [How to develop, send, and handle Signals in Python](/dev-guide/python/features#signals) +- [How to develop, send, and handle Signals in Python](/dev-guide/python/messages#signals) - [How to develop, send, and handle Signals in TypeScript](/dev-guide/typescript/features#signals) A Signal delivers data to a running Workflow Execution. @@ -864,7 +864,7 @@ How to Signal-With-Start in: - [How to Signal-With-Start in Go](/dev-guide/go/features#signal-with-start) - [How to Signal-With-Start in Java](/dev-guide/java/features#signal-with-start) - [How to Signal-With-Start in PHP](/dev-guide/php/features#signal-with-start) -- [How to Signal-With-Start in Python](/dev-guide/python/features#signal-with-start) +- [How to Signal-With-Start in Python](/dev-guide/python/messages#signal-with-start) - [How to Signal-With-Start in TypeScript](/dev-guide/typescript/features#signal-with-start) ## What is a Query? {#query} @@ -878,7 +878,7 @@ Queries are available for running or completed Workflows Executions only if the - [How to send and handle Queries with the Go SDK](/dev-guide/go/features#queries) - [How to send and handle Queries with the Java SDK](/dev-guide/java/features#queries) - [How to send and handle Queries with the PHP SDK](/dev-guide/php/features#queries) -- [How to send and handle Queries with the Python SDK](/dev-guide/python/features#queries) +- [How to send and handle Queries with the Python SDK](/dev-guide/python/messages#queries) - [How to send and handle Queries with the TypeScript SDK](/dev-guide/typescript/features#queries) Queries are sent from a Temporal Client to a Workflow Execution. @@ -920,7 +920,7 @@ Stack Trace Queries are available only for running Workflow Executions. - Introduced in [Temporal Server version 1.21](https://github.com/temporalio/temporal/releases/tag/v1.21.0) - Available in [Go SDK](https://pkg.go.dev/go.temporal.io/sdk@v1.23.1/client#Client.UpdateWorkflowWithOptions) since [v1.23.0](https://github.com/temporalio/sdk-go/releases/tag/v1.23.0) - Available in [Java SDK]() since [v1.20.0](https://github.com/temporalio/sdk-java/releases/tag/v1.20.0) -- Available in [Python SDK](https://docs.temporal.io/dev-guide/python/features#updates) since [v1.4.0](https://github.com/temporalio/sdk-python/releases/tag/1.4.0) +- Available in [Python SDK](https://docs.temporal.io/dev-guide/python/messages#updates) since [v1.4.0](https://github.com/temporalio/sdk-python/releases/tag/1.4.0) - Available in [.NET SDK](https://dotnet.temporal.io/api/Temporalio.Client.WorkflowHandle.html#Temporalio_Client_WorkflowHandle_ExecuteUpdateAsync_System_String_System_Collections_Generic_IReadOnlyCollection_System_Object__Temporalio_Client_WorkflowUpdateOptions_) since [v0.1.0-beta2](https://github.com/temporalio/sdk-dotnet/releases/tag/0.1.0-beta2) - Available in [TypeScript SDK](https://typescript.temporal.io/api/interfaces/client.WorkflowHandle#executeupdate) since [v1.9.0](https://github.com/temporalio/sdk-typescript/releases/tag/v1.9.0) - Available in [PHP SDK](https://php.temporal.io/classes/Temporal-Client-WorkflowStubInterface.html#method_startUpdate) since [v2.8.0](https://github.com/temporalio/sdk-php/releases/tag/v2.8.0) @@ -930,7 +930,7 @@ Stack Trace Queries are available only for running Workflow Executions. An Update is a request and response from a Temporal Client to a [Workflow Execution](#workflow-execution). - [How to develop, send, and handle Updates in Go](/dev-guide/go/features#updates) -- [How to develop, and send Updates in Python](/dev-guide/python/features#updates) +- [How to develop, and send Updates in Python](/dev-guide/python/messages#updates) - [How to develop, send, and handle Updates in Java](/dev-guide/java/features#updates) - [How to develop, send, and handle Updates in PHP](/dev-guide/php/features#updates) @@ -990,7 +990,7 @@ Temporal supports Dynamic Workflows, Activities, Signals, and Queries. Currently, the Temporal SDKs that support Dynamic Handlers are: - [Java](/dev-guide/java/features#dynamic-handler) -- [Python](/dev-guide/python/features#dynamic-handler) +- [Python](/dev-guide/messages/features#dynamic-handler) - .NET The Go SDK supports Dynamic Signals through the [GetUnhandledSignalNames](https://pkg.go.dev/go.temporal.io/sdk/workflow#GetUnhandledSignalNames) function. @@ -1041,7 +1041,7 @@ If there is any chance that the code provided to the Side Effect could fail, use - Available in Temporal Cloud - Available in [Go SDK](/dev-guide/go/features#schedule-a-workflow) since [v1.22.0](https://github.com/temporalio/sdk-go/releases/tag/v1.22.0) - Available in [Java SDK](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/client/schedules/package-summary.html) since [v1.20.0](https://github.com/temporalio/sdk-java/releases/tag/v1.20.0) -- Available in [Python SDK](/dev-guide/python/features#schedule-a-workflow) since [v1.1.0](https://github.com/temporalio/sdk-python/releases/tag/1.1.0) +- Available in [Python SDK](/dev-guide/python/schedules#schedule-a-workflow) since [v1.1.0](https://github.com/temporalio/sdk-python/releases/tag/1.1.0) - Available in [TypeScript SDK](https://github.com/temporalio/samples-typescript/tree/main/schedules#schedules) since [v1.5.0](https://github.com/temporalio/sdk-typescript/blob/main/CHANGELOG.md#150---2022-12-07) - Available in [.NET SDK](https://dotnet.temporal.io/api/Temporalio.Client.Schedules.html) since [v0.1.0](https://github.com/temporalio/sdk-dotnet/releases/tag/0.1.0-alpha4) - Available in PHP SDK since [v2.8.0](https://github.com/temporalio/sdk-php/releases/tag/v2.8.0) @@ -1266,7 +1266,7 @@ A Temporal Cron Job is the series of Workflow Executions that occur when a Cron - [How to set a Cron Schedule using the Go SDK](/dev-guide/go/features#temporal-cron-jobs) - [How to set a Cron Schedule using the Java SDK](/dev-guide/java/features#cron-schedule) - [How to set a Cron Schedule using the PHP SDK](/dev-guide/php/features#temporal-cron-jobs) -- [How to set a Cron Schedule using the Python SDK](/dev-guide/python/features#temporal-cron-jobs) +- [How to set a Cron Schedule using the Python SDK](/dev-guide/python/timers#temporal-cron-jobs) - [How to set a Cron Schedule using the TypeScript SDK](/dev-guide/typescript/features#temporal-cron-jobs)
diff --git a/docusaurus.config.js b/docusaurus.config.js index b45ebb3dde..0562339f03 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -9,7 +9,6 @@ module.exports = async function createConfigAsync() { tagline: "Build invincible applications", url: "https://docs.temporal.io", baseUrl: "/", - onBrokenAnchors: "throw", onBrokenLinks: "throw", onBrokenMarkdownLinks: "throw", favicon: "img/favicon.svg", From edbd990cfdec45b42144090eab4818b98e080534 Mon Sep 17 00:00:00 2001 From: rachfop Date: Thu, 9 May 2024 11:15:07 -0700 Subject: [PATCH 11/26] update docs --- docs/dev-guide/python/index.mdx | 3 +- docs/dev-guide/python/temporal-clients.mdx | 57 ++++++++++++++++++- docs/encyclopedia/activities.mdx | 4 +- docs/encyclopedia/child-workflows.mdx | 4 +- docs/encyclopedia/temporal-sdks.mdx | 2 +- docs/encyclopedia/visibility.mdx | 1 + docs/encyclopedia/workers.mdx | 10 ++-- docs/encyclopedia/workflows.mdx | 16 +++--- .../development-features/core-application.mdx | 2 +- .../development-features/temporal-client.mdx | 2 +- .../throughput-composability.mdx | 2 +- .../cloud/get-started.mdx | 2 +- .../cloud/metrics/prometheus-grafana.mdx | 2 +- docusaurus.config.js | 1 - 14 files changed, 81 insertions(+), 27 deletions(-) diff --git a/docs/dev-guide/python/index.mdx b/docs/dev-guide/python/index.mdx index a344324b77..f1bb1e2a17 100644 --- a/docs/dev-guide/python/index.mdx +++ b/docs/dev-guide/python/index.mdx @@ -31,6 +31,7 @@ Develop basic Temporal application with Workflows and Activities in Python using Master the Temporal Python Client with our comprehensive guide that covers everything from initialization to Workflow Execution. - [Connect to development Temporal Service](/dev-guide/python/temporal-clients#connect-to-development-service) +- [Connect a Temporal Client to a Temporal Cluster](/dev-guide/python/temporal-clients#connect-to-a-dev-cluster) - [Connect to Temporal Cloud](/dev-guide/python/temporal-clients#connect-to-temporal-cloud) - [Start a Workflow Execution](/dev-guide/python/temporal-clients#start-workflow-execution) @@ -105,7 +106,7 @@ Learn about observability tools for Temporal applications, covering metrics, tra The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. -- [Debugging](/dev-guide/python/debugging#debugging) +- [Debugging](/dev-guide/python/debugging#debug) ## Schedules diff --git a/docs/dev-guide/python/temporal-clients.mdx b/docs/dev-guide/python/temporal-clients.mdx index 925c37eaf4..a4f2cecf10 100644 --- a/docs/dev-guide/python/temporal-clients.mdx +++ b/docs/dev-guide/python/temporal-clients.mdx @@ -86,6 +86,59 @@ if __name__ == "__main__": asyncio.run(main()) ``` +## Connect a Temporal Client to a Temporal Cluster {#connect-to-a-dev-cluster} + +**How to connect to a Temporal Cluster** + +A [Temporal Client](/encyclopedia/temporal-sdks#temporal-client) enables you to communicate with the [Temporal Cluster](/clusters). +Communication with a Temporal Cluster includes, but isn't limited to, the following: + +- Starting Workflow Executions. +- Sending Signals to Workflow Executions. +- Sending Queries to Workflow Executions. +- Getting the results of a Workflow Execution. +- Providing an Activity Task Token. + +:::caution + +A Temporal Client cannot be initialized and used inside a Workflow. +However, it is acceptable and common to use a Temporal Client inside an Activity to communicate with a Temporal Cluster. + +::: + +When you are running a Cluster locally (such as the [Temporal CLI](https://docs.temporal.io/cli/server#start-dev)), the number of connection options you must provide is minimal. +Many SDKs default to the local host or IP address and port that Temporalite and [Docker Compose](https://github.com/temporalio/docker-compose) serve (`127.0.0.1:7233`). + +Use the `connect()` method on the Client class to create and connect to a Temporal Client to the Temporal Cluster. + +
+ + View the source code + {' '} + in the context of the rest of the application code. +
+ +```python + +# ... +async def main(): + client = await Client.connect("localhost:7233") + + result = await client.execute_workflow( + YourWorkflow.run, + "your name", + id="your-workflow-id", + task_queue="your-task-queue", + ) + + print(f"Result: {result}") + + +if __name__ == "__main__": + asyncio.run(main()) +``` + + ## Connect to Temporal Cloud {#connect-to-temporal-cloud} **How to connect to Temporal Cloud using the Python SDK** @@ -143,9 +196,9 @@ async def main(): [Workflow Execution](/workflows#workflow-execution) semantics rely on several parameters—that is, to start a Workflow Execution you must supply a Task Queue that will be used for the Tasks (one that a Worker is polling), the Workflow Type, language-specific contextual data, and Workflow Function parameters. In the examples below, all Workflow Executions are started using a Temporal Client. -To spawn Workflow Executions from within another Workflow Execution, use either the [Child Workflow](#child-workflows) or External Workflow APIs. +To spawn Workflow Executions from within another Workflow Execution, use either the [Child Workflow](/dev-guide/python/child-workflows) or External Workflow APIs. -See the [Customize Workflow Type](#workflow-type) section to see how to customize the name of the Workflow Type. +See the [Customize Workflow Type](/dev-guide/python/core-application#workflow-type) section to see how to customize the name of the Workflow Type. A request to spawn a Workflow Execution causes the Temporal Cluster to create the first Event ([WorkflowExecutionStarted](/references/events#workflowexecutionstarted)) in the Workflow Execution Event History. The Temporal Cluster then creates the first Workflow Task, resulting in the first [WorkflowTaskScheduled](/references/events#workflowtaskscheduled) Event. diff --git a/docs/encyclopedia/activities.mdx b/docs/encyclopedia/activities.mdx index 67c908e57e..be673d5dfe 100644 --- a/docs/encyclopedia/activities.mdx +++ b/docs/encyclopedia/activities.mdx @@ -39,7 +39,7 @@ An Activity Definition is the code that defines the constraints of an [Activity - [How to develop an Activity Definition using the Go SDK](/dev-guide/go/foundations#activity-definition) - [How to develop an Activity Definition using the Java SDK](/dev-guide/java/foundations#develop-activities) - [How to develop an Activity Definition using the PHP SDK](/dev-guide/php/foundations#develop-activities) -- [How to develop an Activity Definition using the Python SDK](/dev-guide/python/core-applicaton#develop-activities) +- [How to develop an Activity Definition using the Python SDK](/dev-guide/python/core-application#develop-activities) - [How to develop an Activity Definition using the TypeScript SDK](/dev-guide/typescript/foundations#develop-activities) The term 'Activity Definition' is used to refer to the full set of primitives in any given language SDK that provides an access point to an Activity Function Definition——the method or function that is invoked for an [Activity Task Execution](/workers#activity-task-execution). @@ -123,7 +123,7 @@ An Activity Execution is the full chain of [Activity Task Executions](/workers#a - [How to start an Activity Execution using the Go SDK](/dev-guide/go/foundations#activity-execution) - [How to start an Activity Execution using the Java SDK](/dev-guide/java/foundations#activity-execution) - [How to start an Activity Execution using the PHP SDK](/dev-guide/php/foundations#activity-execution) -- [How to start an Activity Execution using the Python SDK](/dev-guide/python/core-applicaton#activity-execution) +- [How to start an Activity Execution using the Python SDK](/dev-guide/python/core-application#activity-execution) - [How to start an Activity Execution using the TypeScript SDK](/dev-guide/typescript/foundations#activity-execution)
diff --git a/docs/encyclopedia/child-workflows.mdx b/docs/encyclopedia/child-workflows.mdx index beb0ccfbba..f86ecc96bd 100644 --- a/docs/encyclopedia/child-workflows.mdx +++ b/docs/encyclopedia/child-workflows.mdx @@ -31,7 +31,7 @@ A Child Workflow Execution is a [Workflow Execution](/workflows#workflow-executi - [Go SDK Child Workflow feature guide](/dev-guide/go/features#child-workflows) - [Java SDK Child Workflow feature guide](/dev-guide/java/features#child-workflows) - [PHP SDK Child Workflow feature guide](/dev-guide/php/features#child-workflows) -- [Python SDK Child Workflow feature guide](/dev-guide/python/features#child-workflows) +- [Python SDK Child Workflow feature guide](//dev-guide/python/child-workflows) - [TypeScript SDK Child Workflow feature guide](/dev-guide/typescript/features#child-workflows) A Workflow Execution can be both a Parent and a Child Workflow Execution because any Workflow can spawn another Workflow. @@ -149,7 +149,7 @@ A Parent Close Policy determines what happens to a Child Workflow Execution if i - [How to set a Parent Close Policy using the Go SDK](/dev-guide/go/features#parent-close-policy) - [How to set a Parent Close Policy using the Java SDK](/dev-guide/java/features#parent-close-policy) - [How to set a Parent Close Policy using the PHP SDK](/dev-guide/php/features#parent-close-policy) -- [How to set a Parent Close Policy using the Python SDK](/dev-guide/python/features#parent-close-policy) +- [How to set a Parent Close Policy using the Python SDK](/dev-guide/python/child-workflows#parent-close-policy) - [How to set a Parent Close Policy using the TypeScript SDK](/dev-guide/typescript/features#parent-close-policy) There are three possible values: diff --git a/docs/encyclopedia/temporal-sdks.mdx b/docs/encyclopedia/temporal-sdks.mdx index 192dc1d3eb..d3cb7cadb9 100644 --- a/docs/encyclopedia/temporal-sdks.mdx +++ b/docs/encyclopedia/temporal-sdks.mdx @@ -208,7 +208,7 @@ For tested code samples and best practices, use your preferred language SDK's de - [Go SDK Temporal Client feature guide](/develop/go/temporal-client) - [Java SDK Temporal Client feature guide](/develop/java/temporal-client) - [PHP SDK Temporal Client feature guide](/dev-guide/php/foundations#connect-to-a-dev-cluster) -- [Python SDK Temporal Client feature guide](/dev-guide/python/foundations#connect-to-a-dev-cluster) +- [Python SDK Temporal Client feature guide](/dev-guide/python/temporal-clients#connect-to-a-dev-cluster) - [TypeScript SDK Temporal Client feature guide](/dev-guide/typescript/foundations#connect-to-a-dev-cluster) ::: diff --git a/docs/encyclopedia/visibility.mdx b/docs/encyclopedia/visibility.mdx index 7ab8d527f2..13669922e5 100644 --- a/docs/encyclopedia/visibility.mdx +++ b/docs/encyclopedia/visibility.mdx @@ -17,6 +17,7 @@ tags: - visibility --- + This guide provides a comprehensive overview of Temporal Visibility. :::tip Support, stability, and dependency info diff --git a/docs/encyclopedia/workers.mdx b/docs/encyclopedia/workers.mdx index afa655e450..3f90401357 100644 --- a/docs/encyclopedia/workers.mdx +++ b/docs/encyclopedia/workers.mdx @@ -38,7 +38,7 @@ A Worker Program is the static code that defines the constraints of the Worker P - [How to run a development Worker using the Go SDK](/dev-guide/go/foundations#develop-worker) - [How to run a development Worker using the Java SDK](/dev-guide/java/foundations#run-a-dev-worker) - [How to run a development Worker using the PHP SDK](/dev-guide/php/foundations#run-a-dev-worker) -- [How to run a development Worker using the Python SDK](/dev-guide/python/foundations#run-a-dev-worker) +- [How to run a development Worker using the Python SDK](/dev-guide/python/core-application#run-a-dev-worker) - [How to run a development Worker using the TypeScript SDK](/dev-guide/typescript/foundations#run-a-dev-worker) - [How to run a Temporal Cloud Worker using the Go SDK](/dev-guide/go/foundations#run-a-temporal-cloud-worker) @@ -237,7 +237,7 @@ There are four places where the name of the Task Queue can be set by the develop - [How to start a Workflow Execution using the Go SDK](/develop/go/temporal-client#start-workflow-execution) - [How to start a Workflow Execution using the Java SDK](/develop/java/temporal-client#start-workflow-execution) - [How to start a Workflow Execution using the PHP SDK](/dev-guide/php/foundations#start-workflow-execution) -- [How to start a Workflow Execution using the Python SDK](/dev-guide/python/foundations#start-workflow-execution) +- [How to start a Workflow Execution using the Python SDK](/dev-guide/python/temporal-clients#start-workflow-execution) - [How to start a Workflow Execution using the TypeScript SDK](/dev-guide/typescript/foundations#start-workflow-execution) 2. A Task Queue name must be set when creating a Worker Entity and when running a Worker Process: @@ -245,7 +245,7 @@ There are four places where the name of the Task Queue can be set by the develop - [How to run a development Worker using the Go SDK](/dev-guide/go/foundations#develop-worker) - [How to run a development Worker using the Java SDK](/dev-guide/java/foundations#run-a-dev-worker) - [How to run a development Worker using the PHP SDK](/dev-guide/php/foundations#run-a-dev-worker) -- [How to run a development Worker using the Python SDK](/dev-guide/python/foundations#run-a-dev-worker) +- [How to run a development Worker using the Python SDK](/dev-guide/python/core-application#run-a-dev-worker) - [How to run a development Worker using the TypeScript SDK](/dev-guide/typescript/foundations#run-a-dev-worker) - [How to run a Temporal Cloud Worker using the Go SDK](/dev-guide/go/foundations#run-a-temporal-cloud-worker) @@ -264,7 +264,7 @@ An Activity Execution inherits the Task Queue name from its Workflow Execution i - [How to start an Activity Execution using the Go SDK](/dev-guide/go/foundations#activity-execution) - [How to start an Activity Execution using the Java SDK](/dev-guide/java/foundations#activity-execution) - [How to start an Activity Execution using the PHP SDK](/dev-guide/php/foundations#activity-execution) -- [How to start an Activity Execution using the Python SDK](/dev-guide/python/foundations#activity-execution) +- [How to start an Activity Execution using the Python SDK](/dev-guide/python/core-application#activity-execution) - [How to start an Activity Execution using the TypeScript SDK](/dev-guide/typescript/foundations#activity-execution) 4. A Task Queue name can be provided when spawning a Child Workflow Execution: @@ -275,7 +275,7 @@ A Child Workflow Execution inherits the Task Queue name from its Parent Workflow - [How to start a Child Workflow Execution using the Go SDK](/dev-guide/go/features#child-workflows) - [How to start a Child Workflow Execution using the Java SDK](/dev-guide/java/features#child-workflows) - [How to start a Child Workflow Execution using the PHP SDK](/dev-guide/php/features#child-workflows) -- [How to start a Child Workflow Execution using the Python SDK](/dev-guide/python/features#child-workflows) +- [How to start a Child Workflow Execution using the Python SDK](//dev-guide/python/child-workflows) - [How to start a Child Workflow Execution using the TypeScript SDK](/dev-guide/typescript/features#child-workflows) #### Task ordering diff --git a/docs/encyclopedia/workflows.mdx b/docs/encyclopedia/workflows.mdx index cb673a3f2e..2a09e3c8ae 100644 --- a/docs/encyclopedia/workflows.mdx +++ b/docs/encyclopedia/workflows.mdx @@ -109,7 +109,7 @@ class YourBasicWorkflowImpl implements YourBasicWorkflow { -**[Workflow Definition in Python](/dev-guide/python/foundations#develop-workflows)** +**[Workflow Definition in Python](/dev-guide/python/core-application#develop-workflows)** ```Python @workflow.defn @@ -313,7 +313,7 @@ It is the main unit of execution of a [Temporal Application](/temporal#temporal- - [How to start a Workflow Execution using the Go SDK](/develop/go/temporal-client#start-workflow-execution) - [How to start a Workflow Execution using the Java SDK](/develop/java/temporal-client#start-workflow-execution) - [How to start a Workflow Execution using the PHP SDK](/dev-guide/php/foundations#start-workflow-execution) -- [How to start a Workflow Execution using the Python SDK](/dev-guide/python/foundations#start-workflow-execution) +- [How to start a Workflow Execution using the Python SDK](/dev-guide/python/temporal-clients#start-workflow-execution) - [How to start a Workflow Execution using the TypeScript SDK](/dev-guide/typescript/foundations#start-workflow-execution) Each Temporal Workflow Execution has exclusive access to its local state. @@ -599,7 +599,7 @@ In the case of [Temporal Cron Jobs](#temporal-cron-job), Continue-As-New is actu - [How to Continue-As-New using the Go SDK](/dev-guide/go/features#continue-as-new) - [How to Continue-As-New using the Java SDK](/dev-guide/java/features#continue-as-new) - [How to Continue-As-New using the PHP SDK](/dev-guide/php/features#continue-as-new) -- [How to Continue-As-New using the Python SDK](/dev-guide/python/features#continue-as-new) +- [How to Continue-As-New using the Python SDK](/dev-guide/python/continue-as-new) - [How to Continue-As-New using the TypeScript SDK](/dev-guide/typescript/features#continue-as-new) ### What is a Reset? {#reset} @@ -702,7 +702,7 @@ A Workflow Execution Timeout is the maximum time that a Workflow Execution can b - [How to set a Workflow Execution Timeout using the Go SDK](/dev-guide/go/features#workflow-timeouts) - [How to set a Workflow Execution Timeout using the Java SDK](/dev-guide/java/features#workflow-timeouts) - [How to set a Workflow Execution Timeout using the PHP SDK](/dev-guide/php/features#workflow-timeouts) -- [How to set a Workflow Execution Timeout using the Python SDK](/dev-guide/python/features#workflow-timeouts) +- [How to set a Workflow Execution Timeout using the Python SDK](/dev-guide/python/failure-detection#workflow-timeouts) - [How to set a Workflow Execution Timeout using the TypeScript SDK](/dev-guide/typescript/features#workflow-timeouts)
@@ -730,7 +730,7 @@ A Workflow Run Timeout is the maximum amount of time that a single Workflow Run - [How to set a Workflow Run Timeout using the Go SDK](/dev-guide/go/features#workflow-timeouts) - [How to set a Workflow Run Timeout using the Java SDK](/dev-guide/java/features#workflow-timeouts) - [How to set a Workflow Run Timeout using the PHP SDK](/dev-guide/php/features#workflow-timeouts) -- [How to set a Workflow Run Timeout using the Python SDK](/dev-guide/python/features#workflow-timeouts) +- [How to set a Workflow Run Timeout using the Python SDK](/dev-guide/python/failure-detection#workflow-timeouts) - [How to set a Workflow Run Timeout using the TypeScript SDK](/dev-guide/typescript/features#workflow-timeouts)
@@ -758,7 +758,7 @@ A Workflow Task Timeout is the maximum amount of time allowed for a [Worker](/wo - [How to set a Workflow Task Timeout using the Go SDK](/dev-guide/go/features#workflow-timeouts) - [How to set a Workflow Task Timeout using the Java SDK](/dev-guide/java/features#workflow-timeouts) - [How to set a Workflow Task Timeout using the PHP SDK](/dev-guide/php/features#workflow-timeouts) -- [How to set a Workflow Task Timeout using the Python SDK](/dev-guide/python/features#workflow-timeouts) +- [How to set a Workflow Task Timeout using the Python SDK](/dev-guide/python/failure-detection#workflow-timeouts) - [How to set a Workflow Task Timeout using the TypeScript SDK](/dev-guide/typescript/features#workflow-timeouts)
@@ -990,7 +990,7 @@ Temporal supports Dynamic Workflows, Activities, Signals, and Queries. Currently, the Temporal SDKs that support Dynamic Handlers are: - [Java](/dev-guide/java/features#dynamic-handler) -- [Python](/dev-guide/messages/features#dynamic-handler) +- [Python](/dev-guide/python/messages#dynamic-handler) - .NET The Go SDK supports Dynamic Signals through the [GetUnhandledSignalNames](https://pkg.go.dev/go.temporal.io/sdk/workflow#GetUnhandledSignalNames) function. @@ -1266,7 +1266,7 @@ A Temporal Cron Job is the series of Workflow Executions that occur when a Cron - [How to set a Cron Schedule using the Go SDK](/dev-guide/go/features#temporal-cron-jobs) - [How to set a Cron Schedule using the Java SDK](/dev-guide/java/features#cron-schedule) - [How to set a Cron Schedule using the PHP SDK](/dev-guide/php/features#temporal-cron-jobs) -- [How to set a Cron Schedule using the Python SDK](/dev-guide/python/timers#temporal-cron-jobs) +- [How to set a Cron Schedule using the Python SDK](/dev-guide/python/schedules#temporal-cron-jobs) - [How to set a Cron Schedule using the TypeScript SDK](/dev-guide/typescript/features#temporal-cron-jobs)
diff --git a/docs/evaluate/development-features/core-application.mdx b/docs/evaluate/development-features/core-application.mdx index 66e325bbe4..3384c23381 100644 --- a/docs/evaluate/development-features/core-application.mdx +++ b/docs/evaluate/development-features/core-application.mdx @@ -45,7 +45,7 @@ Or jump straight to a Temporal SDK feature guide: - [Go SDK Core application feature guide](/develop/go/temporal-client) - [Java SDK Core application feature guide](/develop/java/temporal-client#connect-to-development-service) - [PHP SDK Core application feature guide](/dev-guide/php/foundations#connect-to-a-dev-cluster) -- [Python SDK Core application feature guide](/dev-guide/python/foundations#connect-to-a-dev-cluster) +- [Python SDK Core application feature guide](/dev-guide/python/temporal-clients#connect-to-a-dev-cluster) - [TypeScript SDK Core application feature guide](/dev-guide/typescript/foundations#connect-to-a-dev-cluster) For a deep dive into Temporal Workflows, Activities, and Workers, visit the following Temporal Encyclopedia pages or enroll in one of [our courses](https://learn.temporal.io/courses/): diff --git a/docs/evaluate/development-features/temporal-client.mdx b/docs/evaluate/development-features/temporal-client.mdx index 90ea71f656..d319b083d7 100644 --- a/docs/evaluate/development-features/temporal-client.mdx +++ b/docs/evaluate/development-features/temporal-client.mdx @@ -41,7 +41,7 @@ Or jump straight to a Temporal SDK feature guide: - [Go SDK Temporal Client feature guide](/develop/go/temporal-client) - [Java SDK Temporal Client feature guide](/develop/java/temporal-client) - [PHP SDK Temporal Client feature guide](/dev-guide/php/foundations#connect-to-a-dev-cluster) -- [Python SDK Temporal Client feature guide](/dev-guide/python/foundations#connect-to-a-dev-cluster) +- [Python SDK Temporal Client feature guide](/dev-guide/python/temporal-clients#connect-to-a-dev-cluster) - [TypeScript SDK Temporal Client feature guide](/dev-guide/typescript/foundations#connect-to-a-dev-cluster) For a deep dive into how a Temporal Client work, visit the [Temporal SDKs Encyclopedia page](/encyclopedia/temporal-sdks#temporal-client) or enroll in one of [our courses](https://learn.temporal.io/courses/). diff --git a/docs/evaluate/development-features/throughput-composability.mdx b/docs/evaluate/development-features/throughput-composability.mdx index f8773604fa..49b893295d 100644 --- a/docs/evaluate/development-features/throughput-composability.mdx +++ b/docs/evaluate/development-features/throughput-composability.mdx @@ -32,7 +32,7 @@ See the SDK feature guides for implementation details: - [Go SDK Child Workflow feature guide](/dev-guide/go/features#child-workflows) - [Java SDK Child Workflow feature guide](/dev-guide/java/features#child-workflows) - [PHP SDK Child Workflow feature guide](/dev-guide/php/features#child-workflows) -- [Python SDK Child Workflow feature guide](/dev-guide/python/features#child-workflows) +- [Python SDK Child Workflow feature guide](//dev-guide/python/child-workflows) - [TypeScript SDK Child Workflow feature guide](/dev-guide/typescript/features#child-workflows) For a deep dive into Child Workflows see the [Child Workflows Encyclopedia page](/encyclopedia/child-workflows). diff --git a/docs/production-deployment/cloud/get-started.mdx b/docs/production-deployment/cloud/get-started.mdx index 686c763d13..d66cf17948 100644 --- a/docs/production-deployment/cloud/get-started.mdx +++ b/docs/production-deployment/cloud/get-started.mdx @@ -55,7 +55,7 @@ Each SDK has a way to use your CA certificates and private keys to authenticate - [Connect to Temporal Cloud in Go](/develop/go/temporal-client#connect-to-temporal-cloud) - [Connect to Temporal Cloud in Java](/develop/java/temporal-client#connect-to-temporal-cloud) -- [Connect to Temporal Cloud in Python](/dev-guide/python/foundations#connect-to-temporal-cloud) +- [Connect to Temporal Cloud in Python](/dev-guide/python/temporal-clients#connect-to-temporal-cloud) - [Connect to Temporal Cloud in TypeScript](/dev-guide/typescript/foundations#connect-to-temporal-cloud) - [Run a Temporal Cloud Worker in Go](/dev-guide/go/foundations#run-a-temporal-cloud-worker) diff --git a/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx b/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx index 2d83826b2e..2219c1d4a5 100644 --- a/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx +++ b/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx @@ -55,7 +55,7 @@ If you're following through with the examples provided here, ensure that you hav - [Go](/develop/go/temporal-client#connect-to-temporal-cloud) - [Java](/dev-guide/java/project-setup#cloud-worker) - [PHP](/dev-guide/php/foundations#connect-to-a-dev-cluster) - - [Python](/dev-guide/python/foundations#connect-to-temporal-cloud) + - [Python](/dev-guide/python/temporal-clients#connect-to-temporal-cloud) - [TypeScript](/dev-guide/typescript/foundations#connect-to-temporal-cloud) - Prometheus and Grafana installed. diff --git a/docusaurus.config.js b/docusaurus.config.js index 0562339f03..6481899424 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -10,7 +10,6 @@ module.exports = async function createConfigAsync() { url: "https://docs.temporal.io", baseUrl: "/", onBrokenLinks: "throw", - onBrokenMarkdownLinks: "throw", favicon: "img/favicon.svg", organizationName: "temporalio", // Usually your GitHub org/user name. projectName: "temporal-documentation", // Usually your repo name. From 0746a9a21bd553326ec7284502419962fb20fb0b Mon Sep 17 00:00:00 2001 From: rachfop Date: Mon, 13 May 2024 12:55:35 -0700 Subject: [PATCH 12/26] updates --- docs/dev-guide/python/messages.mdx | 177 ++++++++++++++++------------- 1 file changed, 100 insertions(+), 77 deletions(-) diff --git a/docs/dev-guide/python/messages.mdx b/docs/dev-guide/python/messages.mdx index 48914e214a..a248ce3c3e 100644 --- a/docs/dev-guide/python/messages.mdx +++ b/docs/dev-guide/python/messages.mdx @@ -28,15 +28,30 @@ tags: - dynamic-handlers --- -## Develop with Signals {#signals} +## What is a Signal? -**How to develop with Signals** +A [Signal](/workflows#signal) is a message sent asynchronously to a running Workflow Execution which can be used to change the state and control the flow of a Workflow Execution. +It can only deliver data to a Workflow Execution that has not already closed. -A [Signal](/workflows#signal) is a message sent to a running Workflow Execution. Signals are defined in your code and handled in your Workflow Definition. Signals can be sent to Workflow Executions from a Temporal Client or from another Workflow Execution. + +## Develop with Signals {#signals} + +**How to develop with Signals** + +There are two steps for adding support for a Signal to your Workflow code: +1. **[Defining the Signal](#define-signal)** - You specify the name and data structure used by Temporal Clients when sending the Signal. +2. **[Handling the Signal](#handle-signal)** - You write code that will be invoked when the Signal is received from a Temporal Client. + +After developing your Signal, you can send it from a [Temporal Client](#send-signal-from-client) or from another [Workflow Execution](#send-signal-from-workflow). + +### Defining Signals {#define-signal} + +**How to define a Signal** + A Signal has a name and can have arguments. - The name, also called a Signal type, is a string. @@ -48,21 +63,19 @@ Temporal suggests taking a single argument that is an object or data class of fi Return values from Signal methods are ignored. -**Customize names** +**How to customize names** You can have a name parameter to customize the Signal's name, otherwise it defaults to the name of the Signal method.
View the source code - {' '} + in the context of the rest of the application code.
```python - from temporalio import workflow -# ... # ... @workflow.signal async def submit_greeting(self, name: str) -> None: @@ -76,15 +89,22 @@ from temporalio import workflow await self._pending_greetings.put(name) ``` +### Handle Signals {#handle-signal} + +**How to hanlde a Signal** + Workflows listen for Signals by the Signal's name. +Signal handlers are functions defined in the Workflow that listen for incoming Signals of a given type. +These handlers define how a Workflow should react when it receives a specific type of Signal. + To send a Signal to the Workflow, use the [signal](https://python.temporal.io/temporalio.client.WorkflowHandle.html#signal) method from the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class.
- View the source code - {' '} - in the context of the rest of the application code. + View the source code in the context of the rest of the application code. + +
```python @@ -152,13 +172,12 @@ The Workflow Type passed is only for type annotations and not for validation. ```python - # ... @workflow.defn class WorkflowB: @@ -181,9 +200,9 @@ To send a Signal-With-Start in Python, use the [`start_workflow()`](https://pyth ```python @@ -227,9 +246,9 @@ You can either set the `name` or the `dynamic` parameter in a Query's decorator, ```python @@ -253,9 +272,9 @@ To send a Query to the Workflow, use the [`query`](https://python.temporal.io/te ```python @@ -275,9 +294,9 @@ To send a Query to a Workflow Execution from Client code, use the `query()` meth ```python @@ -327,7 +346,9 @@ To send a Workflow Update from a Temporal Client, call the [execute_update](http print(f"Update Result: {update_result}") ``` -## What is a Dynamic Handler {#dynamic-handler} +## Dynamic Handler {#dynamic-handler} + +**What is a Dynamic Handler?** Temporal supports Dynamic Workflows, Activities, Signals, and Queries. These are unnamed handlers that are invoked if no other statically defined handler with the given name exists. @@ -347,6 +368,58 @@ They are meant to handle edge cases and act as a catch-all, not as the main way ::: + +### Set a Dynamic Signal {#set-a-dynamic-signal} + +**How to set a Dynamic Signal** + +A Dynamic Signal in Temporal is a Signal that is invoked dynamically at runtime if no other Signal with the same input is registered. +A Signal can be made dynamic by adding `dynamic=True` to the `@signal.defn` decorator. + +The Signal Handler should accept `self`, a string input, and a `Sequence[temporalio.common.RawValue]`. +The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. + + + +```python + +# ... + @workflow.signal(dynamic=True) + async def dynamic_signal(self, name: str, args: Sequence[RawValue]) -> None: + await self._pending_greetings.put(name) +``` + +### Set a Dynamic Query {#set-a-dynamic-query} + +**How to set a Dynamic Query** + +A Dynamic Query in Temporal is a Query that is invoked dynamically at runtime if no other Query with the same name is registered. +A Query can be made dynamic by adding `dynamic=True` to the `@query.defn` decorator. + +The Query Handler should accept `self`, a string name, and a `Sequence[temporalio.common.RawValue]`. +The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. + + + +```python + +# ... + @workflow.query(dynamic=True) + def dynamic_query(self, input: str, args: Sequence[RawValue]) -> str: + return self._greeting +``` + + ### Set a Dynamic Workflow {#set-a-dynamic-workflow} **How to set a Dynamic Workflow** @@ -360,9 +433,9 @@ The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#pa ```python @@ -393,9 +466,9 @@ The [payload_converter()](https://python.temporal.io/temporalio.activity.html#pa ```python @@ -417,54 +490,4 @@ class GreetingWorkflow: YourDataClass("Hello", name), start_to_close_timeout=timedelta(seconds=10), ) -``` - -### Set a Dynamic Signal {#set-a-dynamic-signal} - -**How to set a Dynamic Signal** - -A Dynamic Signal in Temporal is a Signal that is invoked dynamically at runtime if no other Signal with the same input is registered. -A Signal can be made dynamic by adding `dynamic=True` to the `@signal.defn` decorator. - -The Signal Handler should accept `self`, a string input, and a `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.signal(dynamic=True) - async def dynamic_signal(self, name: str, args: Sequence[RawValue]) -> None: - await self._pending_greetings.put(name) -``` - -### Set a Dynamic Query {#set-a-dynamic-query} - -**How to set a Dynamic Query** - -A Dynamic Query in Temporal is a Query that is invoked dynamically at runtime if no other Query with the same name is registered. -A Query can be made dynamic by adding `dynamic=True` to the `@query.defn` decorator. - -The Query Handler should accept `self`, a string name, and a `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.query(dynamic=True) - def dynamic_query(self, input: str, args: Sequence[RawValue]) -> str: - return self._greeting -``` +``` \ No newline at end of file From 9b72745f1c9a7b803b33ce358d300b2e89505fcd Mon Sep 17 00:00:00 2001 From: rachfop Date: Mon, 20 May 2024 10:37:21 -0700 Subject: [PATCH 13/26] update schedules --- docs/dev-guide/python/schedules.mdx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/dev-guide/python/schedules.mdx b/docs/dev-guide/python/schedules.mdx index 78b6a7c0d9..efb474d56e 100644 --- a/docs/dev-guide/python/schedules.mdx +++ b/docs/dev-guide/python/schedules.mdx @@ -25,6 +25,22 @@ tags: - cron-jobs --- + +The pages shows how to do the following: + +- [Schedule a Workflow](#schedule-a-workflow) + - [Create a Scheduled Workflow](#create) + - [Backfill a Scheduled Workflow](#backfill) + - [Delete a Scheduled Workflow](#delete) + - [Describe a Scheduled Workflow](#describe) + - [List a Scheduled Workflow](#list) + - [Pause a Scheduled Workflow](#pause) + - [Trigger a Scheduled Workflow](#trigger) + - [Update a Scheduled Workflow](#update) +- [Temporal Cron Jobs](#temporal-cron-jobs) +- [Start Delay](#start-delay) + + ## Schedule a Workflow {#schedule-a-workflow} **How to Schedule a Workflow Execution** From e27376495cbcb8193a6708feb3be8d4ec9d8c65e Mon Sep 17 00:00:00 2001 From: rachfop Date: Mon, 20 May 2024 10:39:22 -0700 Subject: [PATCH 14/26] Update index page --- docs/dev-guide/python/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev-guide/python/index.mdx b/docs/dev-guide/python/index.mdx index f1bb1e2a17..57df6a824b 100644 --- a/docs/dev-guide/python/index.mdx +++ b/docs/dev-guide/python/index.mdx @@ -71,7 +71,7 @@ Explore using Signals in Temporal Python to send messages to Workflows, with det Cancel an Activity from a Workflow, sending Heartbeats and setting a Heartbeat Timeout, and handling cancellation errors. -- [Cancel an Activity from a Workflow](//dev-guide/python/cancellation#cancel-an-activity) +- [Cancel an Activity from a Workflow](/dev-guide/python/cancellation#cancel-an-activity) From 6bbaf4557d5b5b04bc72cb572dedd70bb5348b08 Mon Sep 17 00:00:00 2001 From: rachfop Date: Mon, 20 May 2024 11:21:53 -0700 Subject: [PATCH 15/26] Update index page --- docs/dev-guide/python/index.mdx | 93 +++++++++++++-------------------- 1 file changed, 35 insertions(+), 58 deletions(-) diff --git a/docs/dev-guide/python/index.mdx b/docs/dev-guide/python/index.mdx index 57df6a824b..30774088a0 100644 --- a/docs/dev-guide/python/index.mdx +++ b/docs/dev-guide/python/index.mdx @@ -1,6 +1,6 @@ --- id: index -title: Temporal Python SDK development documentation +title: Temporal Python SDK Development Documentation sidebar_label: Python SDK description: Learn how to use the Temporal Python SDK. slug: /dev-guide/python @@ -14,145 +14,122 @@ tags: - python --- -This guide is meant to provide a comprehensive overview of the structures, primitives, and features used in [Temporal Application](/temporal#temporal-application) development. +This guide provides a comprehensive overview of the structures, primitives, and features used in [Temporal Application](/temporal#temporal-application) development. -## Core application +## Core Application -Develop basic Temporal application with Workflows and Activities in Python using Temporal SDK. +The Core Application section of the Temporal Python SDK Developer's Guide covers the essential concepts and implementation details needed to build and run a Temporal Application. -- [Develop a basic Workflow](/dev-guide/python/core-application#develop-workflows) -- [Develop a basic Activity](/dev-guide/python/core-application#develop-activities) +- [Develop a Basic Workflow](/dev-guide/python/core-application#develop-workflows) +- [Develop a Basic Activity](/dev-guide/python/core-application#develop-activities) - [Start an Activity Execution](/dev-guide/python/core-application#activity-execution) -- [Run a Worker Processes](/dev-guide/python/core-application#run-a-dev-worker) - +- [Run Worker Processes](/dev-guide/python/core-application#run-a-dev-worker) ## Temporal Client -Master the Temporal Python Client with our comprehensive guide that covers everything from initialization to Workflow Execution. +The Temporal Client section of the Temporal Python SDK Developer's Guide describes how to use the Temporal Client to connect and start a Workflow Execution. -- [Connect to development Temporal Service](/dev-guide/python/temporal-clients#connect-to-development-service) +- [Connect to Development Temporal Service](/dev-guide/python/temporal-clients#connect-to-development-service) - [Connect a Temporal Client to a Temporal Cluster](/dev-guide/python/temporal-clients#connect-to-a-dev-cluster) - [Connect to Temporal Cloud](/dev-guide/python/temporal-clients#connect-to-temporal-cloud) - [Start a Workflow Execution](/dev-guide/python/temporal-clients#start-workflow-execution) +## Test Suites +The Testing section of the Temporal Python SDK Developer's Guide describes how to test your Temporal Application. -## Test suites - -The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. - -- [Test frameworks](/dev-guide/python/test-suites#test-frameworks) +- [Test Frameworks](/dev-guide/python/test-suites#test-frameworks) - [Testing Activities](/dev-guide/python/test-suites#test-activities) - [Testing Workflows](/dev-guide/python/test-suites#test-workflows) - [How to Replay a Workflow Execution](/dev-guide/python/test-suites#replay) +## Failure Detection -## Failure detection +The Failure Detection section of the Temporal Python SDK Developer's Guide describes how to configure timeouts and heartbeat intervals for Activities and Workflows. -- [Workflow timeouts](/dev-guide/python/failure-detection#workflow-timeouts) -- [Set Activity timeouts](/dev-guide/python/failure-detection#activity-timeouts) +- [Workflow Timeouts](/dev-guide/python/failure-detection#workflow-timeouts) +- [Set Activity Timeouts](/dev-guide/python/failure-detection#activity-timeouts) - [Heartbeat an Activity](/dev-guide/python/failure-detection#activity-heartbeats) - - ## Messages -Explore using Signals in Temporal Python to send messages to Workflows, with details on defining, sending, and handling Signals, including customization options. +The Messages section of the Temporal Python SDK Developer's Guide describes how to use the Temporal Client to send messages to a Workflow Execution. - [Develop with Signals](/dev-guide/python/messages#signals) - [Develop with Queries](/dev-guide/python/messages#queries) - [Develop with Updates](/dev-guide/python/messages#updates) - [What is a Dynamic Handler](/dev-guide/python/messages#dynamic-handler) - - - ## Cancellation -Cancel an Activity from a Workflow, sending Heartbeats and setting a Heartbeat Timeout, and handling cancellation errors. +The Cancellation section of the Temporal Python SDK Developer's Guide describes how to cancel a Workflow Execution. - [Cancel an Activity from a Workflow](/dev-guide/python/cancellation#cancel-an-activity) - - ## Asynchronous Activity Completion -Complete an Activity without waiting for execution to finish, using Temporal Client and Activity Function. - -- [Asynchronously complete an Activity](/dev-guide/python/asynchronous-activity-completion#asynchronously-complete-an-activity) - +The Asynchronous Activity Completion section of the Temporal Python SDK Developer's Guide describes how to complete Activities asynchronously. +- [Asynchronously Complete an Activity](/dev-guide/python/asynchronous-activity-completion#asynchronously-complete-an-activity) ## Versioning -The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. +The Versioning section of the Temporal Developer's Guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. - [Introduction to Versioning](/dev-guide/python/versioning#introduction-to-versioning) -- [How to use the Patching API](/dev-guide/python/versioning#python-sdk-patching-api) -- [How to use Worker Versioning](/dev-guide/python/versioning#worker-versioning) - - +- [How to Use the Patching API](/dev-guide/python/versioning#python-sdk-patching-api) +- [How to Use Worker Versioning](/dev-guide/python/versioning#worker-versioning) ## Observability -Learn about observability tools for Temporal applications, covering metrics, tracing, logging, and visibility to monitor and troubleshoot Workflows. +The Observability section of the Temporal Developer's Guide covers how to configure and use the Temporal Observability APIs. -- [Emit metrics](/dev-guide/python/observability#metrics) +- [Emit Metrics](/dev-guide/python/observability#metrics) - [Setup Tracing](/dev-guide/python/observability#tracing) - [Log from a Workflow](/dev-guide/python/observability#logging) - [Use Visibility APIs](/dev-guide/python/observability#visibility) ## Debugging -The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. +The Debugging section of the Temporal Developer's Guide covers the various ways to debug your application. - [Debugging](/dev-guide/python/debugging#debug) - ## Schedules -Discover how to effectively Schedule Workflows in Temporal Python, covering creation, management, and operations like backfilling, deleting, and triggering Scheduled Workflows for precise automation timing. +The Schedules section of the Temporal Python SDK Developer's Guide covers how to schedule Workflows, run Workflows on a Cron, and configure Workflows to run on a delay. - [Schedule a Workflow](/dev-guide/python/schedules#schedule-a-workflow) - [Temporal Cron Jobs](/dev-guide/python/schedules#temporal-cron-jobs) - [Start Delay](/dev-guide/python/schedules#start-delay) +## Data Encryption - -## Data encryption - -The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. +The Converters and Codecs section of the Temporal Developer's Guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. - [Custom Payload Codec](/dev-guide/python/data-encryption#custom-payload-codec) -- [Payload conversion](/dev-guide/python/data-encryption#payload-conversion) - +- [Payload Conversion](/dev-guide/python/data-encryption#payload-conversion) ## Child Workflows -Spawn a new Workflow from within another Workflow, with options for Parent Close Policy and handling Child Workflow Events. +The Child Workflows section of the Temporal Python SDK Developer's Guide covers how to spawn a Child Workflow Execution and handle Child Workflow Events. - [Start a Child Workflow Execution](/dev-guide/python/child-workflows) - - ## Continue-As-New -Close a Workflow Execution and create a new one with the same Workflow ID, new Run ID, and fresh Event History. +The Continue-As-New section of the Temporal Python SDK Developer's Guide covers how to create a new Workflow Execution using the same Workflow ID as an existing Workflow Execution. - [Continue-As-New](/dev-guide/python/continue-as-new) - ## Timers -Learn how to use timers within Temporal Workflows to delay execution, enabling durable and long-term scheduling of tasks that can persist even if the worker or cluster goes down. +The Timers section of the Temporal Python SDK Developer's Guide covers how to use timers and sleeps within Workflows. - [What is a Timer](/dev-guide/python/timers) - - ## Interrupt a Workflow Execution -Learn how to interrupt a workflow execution by canceling or terminating, including the differences and use cases for each method. - -- [Interrupt a Workflow Execution](/dev-guide/python/interrupt-a-workflow-execution) +The Interrupt a Workflow Execution section of the Temporal Python SDK Developer's Guide covers how to interrupt a Workflow Execution with a Cancel or Terminate action. +- [Interrupt a Workflow Execution](/dev-guide/python/interrupt-a-workflow-execution) \ No newline at end of file From ca9e7dd86083e83f4d8f57ab7d3fb8128382a8c3 Mon Sep 17 00:00:00 2001 From: rachfop Date: Tue, 21 May 2024 14:13:46 -0700 Subject: [PATCH 16/26] Update Python path --- .../asynchronous-activity-completion.mdx | 2 +- .../python/cancellation.mdx | 2 +- .../python/child-workflows.mdx | 2 +- .../python/continue-as-new.mdx | 2 +- .../python/core-application.mdx | 2 +- .../python/data-encryption.mdx | 2 +- .../python/debugging.mdx | 10 +-- .../python/durable-execution.mdx | 6 +- .../python/failure-detection.mdx | 2 +- .../python/features.mdx | 0 docs/{dev-guide => develop}/python/index.mdx | 76 +++++++++---------- .../python/interrupt-workflow.mdx | 2 +- .../python/introduction.mdx | 2 +- .../python/messages.mdx | 2 +- .../python/observability.mdx | 2 +- .../python/project-setup.mdx | 2 +- .../python/schedules.mdx | 2 +- .../python/temporal-clients.mdx | 4 +- .../python/test-suites.mdx | 2 +- docs/{dev-guide => develop}/python/timers.mdx | 2 +- .../python/versioning.mdx | 2 +- docs/encyclopedia/activities.mdx | 14 ++-- docs/encyclopedia/child-workflows.mdx | 4 +- docs/encyclopedia/retry-policies.mdx | 4 +- docs/encyclopedia/temporal-sdks.mdx | 4 +- docs/encyclopedia/visibility.mdx | 2 +- docs/encyclopedia/workers.mdx | 10 +-- docs/encyclopedia/workflows.mdx | 36 ++++----- .../development-features/core-application.mdx | 2 +- .../development-features/temporal-client.mdx | 2 +- .../throughput-composability.mdx | 2 +- .../cloud/get-started.mdx | 2 +- .../cloud/metrics/prometheus-grafana.mdx | 4 +- .../self-hosted-guide/monitoring.mdx | 2 +- docs/references/sdk-metrics.mdx | 2 +- sidebars.js | 34 ++++----- vercel.json | 14 ++-- 37 files changed, 133 insertions(+), 133 deletions(-) rename docs/{dev-guide => develop}/python/asynchronous-activity-completion.mdx (97%) rename docs/{dev-guide => develop}/python/cancellation.mdx (98%) rename docs/{dev-guide => develop}/python/child-workflows.mdx (99%) rename docs/{dev-guide => develop}/python/continue-as-new.mdx (97%) rename docs/{dev-guide => develop}/python/core-application.mdx (99%) rename docs/{dev-guide => develop}/python/data-encryption.mdx (99%) rename docs/{dev-guide => develop}/python/debugging.mdx (79%) rename docs/{dev-guide => develop}/python/durable-execution.mdx (97%) rename docs/{dev-guide => develop}/python/failure-detection.mdx (99%) rename docs/{dev-guide => develop}/python/features.mdx (100%) rename docs/{dev-guide => develop}/python/index.mdx (52%) rename docs/{dev-guide => develop}/python/interrupt-workflow.mdx (98%) rename docs/{dev-guide => develop}/python/introduction.mdx (99%) rename docs/{dev-guide => develop}/python/messages.mdx (99%) rename docs/{dev-guide => develop}/python/observability.mdx (99%) rename docs/{dev-guide => develop}/python/project-setup.mdx (99%) rename docs/{dev-guide => develop}/python/schedules.mdx (99%) rename docs/{dev-guide => develop}/python/temporal-clients.mdx (98%) rename docs/{dev-guide => develop}/python/test-suites.mdx (99%) rename docs/{dev-guide => develop}/python/timers.mdx (98%) rename docs/{dev-guide => develop}/python/versioning.mdx (99%) diff --git a/docs/dev-guide/python/asynchronous-activity-completion.mdx b/docs/develop/python/asynchronous-activity-completion.mdx similarity index 97% rename from docs/dev-guide/python/asynchronous-activity-completion.mdx rename to docs/develop/python/asynchronous-activity-completion.mdx index 70520fafe6..1b3a5148e5 100644 --- a/docs/dev-guide/python/asynchronous-activity-completion.mdx +++ b/docs/develop/python/asynchronous-activity-completion.mdx @@ -3,7 +3,7 @@ id: asynchronous-activity-completion title: Asynchronous Activity Completion sidebar_label: Asynchronous Activity Completion description: Complete an Activity without waiting for execution to finish, using Temporal Client and Activity Function. -slug: /dev-guide/python/asynchronous-activity-completion +slug: /develop/python/asynchronous-activity-completion toc_max_heading_level: 2 keywords: - asynchronous activity completion diff --git a/docs/dev-guide/python/cancellation.mdx b/docs/develop/python/cancellation.mdx similarity index 98% rename from docs/dev-guide/python/cancellation.mdx rename to docs/develop/python/cancellation.mdx index aa705ffbd6..a2e6381f58 100644 --- a/docs/dev-guide/python/cancellation.mdx +++ b/docs/develop/python/cancellation.mdx @@ -3,7 +3,7 @@ id: cancellation title: Cancellation sidebar_label: Cancellation description: Cancel an Activity from a Workflow, sending Heartbeats and setting a Heartbeat Timeout, and handling cancellation errors. -slug: /dev-guide/python/cancellation +slug: /develop/python/cancellation toc_max_heading_level: 2 keywords: - activity cancellation diff --git a/docs/dev-guide/python/child-workflows.mdx b/docs/develop/python/child-workflows.mdx similarity index 99% rename from docs/dev-guide/python/child-workflows.mdx rename to docs/develop/python/child-workflows.mdx index 49b4daf370..ee92521a0b 100644 --- a/docs/dev-guide/python/child-workflows.mdx +++ b/docs/develop/python/child-workflows.mdx @@ -3,7 +3,7 @@ id: child-workflows title: Child Workflows sidebar_label: Child Workflows description: Spawn a new Workflow from within another Workflow, with options for Parent Close Policy and handling Child Workflow Events. -slug: /dev-guide/python/child-workflows +slug: /develop/python/child-workflows toc_max_heading_level: 2 keywords: - child workflow execution diff --git a/docs/dev-guide/python/continue-as-new.mdx b/docs/develop/python/continue-as-new.mdx similarity index 97% rename from docs/dev-guide/python/continue-as-new.mdx rename to docs/develop/python/continue-as-new.mdx index 9ce1a3369a..c86564d421 100644 --- a/docs/dev-guide/python/continue-as-new.mdx +++ b/docs/develop/python/continue-as-new.mdx @@ -3,7 +3,7 @@ id: continue-as-new title: Continue-As-New sidebar_label: Continue-As-New description: Close a Workflow Execution and create a new one with the same Workflow ID, new Run ID, and fresh Event History. -slug: /dev-guide/python/continue-as-new +slug: /develop/python/continue-as-new toc_max_heading_level: 2 keywords: - continue-as-new workflow diff --git a/docs/dev-guide/python/core-application.mdx b/docs/develop/python/core-application.mdx similarity index 99% rename from docs/dev-guide/python/core-application.mdx rename to docs/develop/python/core-application.mdx index 2b005d25a0..25edd0b357 100644 --- a/docs/dev-guide/python/core-application.mdx +++ b/docs/develop/python/core-application.mdx @@ -3,7 +3,7 @@ id: core-application title: Core application sidebar_label: Core application description: Develop basic Temporal application with workflows & activities in Python using Temporal SDK. -slug: /dev-guide/python/core-application +slug: /develop/python/core-application toc_max_heading_level: 2 keywords: - temporal python core diff --git a/docs/dev-guide/python/data-encryption.mdx b/docs/develop/python/data-encryption.mdx similarity index 99% rename from docs/dev-guide/python/data-encryption.mdx rename to docs/develop/python/data-encryption.mdx index d82915828b..36c2fc5caf 100644 --- a/docs/dev-guide/python/data-encryption.mdx +++ b/docs/develop/python/data-encryption.mdx @@ -3,7 +3,7 @@ id: data-encryption title: Data encryption sidebar_label: Data encryption description: The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. -slug: /dev-guide/python/data-encryption +slug: /develop/python/data-encryption toc_max_heading_level: 2 keywords: - temporal python data encryption diff --git a/docs/dev-guide/python/debugging.mdx b/docs/develop/python/debugging.mdx similarity index 79% rename from docs/dev-guide/python/debugging.mdx rename to docs/develop/python/debugging.mdx index 89c7355c60..f23d88d82e 100644 --- a/docs/dev-guide/python/debugging.mdx +++ b/docs/develop/python/debugging.mdx @@ -3,7 +3,7 @@ id: debugging title: Debugging sidebar_label: Debugging description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. -slug: /dev-guide/python/debugging +slug: /develop/python/debugging toc_max_heading_level: 2 keywords: - debugging temporal python @@ -33,11 +33,11 @@ You can debug production Workflows using: - [Web UI](/web-ui) - [Temporal CLI](/cli) -- [Replay](/dev-guide/python/test-suites#replay) -- [Tracing](/dev-guide/python/observability#tracing) -- [Logging](/dev-guide/python/observability#logging) +- [Replay](/develop/python/test-suites#replay) +- [Tracing](/develop/python/observability#tracing) +- [Logging](/develop/python/observability#logging) You can debug and tune Worker performance with metrics and the [Worker performance guide](/dev-guide/worker-performance). -For more information, see [Observability ▶️ Metrics](/dev-guide/python/observability#metrics) for setting up SDK metrics. +For more information, see [Observability ▶️ Metrics](/develop/python/observability#metrics) for setting up SDK metrics. Debug Server performance with [Cloud metrics](/cloud/metrics/) or [self-hosted Server metrics](/self-hosted-guide/production-checklist#scaling-and-metrics). diff --git a/docs/dev-guide/python/durable-execution.mdx b/docs/develop/python/durable-execution.mdx similarity index 97% rename from docs/dev-guide/python/durable-execution.mdx rename to docs/develop/python/durable-execution.mdx index fe4cc39242..c9817669de 100644 --- a/docs/dev-guide/python/durable-execution.mdx +++ b/docs/develop/python/durable-execution.mdx @@ -3,7 +3,7 @@ id: durable-execution title: Develop code that durably executes - Python SDK dev guide sidebar_label: Develop for durability description: The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. -slug: /dev-guide/python/durable-execution +slug: /develop/python/durable-execution toc_max_heading_level: 4 keywords: - determinism @@ -62,7 +62,7 @@ The information in this chapter is also available in the [Temporal 102 course](h ::: -This chapter builds on the [Construct a new Temporal Application project](/dev-guide/python/project-setup) chapter and relies on the Background Check use case and sample applications as a means to contextualize the information. +This chapter builds on the [Construct a new Temporal Application project](/develop/python/project-setup) chapter and relies on the Background Check use case and sample applications as a means to contextualize the information. This chapter walks through the following sequence: @@ -360,7 +360,7 @@ You should expect to see the `TestReplayWorkflowHistoryFromFile` test fail. This is because the code we added creates new Events and alters the Event History sequence. To get this test to pass, we must get an updated Event History JSON file. -[Start a new Workflow](/dev-guide/python/project-setup#start-workflow) and after it is complete [download the Event History as a JSON object](#retrieve-event-history). +[Start a new Workflow](/develop/python/project-setup#start-workflow) and after it is complete [download the Event History as a JSON object](#retrieve-event-history). :::info Double check Task Queue names diff --git a/docs/dev-guide/python/failure-detection.mdx b/docs/develop/python/failure-detection.mdx similarity index 99% rename from docs/dev-guide/python/failure-detection.mdx rename to docs/develop/python/failure-detection.mdx index c6e176c774..6cf009093b 100644 --- a/docs/dev-guide/python/failure-detection.mdx +++ b/docs/develop/python/failure-detection.mdx @@ -3,7 +3,7 @@ id: failure-detection title: Failure detection sidebar_label: Failure detection Description: Guidance on setting timeouts, retries, and heartbeat functionality for Workflows and Activities in Python with Temporal. -slug: /dev-guide/python/failure-detection +slug: /develop/python/failure-detection toc_max_heading_level: 2 keywords: - workflow timeouts diff --git a/docs/dev-guide/python/features.mdx b/docs/develop/python/features.mdx similarity index 100% rename from docs/dev-guide/python/features.mdx rename to docs/develop/python/features.mdx diff --git a/docs/dev-guide/python/index.mdx b/docs/develop/python/index.mdx similarity index 52% rename from docs/dev-guide/python/index.mdx rename to docs/develop/python/index.mdx index 30774088a0..6a88883d2b 100644 --- a/docs/dev-guide/python/index.mdx +++ b/docs/develop/python/index.mdx @@ -20,116 +20,116 @@ This guide provides a comprehensive overview of the structures, primitives, and The Core Application section of the Temporal Python SDK Developer's Guide covers the essential concepts and implementation details needed to build and run a Temporal Application. -- [Develop a Basic Workflow](/dev-guide/python/core-application#develop-workflows) -- [Develop a Basic Activity](/dev-guide/python/core-application#develop-activities) -- [Start an Activity Execution](/dev-guide/python/core-application#activity-execution) -- [Run Worker Processes](/dev-guide/python/core-application#run-a-dev-worker) +- [Develop a Basic Workflow](/develop/python/core-application#develop-workflows) +- [Develop a Basic Activity](/develop/python/core-application#develop-activities) +- [Start an Activity Execution](/develop/python/core-application#activity-execution) +- [Run Worker Processes](/develop/python/core-application#run-a-dev-worker) ## Temporal Client The Temporal Client section of the Temporal Python SDK Developer's Guide describes how to use the Temporal Client to connect and start a Workflow Execution. -- [Connect to Development Temporal Service](/dev-guide/python/temporal-clients#connect-to-development-service) -- [Connect a Temporal Client to a Temporal Cluster](/dev-guide/python/temporal-clients#connect-to-a-dev-cluster) -- [Connect to Temporal Cloud](/dev-guide/python/temporal-clients#connect-to-temporal-cloud) -- [Start a Workflow Execution](/dev-guide/python/temporal-clients#start-workflow-execution) +- [Connect to Development Temporal Service](/develop/python/temporal-clients#connect-to-development-service) +- [Connect a Temporal Client to a Temporal Cluster](/develop/python/temporal-clients#connect-to-a-dev-cluster) +- [Connect to Temporal Cloud](/develop/python/temporal-clients#connect-to-temporal-cloud) +- [Start a Workflow Execution](/develop/python/temporal-clients#start-workflow-execution) ## Test Suites The Testing section of the Temporal Python SDK Developer's Guide describes how to test your Temporal Application. -- [Test Frameworks](/dev-guide/python/test-suites#test-frameworks) -- [Testing Activities](/dev-guide/python/test-suites#test-activities) -- [Testing Workflows](/dev-guide/python/test-suites#test-workflows) -- [How to Replay a Workflow Execution](/dev-guide/python/test-suites#replay) +- [Test Frameworks](/develop/python/test-suites#test-frameworks) +- [Testing Activities](/develop/python/test-suites#test-activities) +- [Testing Workflows](/develop/python/test-suites#test-workflows) +- [How to Replay a Workflow Execution](/develop/python/test-suites#replay) ## Failure Detection The Failure Detection section of the Temporal Python SDK Developer's Guide describes how to configure timeouts and heartbeat intervals for Activities and Workflows. -- [Workflow Timeouts](/dev-guide/python/failure-detection#workflow-timeouts) -- [Set Activity Timeouts](/dev-guide/python/failure-detection#activity-timeouts) -- [Heartbeat an Activity](/dev-guide/python/failure-detection#activity-heartbeats) +- [Workflow Timeouts](/develop/python/failure-detection#workflow-timeouts) +- [Set Activity Timeouts](/develop/python/failure-detection#activity-timeouts) +- [Heartbeat an Activity](/develop/python/failure-detection#activity-heartbeats) ## Messages The Messages section of the Temporal Python SDK Developer's Guide describes how to use the Temporal Client to send messages to a Workflow Execution. -- [Develop with Signals](/dev-guide/python/messages#signals) -- [Develop with Queries](/dev-guide/python/messages#queries) -- [Develop with Updates](/dev-guide/python/messages#updates) -- [What is a Dynamic Handler](/dev-guide/python/messages#dynamic-handler) +- [Develop with Signals](/develop/python/messages#signals) +- [Develop with Queries](/develop/python/messages#queries) +- [Develop with Updates](/develop/python/messages#updates) +- [What is a Dynamic Handler](/develop/python/messages#dynamic-handler) ## Cancellation The Cancellation section of the Temporal Python SDK Developer's Guide describes how to cancel a Workflow Execution. -- [Cancel an Activity from a Workflow](/dev-guide/python/cancellation#cancel-an-activity) +- [Cancel an Activity from a Workflow](/develop/python/cancellation#cancel-an-activity) ## Asynchronous Activity Completion The Asynchronous Activity Completion section of the Temporal Python SDK Developer's Guide describes how to complete Activities asynchronously. -- [Asynchronously Complete an Activity](/dev-guide/python/asynchronous-activity-completion#asynchronously-complete-an-activity) +- [Asynchronously Complete an Activity](/develop/python/asynchronous-activity-completion#asynchronously-complete-an-activity) ## Versioning The Versioning section of the Temporal Developer's Guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. -- [Introduction to Versioning](/dev-guide/python/versioning#introduction-to-versioning) -- [How to Use the Patching API](/dev-guide/python/versioning#python-sdk-patching-api) -- [How to Use Worker Versioning](/dev-guide/python/versioning#worker-versioning) +- [Introduction to Versioning](/develop/python/versioning#introduction-to-versioning) +- [How to Use the Patching API](/develop/python/versioning#python-sdk-patching-api) +- [How to Use Worker Versioning](/develop/python/versioning#worker-versioning) ## Observability The Observability section of the Temporal Developer's Guide covers how to configure and use the Temporal Observability APIs. -- [Emit Metrics](/dev-guide/python/observability#metrics) -- [Setup Tracing](/dev-guide/python/observability#tracing) -- [Log from a Workflow](/dev-guide/python/observability#logging) -- [Use Visibility APIs](/dev-guide/python/observability#visibility) +- [Emit Metrics](/develop/python/observability#metrics) +- [Setup Tracing](/develop/python/observability#tracing) +- [Log from a Workflow](/develop/python/observability#logging) +- [Use Visibility APIs](/develop/python/observability#visibility) ## Debugging The Debugging section of the Temporal Developer's Guide covers the various ways to debug your application. -- [Debugging](/dev-guide/python/debugging#debug) +- [Debugging](/develop/python/debugging#debug) ## Schedules The Schedules section of the Temporal Python SDK Developer's Guide covers how to schedule Workflows, run Workflows on a Cron, and configure Workflows to run on a delay. -- [Schedule a Workflow](/dev-guide/python/schedules#schedule-a-workflow) -- [Temporal Cron Jobs](/dev-guide/python/schedules#temporal-cron-jobs) -- [Start Delay](/dev-guide/python/schedules#start-delay) +- [Schedule a Workflow](/develop/python/schedules#schedule-a-workflow) +- [Temporal Cron Jobs](/develop/python/schedules#temporal-cron-jobs) +- [Start Delay](/develop/python/schedules#start-delay) ## Data Encryption The Converters and Codecs section of the Temporal Developer's Guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. -- [Custom Payload Codec](/dev-guide/python/data-encryption#custom-payload-codec) -- [Payload Conversion](/dev-guide/python/data-encryption#payload-conversion) +- [Custom Payload Codec](/develop/python/data-encryption#custom-payload-codec) +- [Payload Conversion](/develop/python/data-encryption#payload-conversion) ## Child Workflows The Child Workflows section of the Temporal Python SDK Developer's Guide covers how to spawn a Child Workflow Execution and handle Child Workflow Events. -- [Start a Child Workflow Execution](/dev-guide/python/child-workflows) +- [Start a Child Workflow Execution](/develop/python/child-workflows) ## Continue-As-New The Continue-As-New section of the Temporal Python SDK Developer's Guide covers how to create a new Workflow Execution using the same Workflow ID as an existing Workflow Execution. -- [Continue-As-New](/dev-guide/python/continue-as-new) +- [Continue-As-New](/develop/python/continue-as-new) ## Timers The Timers section of the Temporal Python SDK Developer's Guide covers how to use timers and sleeps within Workflows. -- [What is a Timer](/dev-guide/python/timers) +- [What is a Timer](/develop/python/timers) ## Interrupt a Workflow Execution The Interrupt a Workflow Execution section of the Temporal Python SDK Developer's Guide covers how to interrupt a Workflow Execution with a Cancel or Terminate action. -- [Interrupt a Workflow Execution](/dev-guide/python/interrupt-a-workflow-execution) \ No newline at end of file +- [Interrupt a Workflow Execution](/develop/python/interrupt-a-workflow-execution) \ No newline at end of file diff --git a/docs/dev-guide/python/interrupt-workflow.mdx b/docs/develop/python/interrupt-workflow.mdx similarity index 98% rename from docs/dev-guide/python/interrupt-workflow.mdx rename to docs/develop/python/interrupt-workflow.mdx index 5014c4a604..17e1b6928a 100644 --- a/docs/dev-guide/python/interrupt-workflow.mdx +++ b/docs/develop/python/interrupt-workflow.mdx @@ -3,7 +3,7 @@ id: interrupt-a-workflow-execution title: Interrupt a Workflow Execution sidebar_label: Interrupt a Workflow Execution description: Learn how to interrupt a Workflow Execution by canceling or terminating, including the differences and use cases for each method. -slug: /dev-guide/python/interrupt-a-workflow-execution +slug: /develop/python/interrupt-a-workflow-execution toc_max_heading_level: 2 keywords: - cancel workflow execution diff --git a/docs/dev-guide/python/introduction.mdx b/docs/develop/python/introduction.mdx similarity index 99% rename from docs/dev-guide/python/introduction.mdx rename to docs/develop/python/introduction.mdx index 15fde7d8fc..b5225cc895 100644 --- a/docs/dev-guide/python/introduction.mdx +++ b/docs/develop/python/introduction.mdx @@ -3,7 +3,7 @@ id: introduction title: Introduction to the Temporal Python SDK sidebar_label: Introduction description: Learn more about Temporal Python SDK. -slug: /dev-guide/python/introduction +slug: /develop/python/introduction toc_max_heading_level: 4 keywords: - guide-context diff --git a/docs/dev-guide/python/messages.mdx b/docs/develop/python/messages.mdx similarity index 99% rename from docs/dev-guide/python/messages.mdx rename to docs/develop/python/messages.mdx index 06a9400885..cf127241ae 100644 --- a/docs/dev-guide/python/messages.mdx +++ b/docs/develop/python/messages.mdx @@ -3,7 +3,7 @@ id: messages title: Messages sidebar_label: Messages description: Explore using Signals in Temporal Python to send messages to Workflows, with details on defining, sending, and handling Signals, including customization options. -slug: /dev-guide/python/messages +slug: /develop/python/messages toc_max_heading_level: 2 keywords: - temporal python signals diff --git a/docs/dev-guide/python/observability.mdx b/docs/develop/python/observability.mdx similarity index 99% rename from docs/dev-guide/python/observability.mdx rename to docs/develop/python/observability.mdx index 3bd4d7c843..f668f89f3b 100644 --- a/docs/dev-guide/python/observability.mdx +++ b/docs/develop/python/observability.mdx @@ -3,7 +3,7 @@ id: observability title: Observability sidebar_label: Observability description: Learn about observability tools for Temporal applications, covering metrics, tracing, logging, and visibility to monitor and troubleshoot Workflows. -slug: /dev-guide/python/observability +slug: /develop/python/observability toc_max_heading_level: 2 keywords: - client diff --git a/docs/dev-guide/python/project-setup.mdx b/docs/develop/python/project-setup.mdx similarity index 99% rename from docs/dev-guide/python/project-setup.mdx rename to docs/develop/python/project-setup.mdx index a5bd24a635..4282686cef 100644 --- a/docs/dev-guide/python/project-setup.mdx +++ b/docs/develop/python/project-setup.mdx @@ -3,7 +3,7 @@ id: project-setup title: Set up a Temporal Application project - Python SDK dev guide sidebar_label: Project setup description: The project setup section of the Temporal Python SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in Python—that is, all the relevant steps to start a Workflow Execution that executes an Activity. -slug: /dev-guide/python/project-setup +slug: /develop/python/project-setup toc_max_heading_level: 4 keywords: - activity diff --git a/docs/dev-guide/python/schedules.mdx b/docs/develop/python/schedules.mdx similarity index 99% rename from docs/dev-guide/python/schedules.mdx rename to docs/develop/python/schedules.mdx index efb474d56e..e8dbd80468 100644 --- a/docs/dev-guide/python/schedules.mdx +++ b/docs/develop/python/schedules.mdx @@ -3,7 +3,7 @@ id: schedules title: Schedules sidebar_label: Schedules description: Discover how to effectively Schedule Workflows in Temporal Python, covering creation, management, and operations like backfilling, deleting, and triggering Scheduled Workflows for precise automation timing. -slug: /dev-guide/python/schedules +slug: /develop/python/schedules toc_max_heading_level: 2 keywords: - temporal python schedule workflow diff --git a/docs/dev-guide/python/temporal-clients.mdx b/docs/develop/python/temporal-clients.mdx similarity index 98% rename from docs/dev-guide/python/temporal-clients.mdx rename to docs/develop/python/temporal-clients.mdx index a4f2cecf10..8e037455a5 100644 --- a/docs/dev-guide/python/temporal-clients.mdx +++ b/docs/develop/python/temporal-clients.mdx @@ -196,9 +196,9 @@ async def main(): [Workflow Execution](/workflows#workflow-execution) semantics rely on several parameters—that is, to start a Workflow Execution you must supply a Task Queue that will be used for the Tasks (one that a Worker is polling), the Workflow Type, language-specific contextual data, and Workflow Function parameters. In the examples below, all Workflow Executions are started using a Temporal Client. -To spawn Workflow Executions from within another Workflow Execution, use either the [Child Workflow](/dev-guide/python/child-workflows) or External Workflow APIs. +To spawn Workflow Executions from within another Workflow Execution, use either the [Child Workflow](/develop/python/child-workflows) or External Workflow APIs. -See the [Customize Workflow Type](/dev-guide/python/core-application#workflow-type) section to see how to customize the name of the Workflow Type. +See the [Customize Workflow Type](/develop/python/core-application#workflow-type) section to see how to customize the name of the Workflow Type. A request to spawn a Workflow Execution causes the Temporal Cluster to create the first Event ([WorkflowExecutionStarted](/references/events#workflowexecutionstarted)) in the Workflow Execution Event History. The Temporal Cluster then creates the first Workflow Task, resulting in the first [WorkflowTaskScheduled](/references/events#workflowtaskscheduled) Event. diff --git a/docs/dev-guide/python/test-suites.mdx b/docs/develop/python/test-suites.mdx similarity index 99% rename from docs/dev-guide/python/test-suites.mdx rename to docs/develop/python/test-suites.mdx index 0440601901..9597671b61 100644 --- a/docs/dev-guide/python/test-suites.mdx +++ b/docs/develop/python/test-suites.mdx @@ -3,7 +3,7 @@ id: test-suites title: Test suites sidebar_label: Test suites description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. -slug: /dev-guide/python/test-suites +slug: /develop/python/test-suites toc_max_heading_level: 2 keywords: - developer-guide diff --git a/docs/dev-guide/python/timers.mdx b/docs/develop/python/timers.mdx similarity index 98% rename from docs/dev-guide/python/timers.mdx rename to docs/develop/python/timers.mdx index 8e7b8d3e5a..dbc18788ed 100644 --- a/docs/dev-guide/python/timers.mdx +++ b/docs/develop/python/timers.mdx @@ -3,7 +3,7 @@ id: timers title: Timers sidebar_label: Timers description: Learn how to use timers within Temporal Workflows to delay execution, enabling durable and long-term scheduling of tasks that can persist even if the worker or cluster goes down. -slug: /dev-guide/python/timers +slug: /develop/python/timers toc_max_heading_level: 2 keywords: - temporal workflow timers diff --git a/docs/dev-guide/python/versioning.mdx b/docs/develop/python/versioning.mdx similarity index 99% rename from docs/dev-guide/python/versioning.mdx rename to docs/develop/python/versioning.mdx index d0503d4af4..5079f742c2 100644 --- a/docs/dev-guide/python/versioning.mdx +++ b/docs/develop/python/versioning.mdx @@ -3,7 +3,7 @@ id: versioning title: Versioning sidebar_label: Versioning description: The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. -slug: /dev-guide/python/versioning +slug: /develop/python/versioning toc_max_heading_level: 2 keywords: - best practices diff --git a/docs/encyclopedia/activities.mdx b/docs/encyclopedia/activities.mdx index 311ab54afe..0dd9280c82 100644 --- a/docs/encyclopedia/activities.mdx +++ b/docs/encyclopedia/activities.mdx @@ -39,7 +39,7 @@ An Activity Definition is the code that defines the constraints of an [Activity - [How to develop an Activity Definition using the Go SDK](/dev-guide/go/foundations#activity-definition) - [How to develop an Activity Definition using the Java SDK](/dev-guide/java/foundations#develop-activities) - [How to develop an Activity Definition using the PHP SDK](/dev-guide/php/foundations#develop-activities) -- [How to develop an Activity Definition using the Python SDK](/dev-guide/python/core-application#develop-activities) +- [How to develop an Activity Definition using the Python SDK](/develop/python/core-application#develop-activities) - [How to develop an Activity Definition using the TypeScript SDK](/dev-guide/typescript/foundations#develop-activities) The term 'Activity Definition' is used to refer to the full set of primitives in any given language SDK that provides an access point to an Activity Function Definition——the method or function that is invoked for an [Activity Task Execution](/workers#activity-task-execution). @@ -123,7 +123,7 @@ An Activity Execution is the full chain of [Activity Task Executions](/workers#a - [How to start an Activity Execution using the Go SDK](/dev-guide/go/foundations#activity-execution) - [How to start an Activity Execution using the Java SDK](/dev-guide/java/foundations#activity-execution) - [How to start an Activity Execution using the PHP SDK](/dev-guide/php/foundations#activity-execution) -- [How to start an Activity Execution using the Python SDK](/dev-guide/python/core-application#activity-execution) +- [How to start an Activity Execution using the Python SDK](/develop/python/core-application#activity-execution) - [How to start an Activity Execution using the TypeScript SDK](/dev-guide/typescript/foundations#activity-execution)
@@ -206,7 +206,7 @@ In other words, it's a limit for how long an Activity Task can be enqueued. - [How to set a Schedule-To-Start Timeout using the Go SDK](/dev-guide/go/features#activity-timeouts) - [How to set a Schedule-To-Start Timeout using the Java SDK](/dev-guide/java/features#activity-timeouts) - [How to set a Schedule-To-Start Timeout using the PHP SDK](/dev-guide/php/features#activity-timeouts) -- [How to set a Schedule-To-Start Timeout using the Python SDK](/dev-guide/python/failure-detection#activity-timeouts) +- [How to set a Schedule-To-Start Timeout using the Python SDK](/develop/python/failure-detection#activity-timeouts) - [How to set a Schedule-To-Start Timeout using the TypeScript SDK](/dev-guide/typescript/features#activity-timeouts) The moment that the Task is picked by the Worker from the Task Queue is considered to be the start of the Activity Task for the purposes of the Schedule-To-Start Timeout and associated metrics. @@ -266,7 +266,7 @@ A Start-To-Close Timeout is the maximum time allowed for a single [Activity Task - [How to set a Start-To-Close Timeout using the Go SDK](/dev-guide/go/features#activity-timeouts) - [How to set a Start-To-Close Timeout using the Java SDK](/dev-guide/java/features#activity-timeouts) - [How to set a Start-To-Close Timeout using the PHP SDK](/dev-guide/php/features#activity-timeouts) -- [How to set a Start-To-Close Timeout using the Python SDK](/dev-guide/python/failure-detection#activity-timeouts) +- [How to set a Start-To-Close Timeout using the Python SDK](/develop/python/failure-detection#activity-timeouts) - [How to set a Start-To-Close Timeout using the TypeScript SDK](/dev-guide/typescript/features#activity-timeouts) **The default Start-To-Close Timeout is the same as the default [Schedule-To-Close Timeout](#schedule-to-close-timeout).** @@ -384,7 +384,7 @@ Each ping informs the Temporal Service that the Activity Execution is making pro - [How to Heartbeat an Activity using the Go SDK](/dev-guide/go/features#activity-heartbeats) - [How to Heartbeat an Activity using the Java SDK](/dev-guide/java/features#activity-heartbeats) - [How to Heartbeat an Activity using the PHP SDK](/dev-guide/php/features#activity-heartbeats) -- [How to Heartbeat an Activity using the Python SDK](/dev-guide/python/failure-detection#activity-heartbeats) +- [How to Heartbeat an Activity using the Python SDK](/develop/python/failure-detection#activity-heartbeats) - [How to Heartbeat an Activity using the TypeScript SDK](/dev-guide/typescript/features#activity-heartbeats) Activity Heartbeats work in conjunction with a [Heartbeat Timeout](#heartbeat-timeout). @@ -457,7 +457,7 @@ A Heartbeat Timeout is the maximum time between [Activity Heartbeats](#activity- - [How to set a Heartbeat Timeout using the Go SDK](/dev-guide/go/features#heartbeat-timeout) - [How to set a Heartbeat Timeout using the Java SDK](/dev-guide/java/features#heartbeat-timeout) - [How to set a Heartbeat Timeout using the PHP SDK](/dev-guide/php/features#heartbeat-timeout) -- [How to set a Heartbeat Timeout using the Python SDK](/dev-guide/python/failure-detection#heartbeat-timeout) +- [How to set a Heartbeat Timeout using the Python SDK](/develop/python/failure-detection#heartbeat-timeout) - [How to set a Heartbeat Timeout using the TypeScript SDK](/dev-guide/typescript/features#heartbeat-timeout)
@@ -485,7 +485,7 @@ How to complete an Activity Asynchronously in: - [Go](/dev-guide/go/features#asynchronous-activity-completion) - [Java](/dev-guide/java/features#asynchronous-activity-completion) - [PHP](/dev-guide/php/features#asynchronous-activity-completion) -- [Python](/dev-guide/python/asynchronous-activity-completion#asynchronously-complete-an-activity) +- [Python](/develop/python/asynchronous-activity-completion#asynchronously-complete-an-activity) - [TypeScript](/dev-guide/typescript/features#asynchronous-activity-completion) #### When to use Async Completion diff --git a/docs/encyclopedia/child-workflows.mdx b/docs/encyclopedia/child-workflows.mdx index aefe035bf9..02622018b8 100644 --- a/docs/encyclopedia/child-workflows.mdx +++ b/docs/encyclopedia/child-workflows.mdx @@ -31,7 +31,7 @@ A Child Workflow Execution is a [Workflow Execution](/workflows#workflow-executi - [Go SDK Child Workflow feature guide](/dev-guide/go/features#child-workflows) - [Java SDK Child Workflow feature guide](/dev-guide/java/features#child-workflows) - [PHP SDK Child Workflow feature guide](/dev-guide/php/features#child-workflows) -- [Python SDK Child Workflow feature guide](//dev-guide/python/child-workflows) +- [Python SDK Child Workflow feature guide](//develop/python/child-workflows) - [TypeScript SDK Child Workflow feature guide](/dev-guide/typescript/features#child-workflows) A Workflow Execution can be both a Parent and a Child Workflow Execution because any Workflow can spawn another Workflow. @@ -149,7 +149,7 @@ A Parent Close Policy determines what happens to a Child Workflow Execution if i - [How to set a Parent Close Policy using the Go SDK](/dev-guide/go/features#parent-close-policy) - [How to set a Parent Close Policy using the Java SDK](/dev-guide/java/features#parent-close-policy) - [How to set a Parent Close Policy using the PHP SDK](/dev-guide/php/features#parent-close-policy) -- [How to set a Parent Close Policy using the Python SDK](/dev-guide/python/child-workflows#parent-close-policy) +- [How to set a Parent Close Policy using the Python SDK](/develop/python/child-workflows#parent-close-policy) - [How to set a Parent Close Policy using the TypeScript SDK](/dev-guide/typescript/features#parent-close-policy) There are three possible values: diff --git a/docs/encyclopedia/retry-policies.mdx b/docs/encyclopedia/retry-policies.mdx index 75c68779cf..3bef7284f2 100644 --- a/docs/encyclopedia/retry-policies.mdx +++ b/docs/encyclopedia/retry-policies.mdx @@ -25,7 +25,7 @@ A Retry Policy is a collection of attributes that instructs the Temporal Server - [How to set a custom Retry Policy for an Activity in Go](/dev-guide/go/features#activity-retries) - [How to set a custom Retry Policy for an Activity in Java](/dev-guide/java/features#activity-retries) - [How to set a custom Retry Policy for an Activity in PHP](/dev-guide/php/features#activity-retries) -- [How to set a custom Retry Policy for an Activity in Python](/dev-guide/python/failure-detection#activity-retries) +- [How to set a custom Retry Policy for an Activity in Python](/develop/python/failure-detection#activity-retries) - [How to set a custom Retry Policy for an Activity in TypeScript](/dev-guide/typescript/features#activity-retries) --- @@ -33,7 +33,7 @@ A Retry Policy is a collection of attributes that instructs the Temporal Server - [How to set a Retry Policy for a Workflow in Go](/dev-guide/go/features#workflow-retries) - [How to set a Retry Policy for a Workflow in Java](/dev-guide/java/features#workflow-retries) - [How to set a Retry Policy for a Workflow in PHP](/dev-guide/php/features#workflow-retries) -- [How to set a Retry Policy for a Workflow in Python](/dev-guide/python/failure-detection#workflow-retries) +- [How to set a Retry Policy for a Workflow in Python](/develop/python/failure-detection#workflow-retries) - [How to set a Retry Policy for a Workflow in TypeScript](/dev-guide/typescript/features#workflow-retries)
diff --git a/docs/encyclopedia/temporal-sdks.mdx b/docs/encyclopedia/temporal-sdks.mdx index f87fda7679..5370808d41 100644 --- a/docs/encyclopedia/temporal-sdks.mdx +++ b/docs/encyclopedia/temporal-sdks.mdx @@ -59,7 +59,7 @@ Each Temporal SDK targets a specific programming language. - [Go SDK developer's guide](/dev-guide/go/introduction) - [Java SDK developer's guide](/dev-guide/java/introduction) - [PHP SDK developer's guide](/dev-guide/php) -- [Python SDK developer's guide](/dev-guide/python/introduction) +- [Python SDK developer's guide](/develop/python/introduction) - [TypeScript SDK developer's guide](/dev-guide/typescript/introduction) - [.NET SDK API reference](https://dotnet.temporal.io/) @@ -208,7 +208,7 @@ For tested code samples and best practices, use your preferred language SDK's de - [Go SDK Temporal Client feature guide](/develop/go/temporal-client) - [Java SDK Temporal Client feature guide](/develop/java/temporal-client) - [PHP SDK Temporal Client feature guide](/dev-guide/php/foundations#connect-to-a-dev-cluster) -- [Python SDK Temporal Client feature guide](/dev-guide/python/temporal-clients#connect-to-a-dev-cluster) +- [Python SDK Temporal Client feature guide](/develop/python/temporal-clients#connect-to-a-dev-cluster) - [TypeScript SDK Temporal Client feature guide](/dev-guide/typescript/foundations#connect-to-a-dev-cluster) ::: diff --git a/docs/encyclopedia/visibility.mdx b/docs/encyclopedia/visibility.mdx index 6513988021..4b36fc523d 100644 --- a/docs/encyclopedia/visibility.mdx +++ b/docs/encyclopedia/visibility.mdx @@ -411,7 +411,7 @@ With Workflows you can do the following: - [How to manage Search Attributes using the Go SDK](/dev-guide/go/observability#visibility) - [How to manage Search Attributes using the Java SDK](/dev-guide/java/observability#visibility) - [How to manage Search Attributes using the PHP SDK](/dev-guide/php/observability#visibility) -- [How to manage Search Attributes using the Python SDK](/dev-guide/python/observability#visibility) +- [How to manage Search Attributes using the Python SDK](/develop/python/observability#visibility) - [How to manage Search Attributes using the TypeScript SDK](/dev-guide/typescript/observability#visibility) - To get a list of Search Attributes using the Temporal CLI, issue `temporal operator search-attribute list`. See [Search Attributes](/visibility#search-attribute). diff --git a/docs/encyclopedia/workers.mdx b/docs/encyclopedia/workers.mdx index 9a668d71d0..4181bb6703 100644 --- a/docs/encyclopedia/workers.mdx +++ b/docs/encyclopedia/workers.mdx @@ -38,7 +38,7 @@ A Worker Program is the static code that defines the constraints of the Worker P - [How to run a development Worker using the Go SDK](/dev-guide/go/foundations#develop-worker) - [How to run a development Worker using the Java SDK](/dev-guide/java/foundations#run-a-dev-worker) - [How to run a development Worker using the PHP SDK](/dev-guide/php/foundations#run-a-dev-worker) -- [How to run a development Worker using the Python SDK](/dev-guide/python/core-application#run-a-dev-worker) +- [How to run a development Worker using the Python SDK](/develop/python/core-application#run-a-dev-worker) - [How to run a development Worker using the TypeScript SDK](/dev-guide/typescript/foundations#run-a-dev-worker) - [How to run a Temporal Cloud Worker using the Go SDK](/dev-guide/go/foundations#run-a-temporal-cloud-worker) @@ -237,7 +237,7 @@ There are four places where the name of the Task Queue can be set by the develop - [How to start a Workflow Execution using the Go SDK](/develop/go/temporal-client#start-workflow-execution) - [How to start a Workflow Execution using the Java SDK](/develop/java/temporal-client#start-workflow-execution) - [How to start a Workflow Execution using the PHP SDK](/dev-guide/php/foundations#start-workflow-execution) -- [How to start a Workflow Execution using the Python SDK](/dev-guide/python/temporal-clients#start-workflow-execution) +- [How to start a Workflow Execution using the Python SDK](/develop/python/temporal-clients#start-workflow-execution) - [How to start a Workflow Execution using the TypeScript SDK](/dev-guide/typescript/foundations#start-workflow-execution) 2. A Task Queue name must be set when creating a Worker Entity and when running a Worker Process: @@ -245,7 +245,7 @@ There are four places where the name of the Task Queue can be set by the develop - [How to run a development Worker using the Go SDK](/dev-guide/go/foundations#develop-worker) - [How to run a development Worker using the Java SDK](/dev-guide/java/foundations#run-a-dev-worker) - [How to run a development Worker using the PHP SDK](/dev-guide/php/foundations#run-a-dev-worker) -- [How to run a development Worker using the Python SDK](/dev-guide/python/core-application#run-a-dev-worker) +- [How to run a development Worker using the Python SDK](/develop/python/core-application#run-a-dev-worker) - [How to run a development Worker using the TypeScript SDK](/dev-guide/typescript/foundations#run-a-dev-worker) - [How to run a Temporal Cloud Worker using the Go SDK](/dev-guide/go/foundations#run-a-temporal-cloud-worker) @@ -264,7 +264,7 @@ An Activity Execution inherits the Task Queue name from its Workflow Execution i - [How to start an Activity Execution using the Go SDK](/dev-guide/go/foundations#activity-execution) - [How to start an Activity Execution using the Java SDK](/dev-guide/java/foundations#activity-execution) - [How to start an Activity Execution using the PHP SDK](/dev-guide/php/foundations#activity-execution) -- [How to start an Activity Execution using the Python SDK](/dev-guide/python/core-application#activity-execution) +- [How to start an Activity Execution using the Python SDK](/develop/python/core-application#activity-execution) - [How to start an Activity Execution using the TypeScript SDK](/dev-guide/typescript/foundations#activity-execution) 4. A Task Queue name can be provided when spawning a Child Workflow Execution: @@ -275,7 +275,7 @@ A Child Workflow Execution inherits the Task Queue name from its Parent Workflow - [How to start a Child Workflow Execution using the Go SDK](/dev-guide/go/features#child-workflows) - [How to start a Child Workflow Execution using the Java SDK](/dev-guide/java/features#child-workflows) - [How to start a Child Workflow Execution using the PHP SDK](/dev-guide/php/features#child-workflows) -- [How to start a Child Workflow Execution using the Python SDK](//dev-guide/python/child-workflows) +- [How to start a Child Workflow Execution using the Python SDK](//develop/python/child-workflows) - [How to start a Child Workflow Execution using the TypeScript SDK](/dev-guide/typescript/features#child-workflows) #### Task ordering diff --git a/docs/encyclopedia/workflows.mdx b/docs/encyclopedia/workflows.mdx index cc2fb55f98..6f45ab72ad 100644 --- a/docs/encyclopedia/workflows.mdx +++ b/docs/encyclopedia/workflows.mdx @@ -109,7 +109,7 @@ class YourBasicWorkflowImpl implements YourBasicWorkflow { -**[Workflow Definition in Python](/dev-guide/python/core-application#develop-workflows)** +**[Workflow Definition in Python](/develop/python/core-application#develop-workflows)** ```Python @workflow.defn @@ -259,7 +259,7 @@ This feature is useful for Workflow Definition logic that needs to be updated bu - [How to patch Workflow code in Go](/dev-guide/go/versioning#patching) - [How to patch Workflow code in Java](/dev-guide/java/versioning#patching) -- [How to patch Workflow code in Python](/dev-guide/python/versioning#python-sdk-patching-api) +- [How to patch Workflow code in Python](/develop/python/versioning#python-sdk-patching-api) - [How to patch Workflow code in TypeScript](/dev-guide/typescript/versioning#patching) #### Worker Build Ids @@ -268,7 +268,7 @@ Temporal [Worker Build Id-based versioning](/workers#worker-versioning) lets you - [How to version Workers in Go](/dev-guide/go/versioning#worker-versioning) - [How to version Workers in Java](/dev-guide/java/versioning#worker-versioning) -- [How to version Workers in Python](/dev-guide/python/versioning#worker-versioning) +- [How to version Workers in Python](/develop/python/versioning#worker-versioning) - [How to version Workers in TypeScript](/dev-guide/typescript/versioning#worker-versioning) ### Handling unreliable Worker Processes @@ -313,7 +313,7 @@ It is the main unit of execution of a [Temporal Application](/temporal#temporal- - [How to start a Workflow Execution using the Go SDK](/develop/go/temporal-client#start-workflow-execution) - [How to start a Workflow Execution using the Java SDK](/develop/java/temporal-client#start-workflow-execution) - [How to start a Workflow Execution using the PHP SDK](/dev-guide/php/foundations#start-workflow-execution) -- [How to start a Workflow Execution using the Python SDK](/dev-guide/python/temporal-clients#start-workflow-execution) +- [How to start a Workflow Execution using the Python SDK](/develop/python/temporal-clients#start-workflow-execution) - [How to start a Workflow Execution using the TypeScript SDK](/dev-guide/typescript/foundations#start-workflow-execution) Each Temporal Workflow Execution has exclusive access to its local state. @@ -350,7 +350,7 @@ If a failure occurs, the Workflow Execution picks up where the last recorded eve - [How to use Replay APIs using the Go SDK](/dev-guide/go/testing#replay) - [How to use Replay APIs using the Java SDK](/dev-guide/java/testing#replay) -- [How to use Replay APIs using the Python SDK](/dev-guide/python/test-suites#replay) +- [How to use Replay APIs using the Python SDK](/develop/python/test-suites#replay) - [How to use Replay APIs using the TypeScript SDK](/dev-guide/typescript/testing#replay) ### Commands and awaitables @@ -599,7 +599,7 @@ In the case of [Temporal Cron Jobs](#temporal-cron-job), Continue-As-New is actu - [How to Continue-As-New using the Go SDK](/dev-guide/go/features#continue-as-new) - [How to Continue-As-New using the Java SDK](/dev-guide/java/features#continue-as-new) - [How to Continue-As-New using the PHP SDK](/dev-guide/php/features#continue-as-new) -- [How to Continue-As-New using the Python SDK](/dev-guide/python/continue-as-new) +- [How to Continue-As-New using the Python SDK](/develop/python/continue-as-new) - [How to Continue-As-New using the TypeScript SDK](/dev-guide/typescript/features#continue-as-new) ### What is a Reset? {#reset} @@ -702,7 +702,7 @@ A Workflow Execution Timeout is the maximum time that a Workflow Execution can b - [How to set a Workflow Execution Timeout using the Go SDK](/dev-guide/go/features#workflow-timeouts) - [How to set a Workflow Execution Timeout using the Java SDK](/dev-guide/java/features#workflow-timeouts) - [How to set a Workflow Execution Timeout using the PHP SDK](/dev-guide/php/features#workflow-timeouts) -- [How to set a Workflow Execution Timeout using the Python SDK](/dev-guide/python/failure-detection#workflow-timeouts) +- [How to set a Workflow Execution Timeout using the Python SDK](/develop/python/failure-detection#workflow-timeouts) - [How to set a Workflow Execution Timeout using the TypeScript SDK](/dev-guide/typescript/features#workflow-timeouts)
@@ -730,7 +730,7 @@ A Workflow Run Timeout is the maximum amount of time that a single Workflow Run - [How to set a Workflow Run Timeout using the Go SDK](/dev-guide/go/features#workflow-timeouts) - [How to set a Workflow Run Timeout using the Java SDK](/dev-guide/java/features#workflow-timeouts) - [How to set a Workflow Run Timeout using the PHP SDK](/dev-guide/php/features#workflow-timeouts) -- [How to set a Workflow Run Timeout using the Python SDK](/dev-guide/python/failure-detection#workflow-timeouts) +- [How to set a Workflow Run Timeout using the Python SDK](/develop/python/failure-detection#workflow-timeouts) - [How to set a Workflow Run Timeout using the TypeScript SDK](/dev-guide/typescript/features#workflow-timeouts)
@@ -758,7 +758,7 @@ A Workflow Task Timeout is the maximum amount of time allowed for a [Worker](/wo - [How to set a Workflow Task Timeout using the Go SDK](/dev-guide/go/features#workflow-timeouts) - [How to set a Workflow Task Timeout using the Java SDK](/dev-guide/java/features#workflow-timeouts) - [How to set a Workflow Task Timeout using the PHP SDK](/dev-guide/php/features#workflow-timeouts) -- [How to set a Workflow Task Timeout using the Python SDK](/dev-guide/python/failure-detection#workflow-timeouts) +- [How to set a Workflow Task Timeout using the Python SDK](/develop/python/failure-detection#workflow-timeouts) - [How to set a Workflow Task Timeout using the TypeScript SDK](/dev-guide/typescript/features#workflow-timeouts)
@@ -790,7 +790,7 @@ Workers consume no additional resources while waiting for a Timer to fire, so a - [How to set Timers in Go](/dev-guide/go/features#timers) - [How to set Timers in Java](/dev-guide/java/features#timers) - [How to set Timers in PHP](/dev-guide/php/features#timers) -- [How to set Timers in Python](/dev-guide/python/timers) +- [How to set Timers in Python](/develop/python/timers) - [How to set Timers in TypeScript](/dev-guide/typescript/features#timers) The duration of a Timer is fixed, and your Workflow might specify a value as short as one second or as long as several years. @@ -827,7 +827,7 @@ A Signal is an asynchronous request to a [Workflow Execution](#workflow-executio - [How to develop, send, and handle Signals in Go](/dev-guide/go/features#signals) - [How to develop, send, and handle Signals in Java](/dev-guide/java/features#signals) - [How to develop, send, and handle Signals in PHP](/dev-guide/php/features#signals) -- [How to develop, send, and handle Signals in Python](/dev-guide/python/messages#signals) +- [How to develop, send, and handle Signals in Python](/develop/python/messages#signals) - [How to develop, send, and handle Signals in TypeScript](/dev-guide/typescript/features#signals) A Signal delivers data to a running Workflow Execution. @@ -864,7 +864,7 @@ How to Signal-With-Start in: - [How to Signal-With-Start in Go](/dev-guide/go/features#signal-with-start) - [How to Signal-With-Start in Java](/dev-guide/java/features#signal-with-start) - [How to Signal-With-Start in PHP](/dev-guide/php/features#signal-with-start) -- [How to Signal-With-Start in Python](/dev-guide/python/messages#signal-with-start) +- [How to Signal-With-Start in Python](/develop/python/messages#signal-with-start) - [How to Signal-With-Start in TypeScript](/dev-guide/typescript/features#signal-with-start) ## What is a Query? {#query} @@ -878,7 +878,7 @@ Queries are available for running or completed Workflows Executions only if the - [How to send and handle Queries with the Go SDK](/dev-guide/go/features#queries) - [How to send and handle Queries with the Java SDK](/dev-guide/java/features#queries) - [How to send and handle Queries with the PHP SDK](/dev-guide/php/features#queries) -- [How to send and handle Queries with the Python SDK](/dev-guide/python/messages#queries) +- [How to send and handle Queries with the Python SDK](/develop/python/messages#queries) - [How to send and handle Queries with the TypeScript SDK](/dev-guide/typescript/features#queries) Queries are sent from a Temporal Client to a Workflow Execution. @@ -920,7 +920,7 @@ Stack Trace Queries are available only for running Workflow Executions. - Introduced in [Temporal Server version 1.21](https://github.com/temporalio/temporal/releases/tag/v1.21.0) - Available in [Go SDK](https://pkg.go.dev/go.temporal.io/sdk@v1.23.1/client#Client.UpdateWorkflowWithOptions) since [v1.23.0](https://github.com/temporalio/sdk-go/releases/tag/v1.23.0) - Available in [Java SDK]() since [v1.20.0](https://github.com/temporalio/sdk-java/releases/tag/v1.20.0) -- Available in [Python SDK](https://docs.temporal.io/dev-guide/python/messages#updates) since [v1.4.0](https://github.com/temporalio/sdk-python/releases/tag/1.4.0) +- Available in [Python SDK](https://docs.temporal.io/develop/python/messages#updates) since [v1.4.0](https://github.com/temporalio/sdk-python/releases/tag/1.4.0) - Available in [.NET SDK](https://dotnet.temporal.io/api/Temporalio.Client.WorkflowHandle.html#Temporalio_Client_WorkflowHandle_ExecuteUpdateAsync_System_String_System_Collections_Generic_IReadOnlyCollection_System_Object__Temporalio_Client_WorkflowUpdateOptions_) since [v0.1.0-beta2](https://github.com/temporalio/sdk-dotnet/releases/tag/0.1.0-beta2) - Available in [TypeScript SDK](https://typescript.temporal.io/api/interfaces/client.WorkflowHandle#executeupdate) since [v1.9.0](https://github.com/temporalio/sdk-typescript/releases/tag/v1.9.0) - Available in [PHP SDK](https://php.temporal.io/classes/Temporal-Client-WorkflowStubInterface.html#method_startUpdate) since [v2.8.0](https://github.com/temporalio/sdk-php/releases/tag/v2.8.0) @@ -930,7 +930,7 @@ Stack Trace Queries are available only for running Workflow Executions. An Update is a request and response from a Temporal Client to a [Workflow Execution](#workflow-execution). - [How to develop, send, and handle Updates in Go](/dev-guide/go/features#updates) -- [How to develop, and send Updates in Python](/dev-guide/python/messages#updates) +- [How to develop, and send Updates in Python](/develop/python/messages#updates) - [How to develop, send, and handle Updates in Java](/dev-guide/java/features#updates) - [How to develop, send, and handle Updates in PHP](/dev-guide/php/features#updates) @@ -990,7 +990,7 @@ Temporal supports Dynamic Workflows, Activities, Signals, and Queries. Currently, the Temporal SDKs that support Dynamic Handlers are: - [Java](/dev-guide/java/features#dynamic-handler) -- [Python](/dev-guide/python/messages#dynamic-handler) +- [Python](/develop/python/messages#dynamic-handler) - .NET The Go SDK supports Dynamic Signals through the [GetUnhandledSignalNames](https://pkg.go.dev/go.temporal.io/sdk/workflow#GetUnhandledSignalNames) function. @@ -1041,7 +1041,7 @@ If there is any chance that the code provided to the Side Effect could fail, use - Available in Temporal Cloud - Available in [Go SDK](/dev-guide/go/features#schedule-a-workflow) since [v1.22.0](https://github.com/temporalio/sdk-go/releases/tag/v1.22.0) - Available in [Java SDK](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/client/schedules/package-summary.html) since [v1.20.0](https://github.com/temporalio/sdk-java/releases/tag/v1.20.0) -- Available in [Python SDK](/dev-guide/python/schedules#schedule-a-workflow) since [v1.1.0](https://github.com/temporalio/sdk-python/releases/tag/1.1.0) +- Available in [Python SDK](/develop/python/schedules#schedule-a-workflow) since [v1.1.0](https://github.com/temporalio/sdk-python/releases/tag/1.1.0) - Available in [TypeScript SDK](https://github.com/temporalio/samples-typescript/tree/main/schedules#schedules) since [v1.5.0](https://github.com/temporalio/sdk-typescript/blob/main/CHANGELOG.md#150---2022-12-07) - Available in [.NET SDK](https://dotnet.temporal.io/api/Temporalio.Client.Schedules.html) since [v0.1.0](https://github.com/temporalio/sdk-dotnet/releases/tag/0.1.0-alpha4) - Available in [PHP SDK](https://php.temporal.io/classes/Temporal-Client-ScheduleClient.html) since [v2.7.0](https://github.com/temporalio/sdk-php/releases/tag/v2.7.0) @@ -1265,7 +1265,7 @@ A Temporal Cron Job is the series of Workflow Executions that occur when a Cron - [How to set a Cron Schedule using the Go SDK](/dev-guide/go/features#temporal-cron-jobs) - [How to set a Cron Schedule using the Java SDK](/dev-guide/java/features#cron-schedule) - [How to set a Cron Schedule using the PHP SDK](/dev-guide/php/features#temporal-cron-jobs) -- [How to set a Cron Schedule using the Python SDK](/dev-guide/python/schedules#temporal-cron-jobs) +- [How to set a Cron Schedule using the Python SDK](/develop/python/schedules#temporal-cron-jobs) - [How to set a Cron Schedule using the TypeScript SDK](/dev-guide/typescript/features#temporal-cron-jobs)
diff --git a/docs/evaluate/development-features/core-application.mdx b/docs/evaluate/development-features/core-application.mdx index 3384c23381..5545c06e96 100644 --- a/docs/evaluate/development-features/core-application.mdx +++ b/docs/evaluate/development-features/core-application.mdx @@ -45,7 +45,7 @@ Or jump straight to a Temporal SDK feature guide: - [Go SDK Core application feature guide](/develop/go/temporal-client) - [Java SDK Core application feature guide](/develop/java/temporal-client#connect-to-development-service) - [PHP SDK Core application feature guide](/dev-guide/php/foundations#connect-to-a-dev-cluster) -- [Python SDK Core application feature guide](/dev-guide/python/temporal-clients#connect-to-a-dev-cluster) +- [Python SDK Core application feature guide](/develop/python/temporal-clients#connect-to-a-dev-cluster) - [TypeScript SDK Core application feature guide](/dev-guide/typescript/foundations#connect-to-a-dev-cluster) For a deep dive into Temporal Workflows, Activities, and Workers, visit the following Temporal Encyclopedia pages or enroll in one of [our courses](https://learn.temporal.io/courses/): diff --git a/docs/evaluate/development-features/temporal-client.mdx b/docs/evaluate/development-features/temporal-client.mdx index d319b083d7..4297b77006 100644 --- a/docs/evaluate/development-features/temporal-client.mdx +++ b/docs/evaluate/development-features/temporal-client.mdx @@ -41,7 +41,7 @@ Or jump straight to a Temporal SDK feature guide: - [Go SDK Temporal Client feature guide](/develop/go/temporal-client) - [Java SDK Temporal Client feature guide](/develop/java/temporal-client) - [PHP SDK Temporal Client feature guide](/dev-guide/php/foundations#connect-to-a-dev-cluster) -- [Python SDK Temporal Client feature guide](/dev-guide/python/temporal-clients#connect-to-a-dev-cluster) +- [Python SDK Temporal Client feature guide](/develop/python/temporal-clients#connect-to-a-dev-cluster) - [TypeScript SDK Temporal Client feature guide](/dev-guide/typescript/foundations#connect-to-a-dev-cluster) For a deep dive into how a Temporal Client work, visit the [Temporal SDKs Encyclopedia page](/encyclopedia/temporal-sdks#temporal-client) or enroll in one of [our courses](https://learn.temporal.io/courses/). diff --git a/docs/evaluate/development-features/throughput-composability.mdx b/docs/evaluate/development-features/throughput-composability.mdx index 49b893295d..34ac9ac2bf 100644 --- a/docs/evaluate/development-features/throughput-composability.mdx +++ b/docs/evaluate/development-features/throughput-composability.mdx @@ -32,7 +32,7 @@ See the SDK feature guides for implementation details: - [Go SDK Child Workflow feature guide](/dev-guide/go/features#child-workflows) - [Java SDK Child Workflow feature guide](/dev-guide/java/features#child-workflows) - [PHP SDK Child Workflow feature guide](/dev-guide/php/features#child-workflows) -- [Python SDK Child Workflow feature guide](//dev-guide/python/child-workflows) +- [Python SDK Child Workflow feature guide](//develop/python/child-workflows) - [TypeScript SDK Child Workflow feature guide](/dev-guide/typescript/features#child-workflows) For a deep dive into Child Workflows see the [Child Workflows Encyclopedia page](/encyclopedia/child-workflows). diff --git a/docs/production-deployment/cloud/get-started.mdx b/docs/production-deployment/cloud/get-started.mdx index d66cf17948..546c5039ae 100644 --- a/docs/production-deployment/cloud/get-started.mdx +++ b/docs/production-deployment/cloud/get-started.mdx @@ -55,7 +55,7 @@ Each SDK has a way to use your CA certificates and private keys to authenticate - [Connect to Temporal Cloud in Go](/develop/go/temporal-client#connect-to-temporal-cloud) - [Connect to Temporal Cloud in Java](/develop/java/temporal-client#connect-to-temporal-cloud) -- [Connect to Temporal Cloud in Python](/dev-guide/python/temporal-clients#connect-to-temporal-cloud) +- [Connect to Temporal Cloud in Python](/develop/python/temporal-clients#connect-to-temporal-cloud) - [Connect to Temporal Cloud in TypeScript](/dev-guide/typescript/foundations#connect-to-temporal-cloud) - [Run a Temporal Cloud Worker in Go](/dev-guide/go/foundations#run-a-temporal-cloud-worker) diff --git a/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx b/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx index 2219c1d4a5..324f601b7b 100644 --- a/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx +++ b/docs/production-deployment/cloud/metrics/prometheus-grafana.mdx @@ -55,7 +55,7 @@ If you're following through with the examples provided here, ensure that you hav - [Go](/develop/go/temporal-client#connect-to-temporal-cloud) - [Java](/dev-guide/java/project-setup#cloud-worker) - [PHP](/dev-guide/php/foundations#connect-to-a-dev-cluster) - - [Python](/dev-guide/python/temporal-clients#connect-to-temporal-cloud) + - [Python](/develop/python/temporal-clients#connect-to-temporal-cloud) - [TypeScript](/dev-guide/typescript/foundations#connect-to-temporal-cloud) - Prometheus and Grafana installed. @@ -94,7 +94,7 @@ Each language development guide has details on how to set this up. - [Go SDK](/dev-guide/go/observability#metrics) - [Java SDK](/dev-guide/java/observability#metrics) - [TypeScript SDK](/dev-guide/typescript/observability#metrics) -- [Python](/dev-guide/python/observability#metrics) +- [Python](/develop/python/observability#metrics) The following example uses the Java SDK to set the Prometheus registry and Micrometer stats reporter, set the scope, and expose an endpoint from which Prometheus can scrape the SDK metrics. diff --git a/docs/production-deployment/self-hosted-guide/monitoring.mdx b/docs/production-deployment/self-hosted-guide/monitoring.mdx index 7f5c824b65..0f1f8237f4 100644 --- a/docs/production-deployment/self-hosted-guide/monitoring.mdx +++ b/docs/production-deployment/self-hosted-guide/monitoring.mdx @@ -99,7 +99,7 @@ The Metrics section in the Observability guide details how to set this up for al [Golang](/dev-guide/go/observability#metrics) [Java](/dev-guide/java/observability#metrics) [PHP](/dev-guide/php/observability) -[Python](/dev-guide/python/observability#metrics) +[Python](/develop/python/observability#metrics) [TypeScript](/dev-guide/typescript/observability#metrics) For example, with the Java SDK, you can set up the Prometheus registry and Micrometer stats reporter, set the scope, and expose an endpoint from which Prometheus can scrape the SDK Client metrics in the following way. diff --git a/docs/references/sdk-metrics.mdx b/docs/references/sdk-metrics.mdx index 06025a1338..a615b45ddb 100644 --- a/docs/references/sdk-metrics.mdx +++ b/docs/references/sdk-metrics.mdx @@ -24,7 +24,7 @@ The Temporal SDKs emit a set of metrics from Temporal Client usage and Worker Pr - [How to emit metrics using the Go SDK](/dev-guide/go/observability#metrics) - [How to emit metrics using the Java SDK](/dev-guide/java/observability#metrics) -- [How to emit metrics using the Python SDK](/dev-guide/python/observability#metrics) +- [How to emit metrics using the Python SDK](/develop/python/observability#metrics) - [How to emit metrics using the TypeScript SDK](/dev-guide/typescript/observability#metrics) - [How to tune Worker performance based on metrics](/dev-guide/worker-performance) diff --git a/sidebars.js b/sidebars.js index aee7d0f1b4..1eb8914edc 100644 --- a/sidebars.js +++ b/sidebars.js @@ -116,25 +116,25 @@ module.exports = { collapsed: true, link: { type: "doc", - id: "dev-guide/python/index", + id: "develop/python/index", }, items: [ - "dev-guide/python/core-application", - "dev-guide/python/temporal-clients", - "dev-guide/python/test-suites", - "dev-guide/python/failure-detection", - "dev-guide/python/messages", - "dev-guide/python/cancellation", - "dev-guide/python/asynchronous-activity-completion", - "dev-guide/python/versioning", - "dev-guide/python/observability", - "dev-guide/python/debugging", - "dev-guide/python/schedules", - "dev-guide/python/data-encryption", - "dev-guide/python/child-workflows", - "dev-guide/python/continue-as-new", - "dev-guide/python/timers", - "dev-guide/python/interrupt-a-workflow-execution", + "develop/python/core-application", + "develop/python/temporal-clients", + "develop/python/test-suites", + "develop/python/failure-detection", + "develop/python/messages", + "develop/python/cancellation", + "develop/python/asynchronous-activity-completion", + "develop/python/versioning", + "develop/python/observability", + "develop/python/debugging", + "develop/python/schedules", + "develop/python/data-encryption", + "develop/python/child-workflows", + "develop/python/continue-as-new", + "develop/python/timers", + "develop/python/interrupt-a-workflow-execution", ], }, { diff --git a/vercel.json b/vercel.json index 595eeb02e6..1d0fe72a93 100644 --- a/vercel.json +++ b/vercel.json @@ -223,7 +223,7 @@ "value": "python" } ], - "destination": "/dev-guide/python/foundations:path*", + "destination": "/develop/python/foundations:path*", "permanent": false }, { @@ -235,7 +235,7 @@ "value": "python" } ], - "destination": "/dev-guide/python/features:path*", + "destination": "/develop/python/features:path*", "permanent": false }, { @@ -247,7 +247,7 @@ "value": "python" } ], - "destination": "/dev-guide/python/observability:path*", + "destination": "/develop/python/observability:path*", "permanent": false }, { @@ -259,7 +259,7 @@ "value": "python" } ], - "destination": "/dev-guide/python/testing:path*", + "destination": "/develop/python/testing:path*", "permanent": false }, { @@ -1991,12 +1991,12 @@ "destination": "/encyclopedia/go-sdk-multithreading" }, { - "source": "/dev-guide/python/async-vs-sync", + "source": "/develop/python/async-vs-sync", "destination": "/encyclopedia/python-sdk-sync-vs-async" }, { - "source": "/dev-guide/python/sandbox", + "source": "/develop/python/sandbox", "destination": "/encyclopedia/python-sdk-sandbox" } ] -} +} \ No newline at end of file From 5c46025bab18797909fc50cc92d0fadeab7d8aaa Mon Sep 17 00:00:00 2001 From: rachfop Date: Tue, 21 May 2024 14:22:52 -0700 Subject: [PATCH 17/26] fix broken go links --- docs/dev-guide/golang/durable-execution.mdx | 526 -------------------- docs/encyclopedia/temporal-sdks.mdx | 2 +- 2 files changed, 1 insertion(+), 527 deletions(-) delete mode 100644 docs/dev-guide/golang/durable-execution.mdx diff --git a/docs/dev-guide/golang/durable-execution.mdx b/docs/dev-guide/golang/durable-execution.mdx deleted file mode 100644 index b45c1d5e98..0000000000 --- a/docs/dev-guide/golang/durable-execution.mdx +++ /dev/null @@ -1,526 +0,0 @@ ---- -id: durable-execution -title: Develop code that durably executes - Go SDK dev guide -sidebar_label: Develop for durability -description: The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. -slug: /dev-guide/go/durable-execution -toc_max_heading_level: 4 -keywords: - - determinism - - developer-guide-doc-type - - durable execution - - event history - - go sdk - - introduction-doc-type - - logger - - replay - - replay test - - replayer - - sleep - - static analysis - - testing - - tests - - timer -tags: - - determinism - - developer-guide-doc-type - - durable-execution - - event-history - - go-sdk - - introduction-doc-type - - logger - - replay - - replay-test - - replayer - - sleep - - static-analysis - - testing - - tests - - timer ---- - -When it comes to the Temporal Platform's ability to durably execute code, the SDK's ability to [Replay](/encyclopedia/temporal-sdks#replays) a Workflow Execution is a major aspect of that. -This chapter introduces the development patterns which enable that. - -:::competency Develop for a Durable Execution - -This chapter of the Temporal Go SDK developer's guide introduces best practices to developing deterministic Workflows that can be Replayed, enabling a [Durable Execution](/temporal#durable-execution). - -By the end of this section you will know basic best practices for Workflow Definition development. - -Learning objectives: - -- Identify SDK API calls that map to Events -- Recognize non-deterministic Workflow code -- Explain how Workflow code execution progresses - -The information in this chapter is also available in the [Temporal 102 course](https://learn.temporal.io/courses/temporal_102/). - -::: - -This chapter builds on the [Construct a new Temporal Application project](/dev-guide/go/project-setup) chapter and relies on the Background Check use case and sample applications as a means to contextualize the information. - -This chapter walks through the following sequence: - -- Retrieve a Workflow Execution's Event History -- Add a Replay test to your application -- Intrinsic non-deterministic logic -- Non-deterministic code changes - -## Retrieve a Workflow Execution's Event History {#retrieve-event-history} - -There are a few ways to view and download a Workflow Execution's [Event History](/workflows#event-history). -We recommend starting off by using either the Temporal CLI or the Web UI to access it. - -### Using the Temporal CLI - -Use the Temporal CLI's `temporal workflow show` command to save your Workflow Execution's Event History to a local file. -Run the command from the `/tests` directory so that the file saves alongside the other testing files. - -```text -/backgroundcheck - ... - /tests - | tests.go - | backgroundcheck_workflow_history.json -``` - -**Local dev server** - -If you have been following along with the earlier chapters of this guide, your Workflow Id might be something like `backgroundcheck_workflow`. - -```shell -temporal workflow show \ - --workflow-id backgroundcheck_workflow \ - --namespace backgroundcheck_namespace \ - --output json > backgroundcheck_workflow_event_history.json -``` - -:::info Workflow Id returns the most recent Workflow Execution - -The most recent Event History for that Workflow Id is returned when you only use the Workflow Id to identify the Workflow Execution. -Use the `--run-id` option as well to get the Event History of an earlier Workflow Execution by the same Workflow Id. - -::: - -**Temporal Cloud** - -For Temporal Cloud, remember to either provide the paths to your certificate and private keys as command options, or set those paths as environment variables: - -```shell -temporal workflow show \ - --workflow-id backgroundcheck_workflow \ - --namespace backgroundcheck_namespace \ - --tls-cert-path /path/to/ca.pem \ - --tls-key-path /path/to/ca.key \ - --output json > backgroundcheck_workflow_history.json -``` - -**Self-hosted Temporal Cluster** - -For self-hosted environments, you might be using the Temporal CLI command alias: - -```shell -temporal_docker workflow show \ - --workflow-id backgroundcheck_workflow \ - --namespace backgroundcheck_namespace \ - --output json > backgroundcheck_workflow_history.json -``` - -### Via the UI - -A Workflow Execution's Event History is also available in the Web UI. - -Navigate to the Workflows page in the UI and select the Workflow Execution. - -
-
-

Select a Workflow Execution from the Workflows page

-
-
- Select a Workflow Execution from the Workflows page -
-
- -From the Workflow details page you can copy the Event History from the JSON tab and paste it into the `backgroundcheck_workflow_history.json` file. - -
-
-

Copy Event History JSON object from the Web UI

-
-
- Copy Event History JSON object from the Web UI -
-
- -## Add a Replay test {#add-replay-test} - -Add the Replay test to the set of application tests. -The Replayer is available from the `go.temporal.io/sdk/worker` package in the SDK. -Register the Workflow Definition and then specify an existing Event History to compare to. - -Run the tests in the test directory (`go test`). -If the Workflow Definition and the Event History are incompatible then the test fails. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```go - -// TestReplayWorkflowHistoryFromFile tests for Event History compatibility. -func (s *UnitTestSuite) TestReplayWorkflowHistoryFromFile() { - // Create a new Replayer - replayer := worker.NewWorkflowReplayer() - // Register the Workflow with the Replayer - replayer.RegisterWorkflow(workflows.BackgroundCheck) - // Compare the current Workflow code against the existing Event History - // This call fails unless updated to use 'backgroundcheck_workflow_event_history_with_timer.json' - err := replayer.ReplayWorkflowHistoryFromJSONFile(nil, "backgroundcheck_workflow_event_history.json") - s.NoError(err) -} -``` - -### Why add a Replay test? {#why-replay-test} - -The Replay test is important because it verifies whether the current Workflow code (Workflow Definition) remains compatible with the Event Histories of earlier Workflow Executions. - -A failed Replay test typically indicates that the Workflow code exhibits non-deterministic behavior. -In other words, for a specific input, the Workflow code can follow different code paths during each execution, resulting in distinct sequences of Events. -The Temporal Platform's ability to ensure durable execution depends on the SDK's capability to re-execute code and return to the most recent state of the Workflow Function execution. - -The Replay test executes the same steps as the SDK and verifies compatibility. - -Workflow code becomes non-deterministic primarily through two main avenues: - -1. **[Intrinsic non-deterministic logic](#intrinsic-non-deterministic-logic):** This occurs when Workflow state or branching logic within the Workflow gets determined by factors beyond the SDK's control. -2. **[Non-deterministic code changes](#durability-through-replays):** When you change your Workflow code and deploy those changes while there are still active Workflow Executions relying on older code versions. - -## Intrinsic non-deterministic logic {#intrinsic-non-deterministic-logic} - -Referred to as "intrinsic non-determinism" this kind of "bad" Workflow code can prevent the Workflow code from completing because the Workflow can take a different code path than the one expected from the Event History. - -The following are some common operations that **can't** be done inside of a Workflow Definition: - -- Generate and rely on random numbers (Use Activites instead). -- Accessing / mutating external systems or state. - This includes calling an external API, conducting a file I/O operation, talking to another service, etc. (use Activities instead). -- Relying on system time. - - Use `workflow.Now()` as a replacement for `time.Now()`. - - Use `workflow.Sleep()` as a replacement for `time.Sleep()`. -- Working directly with threads or goroutines. - - Use `workflow.Go()` as a replacement for the `go` statement. - - Use `workflow.Channel()` as a replacement for the native `chan` type. - Temporal provides support for both buffered and unbuffered channels. - - Use `workflow.Selector()` as a replacement for the `select` statement. -- Iterating over data structures with unknown ordering. - This includes iterating over maps using `range`, because with `range` the order of the map's iteration is randomized. - Instead you can collect the keys of the map, sort them, and then iterate over the sorted keys to access the map. - This technique provides deterministic results. - You can also use a Side Effect or an Activity to process the map instead. -- Storing or evaluating the run Id. - -One way to produce a non-deterministic error is to use a random number to determine whether to sleep inside the Workflow. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```go - -package workflows - -import ( - "math/rand" - "time" - - "go.temporal.io/sdk/workflow" - - "documentation-samples-go/dev-guide/chapters/durability/activities" -) - -// BackgroundCheckNonDeterministic is an anti-pattern Workflow Definition -func BackgroundCheckNonDeterministic(ctx workflow.Context, param string) (string, error) { - activityOptions := workflow.ActivityOptions{ - StartToCloseTimeout: 10 * time.Second, - } - ctx = workflow.WithActivityOptions(ctx, activityOptions) - var ssnTraceResult string - // highlight-start - // CAUTION, the following code is an anti-pattern showing what NOT to do - num := rand.Intn(100) - if num > 50 { - err := workflow.Sleep(ctx, 10*time.Second) - if err != nil { - return "", err - } - } - // highlight-end - err := workflow.ExecuteActivity(ctx, activities.SSNTraceActivity, param).Get(ctx, &ssnTraceResult) - if err != nil { - return "", err - } - return ssnTraceResult, nil -} -``` - -If you run the BackgroundCheckNonDeterministic Workflow enough times, eventually you will see a Workflow Task failure. - -The Worker logs will show something similar to the following: - -```shell -2023/11/08 08:33:03 ERROR Workflow panic Namespace backgroundcheck_namespace TaskQueue backgroundcheck-replay-task-queue-local WorkerID 89476@flossypurse-macbook-pro.local@ WorkflowType BackgroundCheckNonDeterministic WorkflowID backgroundcheck_workflow RunID 02f36de4-ca96-4468-a883-91c098996354 Attempt 1 Error unknown command CommandType: Timer, ID: 5, possible causes are nondeterministic workflow definition code or incompatible change in the workflow definition StackTrace process event for backgroundcheck-replay-task-queue-local [panic]: -go.temporal.io/sdk/internal.panicIllegalState(...) -``` - -And you will see information about the failure in the Web UI as well. - -
-
-

Web UI view of a non-determinism error

-
-
- Web UI view of a non-determinism error -
-
- -To inspect the Workflow Task failure using the Temporal CLI, you can use the `long` value for the `--fields` command option with the `temporal workflow show` command. - -```shell -temporal workflow show \ - --workflow-id backgroundcheck_workflow_break \ - --namespace backgroundcheck_namespace \ - --fields long -``` - -This will display output similar to the following: - -```shell -Progress: - ID Time Type Details - 1 2023-11-08T15:32:03Z WorkflowExecutionStarted {WorkflowType:{Name:BackgroundCheckNonDeterministic}, - ParentInitiatedEventId:0, - TaskQueue:{Name:backgroundcheck-replay-task-queue-local, - Kind:Normal}, Input:["555-55-5555"], - WorkflowExecutionTimeout:0s, WorkflowRunTimeout:0s, - WorkflowTaskTimeout:10s, Initiator:Unspecified, - OriginalExecutionRunId:02f36de4-ca96-4468-a883-91c098996354, - Identity:temporal-cli:flossypurse@flossypurse-macbook-pro.local, - FirstExecutionRunId:02f36de4-ca96-4468-a883-91c098996354, - Attempt:1, FirstWorkflowTaskBackoff:0s, - ParentInitiatedEventVersion:0} - 2 2023-11-08T15:32:03Z WorkflowTaskScheduled {TaskQueue:{Name:backgroundcheck-replay-task-queue-local, - Kind:Normal}, StartToCloseTimeout:10s, Attempt:1} - 3 2023-11-08T15:32:03Z WorkflowTaskStarted {ScheduledEventId:2, Identity:89425@flossypurse-macbook-pro.local@, - RequestId:7a2515a0-885b-46a5-997f-4d41fe86a290, - SuggestContinueAsNew:false, HistorySizeBytes:762} - 4 2023-11-08T15:32:03Z WorkflowTaskCompleted {ScheduledEventId:2, StartedEventId:3, Identity:89425@flossypurse-macbook-pro.local@, - BinaryChecksum:2d9bc9784e1f18c4906cf95289a8bbcb,SdkMetadata:{CoreUsedFlags:[], - LangUsedFlags:[3]}, MeteringMetadata:{NonfirstLocalActivityExecutionAttempts:0}} - 5 2023-11-08T15:32:03Z TimerStarted {TimerId:5, StartToFireTimeout:1m0s, WorkflowTaskCompletedEventId:4} - 6 2023-11-08T15:33:03Z TimerFired {TimerId:5, StartedEventId:5} - 7 2023-11-08T15:33:03Z WorkflowTaskScheduled {TaskQueue:{Name:flossypurse-macbook-pro.local:26d90960-cd3f-4229-8312-3716e916ac77, - Kind:Sticky}, StartToCloseTimeout:10, Attempt:1} - 8 2023-11-08T15:33:03Z WorkflowTaskStarted {ScheduledEventId:7, Identity:89476@flossypurse-macbook-pro.local@, - RequestId:ed6a7561-e9b8-4949-94b7-42d7b66640c5, - SuggestContinueAsNew:false, HistorySizeBytes:1150} - 9 2023-11-08T15:33:03Z WorkflowTaskFailed {ScheduledEventId:7, StartedEventId:8, Cause:NonDeterministicError, - Failure:{Message:unknown command CommandType: Timer, ID: 5, possible causes are - nondeterministic workflow definition code or incompatible change in the workflow definition, - Source:GoSDK, StackTrace:process event for backgroundcheck-replay-task-queue-local - [panic]: go.temporal.io/sdk/internal.panicIllegalState(...) - /Users/flossypurse/go/pkg/mod/go.temporal.io/sdk@v1.25.1/in - ternal/internal_command_state_machine.go:440 go.temporal.io/sdk/internal ... - poral.io/sdk@v1.25.1/internal/internal_worker_base.go:356 +0x48 created by - go.temporal.io/sdk/internal.(*baseWorker).processTaskAsync in goroutine 50 - /Users/flossypurse/go/pkg/mod/go.temporal.io/sdk@v1.25.1/internal/internal_worker_base.go:352 - +0xbc, FailureInfo:{ApplicationFailureInfo:{Type:PanicError, NonRetryable:true}}}, - Identity:89476@flossypurse-macbook-pro.local@, ForkEventVersion:0, - BinaryChecksum:da7cae1f96abf543ca8b6e7c3f3ab072} -``` - -### Static analysis tools {#static-analysis} - -Non-deterministic code can be hard to catch while developing Workflows. -The Go SDK doesn't have a restricted runtime to identify and prevent the use of `time.Sleep` or a new goroutine. -Calling those, or any other invalid construct can lead to ugly non-determinism errors. - -To help catch these issues early and during development, use the [`workflowcheck` static analysis tool](https://github.com/temporalio/sdk-go/tree/master/contrib/tools/workflowcheck). -It attempts to find all invalid code called from inside a Workflow Definition. -See the [`workflowcheck` README](https://github.com/temporalio/sdk-go/blob/master/contrib/tools/workflowcheck/README.md) for details on how to use it. - -## Non-deterministic code changes {#durability-through-replays} - -The most important thing to take away from the section is to make sure you have an application versioning plan whenever you are developing and maintaining a Temporal Application that will eventually deploy to a production environment. - -Versioning APIs and versioning strategies are covered in other parts of the developer's guide, this chapter sets the stage to understand why and how to approach those strategies. - -{/* TODO ^ update with links to those places */} - -### The Event History - -Inspect the Event History of a recent Background Check Workflow using the `temporal workflow show` command: - -```shell -temporal workflow show \ - --workflow-id backgroundcheck_workflow \ - --namespace backgroundcheck_namespace -``` - -You should see output similar to this: - -```shell -Progress: - ID Time Type - 1 2023-10-25T20:28:03Z WorkflowExecutionStarted - 2 2023-10-25T20:28:03Z WorkflowTaskScheduled - 3 2023-10-25T20:28:03Z WorkflowTaskStarted - 4 2023-10-25T20:28:03Z WorkflowTaskCompleted - 5 2023-10-25T20:28:03Z ActivityTaskScheduled - 6 2023-10-25T20:28:03Z ActivityTaskStarted - 7 2023-10-25T20:28:03Z ActivityTaskCompleted - 8 2023-10-25T20:28:03Z WorkflowTaskScheduled - 9 2023-10-25T20:28:03Z WorkflowTaskStarted - 10 2023-10-25T20:28:03Z WorkflowTaskCompleted - 11 2023-10-25T20:28:03Z WorkflowExecutionCompleted - -Result: - Status: COMPLETED - Output: ["pass"] -``` - -The preceding output shows eleven Events in the Event History ordered in a particular sequence. -All Events are created by the Temporal Server in response to either a request coming from a Temporal Client, or a [Command](/workflows#command) coming from the Worker. - -Let's take a closer look: - -- `WorkflowExecutionStarted`: This Event is created in response to the request to start the Workflow Execution. -- `WorkflowTaskScheduled`: This Event indicates a Workflow Task is in the Task Queue. -- `WorkflowTaskStarted`: This Event indicates that a Worker successfully polled the Task and started evaluating Workflow code. -- `WorkflowTaskCompleted`: This Event indicates that the Worker suspended execution and made as much progress that it could. -- `ActivityTaskScheduled`: This Event indicates that the ExecuteActivity API was called and the Worker sent the [`ScheduleActivityTask`](/references/commands#scheduleactivitytask) Command to the Server. -- `ActivityTaskStarted`: This Event indicates that the Worker successfully polled the Activity Task and started evaluating Activity code. -- `ActivityTaskCompleted`: This Event indicates that the Worker completed evaluation of the Activity code and returned any results to the Server. - In response, the Server schedules another Workflow Task to finish evaluating the Workflow code resulting in the remaining Events, `WorkflowTaskScheduled`.`WorkflowTaskStarted`, `WorkflowTaskCompleted`, `WorkflowExecutionCompleted`. - -:::info Event reference - -The [Event reference](/references/events) serves as a source of truth for all possible Events in the Workflow Execution's Event History and the data that is stored in them. - -::: - -### Add a call to sleep {#add-sleep-call} - -In the following sample, we add a couple of logging statements and a Timer to the Workflow code to see how this affects the Event History. - -Use the `workflow.Sleep()` API to cause the Workflow to sleep for a minute before the call to execute the Activity. -The Temporal SDK offers both a `workflow.StartTimer()` API, and a `workflow.Sleep()` API that enables you to add time based logic to your Workflow code. - -Use the `workflow.GetLogger` API to log from Workflows to avoid seeing repeated logs from the Replay of the Workflow code. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```go - -package workflows - -import ( - "time" - - "go.temporal.io/sdk/workflow" - - "documentation-samples-go/dev-guide/chapters/durability/activities" -) - -// BackgroundCheck is your custom Workflow Definition. -func BackgroundCheck(ctx workflow.Context, param string) (string, error) { - // highlight-start - // Sleep for 1 minute - workflow.GetLogger(ctx).Info("Sleeping for 1 minute...") - err := workflow.Sleep(ctx, 60*time.Second) - if err != nil { - return "", err - } - workflow.GetLogger(ctx).Info("Finished sleeping") - // highlight-end - // Define the Activity Execution options - // StartToCloseTimeout or ScheduleToCloseTimeout must be set - activityOptions := workflow.ActivityOptions{ - StartToCloseTimeout: 10 * time.Second, - } - ctx = workflow.WithActivityOptions(ctx, activityOptions) - // Execute the Activity synchronously (wait for the result before proceeding) - var ssnTraceResult string - err = workflow.ExecuteActivity(ctx, activities.SSNTraceActivity, param).Get(ctx, &ssnTraceResult) - if err != nil { - return "", err - } - // Make the results of the Workflow available - return ssnTraceResult, nil -} -``` - -### Inspect the new Event History {#inspect-new-event-history} - -After updating your Workflow code to include the logging and Timer, run your tests again. -You should expect to see the `TestReplayWorkflowHistoryFromFile` test fail. -This is because the code we added creates new Events and alters the Event History sequence. - -To get this test to pass, we must get an updated Event History JSON file. -[Start a new Workflow](/dev-guide/go/project-setup#start-workflow) and after it is complete [download the Event History as a JSON object](#retrieve-event-history). - -:::info Double check Task Queue names - -Reminder that this guide jumps between several sample applications using multiple Task Queues. -Make sure you are starting Workflows on the same Task Queue that the Worker is listening to. -And, always make sure that all Workers listening to the same Task Queue are registered with the same Workflows and Activities. - -::: - -If you inspect the new Event History, you will see two new Events in response to the `workflow.Sleep()` API call which send the [StartTimer Command](/references/commands#starttimer) to the Server: - -- `TimerStarted` -- `TimerFired` - -However, it is also important to note that you don't see any Events related to logging. -And if you were to remove the Sleep call from the code, there wouldn't be a compatibility issue with the previous code. -This is to highlight that only certain code changes within Workflow code is non-deterministic. -The basic thing to remember is that if the API call causes a [Command](/references/commands) to create Events in the Workflow History that takes a new path from the existing Event History then it is a non-deterministic change. - -This becomes a critical aspect of Workflow development when there are running Workflows that have not yet completed and rely on earlier versions of the code. - -Practically, that means non-deterministic changes include but are not limited to the following: - -- Adding or removing an Activity -- Switching the Activity Type used in a call to `ExecuteActivity` -- Adding or removing a Timer -- Altering the execution order of Activities or Timers relative to one another - -The following are a few examples of changes that do not lead to non-deterministic errors: - -- Modifying non-Command generating statements in a Workflow Definition, such as logging statements -- Changing attributes in the `ActivityOptions` -- Modifying code inside of an Activity Definition diff --git a/docs/encyclopedia/temporal-sdks.mdx b/docs/encyclopedia/temporal-sdks.mdx index c853144cfd..a20d94b7eb 100644 --- a/docs/encyclopedia/temporal-sdks.mdx +++ b/docs/encyclopedia/temporal-sdks.mdx @@ -56,7 +56,7 @@ Hence, a Temporal Application can run for seconds or years in the presence of ar Each Temporal SDK targets a specific programming language. -- [Go SDK developer's guide](/dev-guide/go/introduction) +- [Go SDK developer's guide](/dev-guide/go/) - [Java SDK developer's guide](/dev-guide/java/introduction) - [PHP SDK developer's guide](/dev-guide/php) - [Python SDK developer's guide](/develop/python/introduction) From 4278769ea881055ef80d1db5ac5154debf64395a Mon Sep 17 00:00:00 2001 From: rachfop Date: Tue, 21 May 2024 15:01:06 -0700 Subject: [PATCH 18/26] prose --- docs/develop/python/index.mdx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/develop/python/index.mdx b/docs/develop/python/index.mdx index 6a88883d2b..b2695fbb10 100644 --- a/docs/develop/python/index.mdx +++ b/docs/develop/python/index.mdx @@ -18,7 +18,7 @@ This guide provides a comprehensive overview of the structures, primitives, and ## Core Application -The Core Application section of the Temporal Python SDK Developer's Guide covers the essential concepts and implementation details needed to build and run a Temporal Application. +The Core Application section of the Develop with Temporal Python SDK covers the essential concepts and implementation details needed to build and run a Temporal Application. - [Develop a Basic Workflow](/develop/python/core-application#develop-workflows) - [Develop a Basic Activity](/develop/python/core-application#develop-activities) @@ -27,7 +27,7 @@ The Core Application section of the Temporal Python SDK Developer's Guide covers ## Temporal Client -The Temporal Client section of the Temporal Python SDK Developer's Guide describes how to use the Temporal Client to connect and start a Workflow Execution. +The Temporal Client section of the Develop with Temporal Python SDK describes how to use the Temporal Client to connect and start a Workflow Execution. - [Connect to Development Temporal Service](/develop/python/temporal-clients#connect-to-development-service) - [Connect a Temporal Client to a Temporal Cluster](/develop/python/temporal-clients#connect-to-a-dev-cluster) @@ -36,7 +36,7 @@ The Temporal Client section of the Temporal Python SDK Developer's Guide describ ## Test Suites -The Testing section of the Temporal Python SDK Developer's Guide describes how to test your Temporal Application. +The Testing section of the Develop with Temporal Python SDK describes how to test your Temporal Application. - [Test Frameworks](/develop/python/test-suites#test-frameworks) - [Testing Activities](/develop/python/test-suites#test-activities) @@ -45,7 +45,7 @@ The Testing section of the Temporal Python SDK Developer's Guide describes how t ## Failure Detection -The Failure Detection section of the Temporal Python SDK Developer's Guide describes how to configure timeouts and heartbeat intervals for Activities and Workflows. +The Failure Detection section of the Develop with Temporal Python SDK describes how to configure timeouts and heartbeat intervals for Activities and Workflows. - [Workflow Timeouts](/develop/python/failure-detection#workflow-timeouts) - [Set Activity Timeouts](/develop/python/failure-detection#activity-timeouts) @@ -53,7 +53,7 @@ The Failure Detection section of the Temporal Python SDK Developer's Guide descr ## Messages -The Messages section of the Temporal Python SDK Developer's Guide describes how to use the Temporal Client to send messages to a Workflow Execution. +The Messages section of the Develop with Temporal Python SDK describes how to use the Temporal Client to send messages to a Workflow Execution. - [Develop with Signals](/develop/python/messages#signals) - [Develop with Queries](/develop/python/messages#queries) @@ -62,13 +62,13 @@ The Messages section of the Temporal Python SDK Developer's Guide describes how ## Cancellation -The Cancellation section of the Temporal Python SDK Developer's Guide describes how to cancel a Workflow Execution. +The Cancellation section of the Develop with Temporal Python SDK describes how to cancel a Workflow Execution. - [Cancel an Activity from a Workflow](/develop/python/cancellation#cancel-an-activity) ## Asynchronous Activity Completion -The Asynchronous Activity Completion section of the Temporal Python SDK Developer's Guide describes how to complete Activities asynchronously. +The Asynchronous Activity Completion section of the Develop with Temporal Python SDK describes how to complete Activities asynchronously. - [Asynchronously Complete an Activity](/develop/python/asynchronous-activity-completion#asynchronously-complete-an-activity) @@ -97,7 +97,7 @@ The Debugging section of the Temporal Developer's Guide covers the various ways ## Schedules -The Schedules section of the Temporal Python SDK Developer's Guide covers how to schedule Workflows, run Workflows on a Cron, and configure Workflows to run on a delay. +The Schedules section of the Develop with Temporal Python SDK covers how to schedule Workflows, run Workflows on a Cron, and configure Workflows to run on a delay. - [Schedule a Workflow](/develop/python/schedules#schedule-a-workflow) - [Temporal Cron Jobs](/develop/python/schedules#temporal-cron-jobs) @@ -112,24 +112,24 @@ The Converters and Codecs section of the Temporal Developer's Guide provides gui ## Child Workflows -The Child Workflows section of the Temporal Python SDK Developer's Guide covers how to spawn a Child Workflow Execution and handle Child Workflow Events. +The Child Workflows section of the Develop with Temporal Python SDK covers how to spawn a Child Workflow Execution and handle Child Workflow Events. - [Start a Child Workflow Execution](/develop/python/child-workflows) ## Continue-As-New -The Continue-As-New section of the Temporal Python SDK Developer's Guide covers how to create a new Workflow Execution using the same Workflow ID as an existing Workflow Execution. +The Continue-As-New section of the Develop with Temporal Python SDK covers how to create a new Workflow Execution using the same Workflow ID as an existing Workflow Execution. - [Continue-As-New](/develop/python/continue-as-new) ## Timers -The Timers section of the Temporal Python SDK Developer's Guide covers how to use timers and sleeps within Workflows. +The Timers section of the Develop with Temporal Python SDK covers how to use timers and sleeps within Workflows. - [What is a Timer](/develop/python/timers) ## Interrupt a Workflow Execution -The Interrupt a Workflow Execution section of the Temporal Python SDK Developer's Guide covers how to interrupt a Workflow Execution with a Cancel or Terminate action. +The Interrupt a Workflow Execution section of the Develop with Temporal Python SDK covers how to interrupt a Workflow Execution with a Cancel or Terminate action. - [Interrupt a Workflow Execution](/develop/python/interrupt-a-workflow-execution) \ No newline at end of file From a532a60a8e02aab0d4818e56608da1c772f83d20 Mon Sep 17 00:00:00 2001 From: Cully Date: Thu, 23 May 2024 11:20:42 -0600 Subject: [PATCH 19/26] Apply suggestions from code review --- docs/develop/python/index.mdx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/develop/python/index.mdx b/docs/develop/python/index.mdx index b2695fbb10..65c8a29d83 100644 --- a/docs/develop/python/index.mdx +++ b/docs/develop/python/index.mdx @@ -14,11 +14,11 @@ tags: - python --- -This guide provides a comprehensive overview of the structures, primitives, and features used in [Temporal Application](/temporal#temporal-application) development. +These Temporal Python SDK feature guides aim to show how to use Temporal features when developing [Temporal Applications](/temporal#temporal-application). -## Core Application +## Core application -The Core Application section of the Develop with Temporal Python SDK covers the essential concepts and implementation details needed to build and run a Temporal Application. +The [Core Application feature guide](/develop/python/core-application) shows how to use the basic building blocks of a Temporal Application (Workflows, Activities, and Workers). - [Develop a Basic Workflow](/develop/python/core-application#develop-workflows) - [Develop a Basic Activity](/develop/python/core-application#develop-activities) @@ -27,25 +27,25 @@ The Core Application section of the Develop with Temporal Python SDK covers the ## Temporal Client -The Temporal Client section of the Develop with Temporal Python SDK describes how to use the Temporal Client to connect and start a Workflow Execution. +The [Temporal Client feature guide](/develop/python/temporal-client) shows how to connect to a Temporal Service and start a Workflow Execution. - [Connect to Development Temporal Service](/develop/python/temporal-clients#connect-to-development-service) - [Connect a Temporal Client to a Temporal Cluster](/develop/python/temporal-clients#connect-to-a-dev-cluster) - [Connect to Temporal Cloud](/develop/python/temporal-clients#connect-to-temporal-cloud) - [Start a Workflow Execution](/develop/python/temporal-clients#start-workflow-execution) -## Test Suites +## Testing suites -The Testing section of the Develop with Temporal Python SDK describes how to test your Temporal Application. +The [Testing suite feature guide](/develop/python/testing-suite) shows how to setup the testing suite and test Workflows and Activities. - [Test Frameworks](/develop/python/test-suites#test-frameworks) - [Testing Activities](/develop/python/test-suites#test-activities) - [Testing Workflows](/develop/python/test-suites#test-workflows) - [How to Replay a Workflow Execution](/develop/python/test-suites#replay) -## Failure Detection +## Failure detection -The Failure Detection section of the Develop with Temporal Python SDK describes how to configure timeouts and heartbeat intervals for Activities and Workflows. +The [Failure detection feature guide](/develop/python/failure-detection) shows how your application can detect failures using timeouts and automatically attempt to mitigate them with retries. - [Workflow Timeouts](/develop/python/failure-detection#workflow-timeouts) - [Set Activity Timeouts](/develop/python/failure-detection#activity-timeouts) @@ -53,7 +53,7 @@ The Failure Detection section of the Develop with Temporal Python SDK describes ## Messages -The Messages section of the Develop with Temporal Python SDK describes how to use the Temporal Client to send messages to a Workflow Execution. +The [Application messages feature guide](/develop/python/messages) shows how to send messages to and read the state of Workflow Executions. - [Develop with Signals](/develop/python/messages#signals) - [Develop with Queries](/develop/python/messages#queries) @@ -62,7 +62,7 @@ The Messages section of the Develop with Temporal Python SDK describes how to us ## Cancellation -The Cancellation section of the Develop with Temporal Python SDK describes how to cancel a Workflow Execution. +The [Cancellation feature guide](/develop/python/cancellation)shows how to cancel a Workflow Execution. - [Cancel an Activity from a Workflow](/develop/python/cancellation#cancel-an-activity) From ccf568060fb1abc9d02e305c795c9deffe950aa9 Mon Sep 17 00:00:00 2001 From: Cully Wakelin Date: Thu, 23 May 2024 11:37:48 -0600 Subject: [PATCH 20/26] landing page edits --- docs/develop/python/index.mdx | 24 ++++++++++++------------ docs/develop/python/timers.mdx | 2 -- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/develop/python/index.mdx b/docs/develop/python/index.mdx index 65c8a29d83..89de5e37d9 100644 --- a/docs/develop/python/index.mdx +++ b/docs/develop/python/index.mdx @@ -68,13 +68,13 @@ The [Cancellation feature guide](/develop/python/cancellation)shows how to cance ## Asynchronous Activity Completion -The Asynchronous Activity Completion section of the Develop with Temporal Python SDK describes how to complete Activities asynchronously. +The [Asynchronous Activity Completion feature guide](/develop/python/asynchronous-activity-completion) shows how to complete Activities asynchronously. - [Asynchronously Complete an Activity](/develop/python/asynchronous-activity-completion#asynchronously-complete-an-activity) ## Versioning -The Versioning section of the Temporal Developer's Guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. +The [Versioning feature guide](/develop/python/versioning) shows how to change Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. - [Introduction to Versioning](/develop/python/versioning#introduction-to-versioning) - [How to Use the Patching API](/develop/python/versioning#python-sdk-patching-api) @@ -82,7 +82,7 @@ The Versioning section of the Temporal Developer's Guide covers how to update Wo ## Observability -The Observability section of the Temporal Developer's Guide covers how to configure and use the Temporal Observability APIs. +The [Observability feature guide](/develop/python/observability) shows how to configure and use the Temporal Observability APIs. - [Emit Metrics](/develop/python/observability#metrics) - [Setup Tracing](/develop/python/observability#tracing) @@ -91,45 +91,45 @@ The Observability section of the Temporal Developer's Guide covers how to config ## Debugging -The Debugging section of the Temporal Developer's Guide covers the various ways to debug your application. +The [Debugging feature guide](/develop/python/debugging) covers the various ways to debug your application. - [Debugging](/develop/python/debugging#debug) ## Schedules -The Schedules section of the Develop with Temporal Python SDK covers how to schedule Workflows, run Workflows on a Cron, and configure Workflows to run on a delay. +The [Schedules feature guide](/develop/python/schedules) shows how to schedule Workflows, run Workflows on a Cron, and to delay the start of a Workflow. - [Schedule a Workflow](/develop/python/schedules#schedule-a-workflow) - [Temporal Cron Jobs](/develop/python/schedules#temporal-cron-jobs) - [Start Delay](/develop/python/schedules#start-delay) -## Data Encryption +## Data encryption -The Converters and Codecs section of the Temporal Developer's Guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. +The [Data encryption feature guide](/develop/python/data-encryption) provides guidance on how to support compression, encryption, and other data handling by implementing custom converters and codecs. - [Custom Payload Codec](/develop/python/data-encryption#custom-payload-codec) - [Payload Conversion](/develop/python/data-encryption#payload-conversion) ## Child Workflows -The Child Workflows section of the Develop with Temporal Python SDK covers how to spawn a Child Workflow Execution and handle Child Workflow Events. +The [Child Workflows feature guide](/develop/python/child-workflows) shows how to spawn a Child Workflow Execution and handle Child Workflow Events. - [Start a Child Workflow Execution](/develop/python/child-workflows) ## Continue-As-New -The Continue-As-New section of the Develop with Temporal Python SDK covers how to create a new Workflow Execution using the same Workflow ID as an existing Workflow Execution. +The [Continue-As-New featuer guide](/develop/python/continue-as-new) shows how to continue the Workflow Execution with a new Workflow Execution using the same Workflow ID. - [Continue-As-New](/develop/python/continue-as-new) ## Timers -The Timers section of the Develop with Temporal Python SDK covers how to use timers and sleeps within Workflows. +The [Durable Timers feature guide](/develop/python/timers) shows how to use Timers and sleep within Workflows. -- [What is a Timer](/develop/python/timers) +- [Sleep](/develop/python/timers) ## Interrupt a Workflow Execution -The Interrupt a Workflow Execution section of the Develop with Temporal Python SDK covers how to interrupt a Workflow Execution with a Cancel or Terminate action. +The [Interrupt a Workflow feature guide](/develop/python/interrupt-a-workflow-execution) shows how to interrupt a Workflow Execution with a Cancel or Terminate action. - [Interrupt a Workflow Execution](/develop/python/interrupt-a-workflow-execution) \ No newline at end of file diff --git a/docs/develop/python/timers.mdx b/docs/develop/python/timers.mdx index dbc18788ed..3c07a9875b 100644 --- a/docs/develop/python/timers.mdx +++ b/docs/develop/python/timers.mdx @@ -18,8 +18,6 @@ tags: - timers --- -## What is a Timer {#timers} - A Workflow can set a durable timer for a fixed time period. In some SDKs, the function is called `sleep()`, and in others, it's called `timer()`. From 5448a41c0cf4d6b71eb05893002a5b9325ea1516 Mon Sep 17 00:00:00 2001 From: Cully Wakelin Date: Thu, 23 May 2024 12:16:03 -0600 Subject: [PATCH 21/26] sm formatting for alignment across most of the guides --- .../asynchronous-activity-completion.mdx | 4 +-- docs/develop/python/cancellation.mdx | 4 +-- docs/develop/python/child-workflows.mdx | 6 +++- docs/develop/python/continue-as-new.mdx | 4 +-- docs/develop/python/core-application.mdx | 29 +++++++++---------- docs/develop/python/data-encryption.mdx | 4 +-- docs/develop/python/debugging.mdx | 9 ++++-- docs/develop/python/failure-detection.mdx | 20 +++++++------ docs/develop/python/interrupt-workflow.mdx | 4 +-- docs/develop/python/messages.mdx | 2 +- 10 files changed, 44 insertions(+), 42 deletions(-) diff --git a/docs/develop/python/asynchronous-activity-completion.mdx b/docs/develop/python/asynchronous-activity-completion.mdx index 1b3a5148e5..5e2dc434e8 100644 --- a/docs/develop/python/asynchronous-activity-completion.mdx +++ b/docs/develop/python/asynchronous-activity-completion.mdx @@ -21,9 +21,7 @@ tags: - asynchronous-completion --- -## Asynchronously complete an Activity - -**How to Asynchronously complete an Activity** +**How to Asynchronously complete an Activity using the Temporal Python SDK.** [Asynchronous Activity Completion](/activities#asynchronous-activity-completion) enables the Activity Function to return without the Activity Execution completing. diff --git a/docs/develop/python/cancellation.mdx b/docs/develop/python/cancellation.mdx index a2e6381f58..86fcedd991 100644 --- a/docs/develop/python/cancellation.mdx +++ b/docs/develop/python/cancellation.mdx @@ -21,9 +21,7 @@ tags: - cancellation --- -## Cancel an Activity from a Workflow {#cancel-an-activity} - -**How to cancel an Activity from a Workflow** +**How to cancel an Activity from a Workflow using the Temporal Python SDK.** Canceling an Activity from within a Workflow requires that the Activity Execution sends Heartbeats and sets a Heartbeat Timeout. If the Heartbeat is not invoked, the Activity cannot receive a cancellation request. diff --git a/docs/develop/python/child-workflows.mdx b/docs/develop/python/child-workflows.mdx index ee92521a0b..812fa5a2a1 100644 --- a/docs/develop/python/child-workflows.mdx +++ b/docs/develop/python/child-workflows.mdx @@ -20,10 +20,14 @@ tags: - child-workflows --- +This page shows how to do the following: + +- [Start a Child Workflow Execution](#child-workflows) +- [Set a Parent Close Policy](#parent-close-policy) ## Start a Child Workflow Execution {#child-workflows} -**How to start a Child Workflow Execution** +**How to start a Child Workflow Execution using the Temporal Python SDK.** A [Child Workflow Execution](/encyclopedia/child-workflows) is a Workflow Execution that is scheduled from within another Workflow using a Child Workflow API. diff --git a/docs/develop/python/continue-as-new.mdx b/docs/develop/python/continue-as-new.mdx index c86564d421..724dcfe6d2 100644 --- a/docs/develop/python/continue-as-new.mdx +++ b/docs/develop/python/continue-as-new.mdx @@ -18,9 +18,7 @@ tags: - continue-as-new --- -## Continue-As-New {#continue-as-new} - -**How to Continue-As-New** +**How to Continue-As-New using the Temporal Python SDK.** [Continue-As-New](/workflows#continue-as-new) enables a Workflow Execution to close successfully and create a new Workflow Execution in a single atomic operation if the number of Events in the Event History is becoming too large. The Workflow Execution spawned from the use of Continue-As-New has the same Workflow Id, a new Run Id, and a fresh Event History and is passed all the appropriate parameters. diff --git a/docs/develop/python/core-application.mdx b/docs/develop/python/core-application.mdx index 25edd0b357..dbe762875b 100644 --- a/docs/develop/python/core-application.mdx +++ b/docs/develop/python/core-application.mdx @@ -26,8 +26,7 @@ tags: - core-application --- -In this section you can find the following: - +This page shows how to do the following: - [Develop a basic Workflow](#develop-workflows) - [Define Workflow parameters](#workflow-parameters) @@ -47,7 +46,7 @@ In this section you can find the following: ## Develop a basic Workflow {#develop-workflows} -**How to develop a basic Workflow** +**How to develop a basic Workflow using the Temporal Python SDK.** Workflows are the fundamental unit of a Temporal Application, and it all starts with the development of a [Workflow Definition](/workflows#workflow-definition). @@ -82,7 +81,7 @@ class YourWorkflow: ### Define Workflow parameters {#workflow-parameters} -**How to define Workflow parameters** +**How to define Workflow parameters using the Temporal Python SDK.** Temporal Workflows may have any number of custom parameters. However, we strongly recommend that objects are used as parameters, so that the object's individual fields may be altered without breaking the signature of the Workflow. @@ -112,7 +111,7 @@ class YourParams: ### Define Workflow return parameters {#workflow-return-values} -**How to define Workflow return parameters** +**How to define Workflow return parameters using the Temporal Python SDK.** Workflow return values must also be serializable. Returning results, returning errors, or throwing exceptions is fairly idiomatic in each language that is supported. @@ -147,7 +146,7 @@ class YourWorkflow: ### Customize your Workflow Type {#workflow-type} -**How to customize your Workflow Type** +**How to customize your Workflow Type using the Temporal Python SDK.** Workflows have a Type that are referred to as the Workflow name. @@ -180,7 +179,7 @@ class YourWorkflow: ### Develop Workflow logic {#workflow-logic-requirements} -**How to develop Workflow logic** +**How to develop Workflow logic using the Temporal Python SDK.** Workflow logic is constrained by [deterministic execution requirements](/workflows#deterministic-constraints). Therefore, each language is limited to the use of certain idiomatic techniques. @@ -199,7 +198,7 @@ All API safe for Workflows used in the [`temporalio.workflow`](https://python.te ## Develop a basic Activity {#develop-activities} -**How to develop a basic Activity** +**How to develop a basic Activity using the Temporal Python SDK.** One of the primary things that Workflows do is orchestrate the execution of Activities. An Activity is a normal function or method execution that's intended to execute a single, well-defined action (either short or long-running), such as querying a database, calling a third-party API, or transcoding a media file. @@ -246,7 +245,7 @@ async def your_activity(input: YourParams) -> str: ### Develop Activity Parameters {#activity-parameters} -**How to develop Activity Parameters** +**How to develop Activity Parameters using the Temporal Python SDK.** There is no explicit limit to the total number of parameters that an [Activity Definition](/activities#activity-definition) may support. However, there is a limit to the total size of the data that ends up encoded into a gRPC message Payload. @@ -288,7 +287,7 @@ async def your_activity(input: YourParams) -> str: ### Define Activity return values {#activity-return-values} -**How to define Activity return values** +**How to define Activity return values using the Temporal Python SDK.** All data returned from an Activity must be serializable. @@ -340,7 +339,7 @@ async def your_activity(input: YourParams) -> str: ## Start an Activity Execution {#activity-execution} -**How to start an Activity Execution** +**How to start an Activity Execution using the Temporal Python SDK.** Calls to spawn [Activity Executions](/activities#activity-execution) are written within a [Workflow Definition](/workflows#workflow-definition). The call to spawn an Activity Execution generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command. @@ -390,7 +389,7 @@ class YourWorkflow: ### Set the required Activity Timeouts {#required-timeout} -**How to set the required Activity Timeouts** +**How to set the required Activity Timeouts using the Temporal Python SDK.** Activity Execution semantics rely on several parameters. The only required value that needs to be set is either a [Schedule-To-Close Timeout](/activities#start-to-close-timeout) or a [Start-To-Close Timeout](/activities#start-to-close-timeout). @@ -426,7 +425,7 @@ Available timeouts are: ### Get the results of an Activity Execution {#get-activity-results} -**How to get the results of an Activity Execution** +**How to get the results of an Activity Execution using the Temporal Python SDK.** The call to spawn an [Activity Execution](/activities#activity-execution) generates the [ScheduleActivityTask](/references/commands#scheduleactivitytask) Command and provides the Workflow with an Awaitable. Workflow Executions can either block progress until the result is available through the Awaitable or continue progressing, making use of the result when it becomes available. @@ -462,7 +461,7 @@ class YourWorkflow: ## Run a Worker Processes {#run-a-dev-worker} -**How to run a Worker Process** +**How to run a Worker Process using the Temporal Python SDK.** The [Worker Process](/workers#worker-process) is where Workflow Functions and Activity Functions are executed. @@ -510,7 +509,7 @@ if __name__ == "__main__": ### Register types {#register-types} -**How to register types** +**How to register types using the Temporal Python SDK.** All Workers listening to the same Task Queue name must be registered to handle the exact same Workflows Types and Activity Types. diff --git a/docs/develop/python/data-encryption.mdx b/docs/develop/python/data-encryption.mdx index 36c2fc5caf..738dc6ff6c 100644 --- a/docs/develop/python/data-encryption.mdx +++ b/docs/develop/python/data-encryption.mdx @@ -27,7 +27,7 @@ This page shows the following: ## Custom Payload Codec {#custom-payload-codec} -**How to use a custom Payload Codec in Python.** +**How to use a custom Payload Codec using Python with the Temporal Python SDK.** Custom Data Converters can change the default Temporal Data Conversion behavior by adding hooks, sending payloads to external storage, or performing different encoding steps. If you only need to change the encoding performed on your payloads -- by adding compression or encryption -- you can override the default Data Converter by creating a new `PayloadCodec`. @@ -102,7 +102,7 @@ When the Data Converter receives a value for conversion, it passes through each ### Custom Payload Converter {#custom-payload-converter} -**How to use a custom Payload Converter in Python.** +**How to use a custom Payload Converter using the Temporal Python SDK.** Data Converters convert raw Temporal payloads to/from actual Python types. A custom Data Converter of type `temporalio.converter.DataConverter` can be set via the `data_converter` client parameter. diff --git a/docs/develop/python/debugging.mdx b/docs/develop/python/debugging.mdx index f23d88d82e..1064526391 100644 --- a/docs/develop/python/debugging.mdx +++ b/docs/develop/python/debugging.mdx @@ -21,10 +21,15 @@ tags: - observability --- -## Debugging {#debug} +This page shows how to do the following: -### How to debug in a development environment {#debug-in-a-development-environment} + +### Debug in a development environment {#debug-in-a-development-environment} + +**How to debug in a development environment using the Temporal Python SDK.** + +When developing Workflows, you can use the normal development tools of logging and a debugger to see what’s happening in your Workflow. In addition to the normal development tools of logging and a debugger, you can also see what’s happening in your Workflow by using the [Web UI](/web-ui) or [Temporal CLI](/cli). ### How to debug in a development production {#debug-in-a-development-production} diff --git a/docs/develop/python/failure-detection.mdx b/docs/develop/python/failure-detection.mdx index 6cf009093b..7076d6f25e 100644 --- a/docs/develop/python/failure-detection.mdx +++ b/docs/develop/python/failure-detection.mdx @@ -23,18 +23,18 @@ tags: - heartbeats --- -In this section you can find the following: +This page shows how to do the following: -### Table of Contents - -- [Workflow timeouts](#workflow-timeouts) -- [Workflow retries](#workflow-retries) +- [Set Workflow timeouts](#workflow-timeouts) +- [set Workflow retries](#workflow-retries) - [Set Activity timeouts](#activity-timeouts) - [Set an Activity Retry Policy](#activity-retries) - [Heartbeat an Activity](#activity-heartbeats) ## Workflow timeouts {#workflow-timeouts} +**How to set Workflow timeouts using the Temporal Python SDK.** + Each Workflow timeout controls the maximum duration of a different aspect of a Workflow Execution. Workflow timeouts are set when [starting the Workflow Execution](#workflow-timeouts). @@ -75,6 +75,8 @@ Available timeouts are: ### Workflow retries {#workflow-retries} +**How to set a Workflow Retry Policy using the Temporal Python SDK.** + A Retry Policy can work in cooperation with the timeouts to provide fine controls to optimize the execution experience. Use a [Retry Policy](/retry-policies) to retry a Workflow Execution in the event of a failure. @@ -104,7 +106,7 @@ Set the Retry Policy to either the [`start_workflow()`](https://python.temporal. ## Set Activity timeouts {#activity-timeouts} -**How to set an Activity Execution Timeout** +**How to set an Activity Execution Timeout using the Temporal Python SDK.** Each Activity timeout controls the maximum duration of a different aspect of an Activity Execution. @@ -146,7 +148,7 @@ Available timeouts are: ### Set an Activity Retry Policy {#activity-retries} -**How to set an Activity Retry Policy** +**How to set an Activity Retry Policy using the Temporal Python SDK.** A Retry Policy works in cooperation with the timeouts to provide fine controls to optimize the execution experience. @@ -182,7 +184,7 @@ from temporalio.common import RetryPolicy ## Heartbeat an Activity {#activity-heartbeats} -**How to Heartbeat an Activity** +**How to Heartbeat an Activity using the Temporal Python SDK.** An [Activity Heartbeat](/activities#activity-heartbeat) is a ping from the [Worker Process](/workers#worker-process) that is executing the Activity to the [Temporal Cluster](/clusters). Each Heartbeat informs the Temporal Cluster that the [Activity Execution](/activities#activity-execution) is making progress and the Worker has not crashed. @@ -209,7 +211,7 @@ If an Activity calls `heartbeat(123, 456)` and then fails and is retried, `heart #### Set a Heartbeat Timeout {#heartbeat-timeout} -**How to set a Heartbeat Timeout** +**How to set a Heartbeat Timeout using the Temporal Python SDK.** A [Heartbeat Timeout](/activities#heartbeat-timeout) works in conjunction with [Activity Heartbeats](/activities#activity-heartbeat). diff --git a/docs/develop/python/interrupt-workflow.mdx b/docs/develop/python/interrupt-workflow.mdx index 17e1b6928a..415b8fa1bb 100644 --- a/docs/develop/python/interrupt-workflow.mdx +++ b/docs/develop/python/interrupt-workflow.mdx @@ -21,9 +21,7 @@ tags: - termination --- -## Interrupt a Workflow Execution {#interrupt-a-workflow-execution} - -**How to interrupt a Workflow Execution** +**How to interrupt a Workflow Execution using the Temporal Python SDK.** You can interrupt a Workflow Execution in one of the following ways: diff --git a/docs/develop/python/messages.mdx b/docs/develop/python/messages.mdx index cf127241ae..eddf7b4f9f 100644 --- a/docs/develop/python/messages.mdx +++ b/docs/develop/python/messages.mdx @@ -28,7 +28,7 @@ tags: - dynamic-handlers --- -This page shows the following: +This page shows how to do the following: - [Develop with Signals](#signals) - [Develop with Queries](#queries) From 0312057620ecfd9634bcabaa953f579392e9940c Mon Sep 17 00:00:00 2001 From: Cully Wakelin Date: Thu, 23 May 2024 12:18:07 -0600 Subject: [PATCH 22/26] updating redirects --- vercel.json | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/vercel.json b/vercel.json index e0a152b263..a97c1ec2e5 100644 --- a/vercel.json +++ b/vercel.json @@ -1946,18 +1946,10 @@ "source": "/kb/prometheus-grafana-setup", "destination": "/self-hosted-guide/monitoring" }, - { - "source": "/kb/python-sandbox-environment", - "destination": "/python/python-sandbox-environment" - }, { "source": "production-readiness/:path*", "destination": "/self-hosted-guide" }, - { - "source": "/kb/python-sandbox-environment", - "destination": "/python/python-sandbox-environment" - }, { "source": "/kb/cadence-to-temporal", "destination": "https://community.temporal.io/t/cadence-to-temporal-migration-highlights/" @@ -1991,11 +1983,15 @@ "destination": "/encyclopedia/go-sdk-multithreading" }, { - "source": "/develop/python/async-vs-sync", + "source": "/dev-guide/python/async-vs-sync", "destination": "/encyclopedia/python-sdk-sync-vs-async" }, { - "source": "/develop/python/sandbox", + "source": "/kb/python-sandbox-environment", + "destination": "/encyclopedia/python-sdk-sandbox" + }, + { + "source": "/dev-guide/python/sandbox", "destination": "/encyclopedia/python-sdk-sandbox" }, { From f02584e276455e799ad90dfaa38db2611394fae1 Mon Sep 17 00:00:00 2001 From: Cully Wakelin Date: Thu, 23 May 2024 12:23:25 -0600 Subject: [PATCH 23/26] links --- docs/develop/python/debugging.mdx | 2 +- docs/develop/python/index.mdx | 10 +++++----- .../python/{test-suites.mdx => testing-suite.mdx} | 3 +-- docs/encyclopedia/workflows.mdx | 2 +- sidebars.js | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) rename docs/develop/python/{test-suites.mdx => testing-suite.mdx} (99%) diff --git a/docs/develop/python/debugging.mdx b/docs/develop/python/debugging.mdx index 1064526391..a2a2085123 100644 --- a/docs/develop/python/debugging.mdx +++ b/docs/develop/python/debugging.mdx @@ -38,7 +38,7 @@ You can debug production Workflows using: - [Web UI](/web-ui) - [Temporal CLI](/cli) -- [Replay](/develop/python/test-suites#replay) +- [Replay](/develop/python/testing-suite#replay) - [Tracing](/develop/python/observability#tracing) - [Logging](/develop/python/observability#logging) diff --git a/docs/develop/python/index.mdx b/docs/develop/python/index.mdx index 89de5e37d9..9914dd401b 100644 --- a/docs/develop/python/index.mdx +++ b/docs/develop/python/index.mdx @@ -27,7 +27,7 @@ The [Core Application feature guide](/develop/python/core-application) shows how ## Temporal Client -The [Temporal Client feature guide](/develop/python/temporal-client) shows how to connect to a Temporal Service and start a Workflow Execution. +The [Temporal Client feature guide](/develop/python/temporal-clients) shows how to connect to a Temporal Service and start a Workflow Execution. - [Connect to Development Temporal Service](/develop/python/temporal-clients#connect-to-development-service) - [Connect a Temporal Client to a Temporal Cluster](/develop/python/temporal-clients#connect-to-a-dev-cluster) @@ -38,10 +38,10 @@ The [Temporal Client feature guide](/develop/python/temporal-client) shows how t The [Testing suite feature guide](/develop/python/testing-suite) shows how to setup the testing suite and test Workflows and Activities. -- [Test Frameworks](/develop/python/test-suites#test-frameworks) -- [Testing Activities](/develop/python/test-suites#test-activities) -- [Testing Workflows](/develop/python/test-suites#test-workflows) -- [How to Replay a Workflow Execution](/develop/python/test-suites#replay) +- [Test Frameworks](/develop/python/testing-suite#test-frameworks) +- [Testing Activities](/develop/python/testing-suite#test-activities) +- [Testing Workflows](/develop/python/testing-suite#test-workflows) +- [How to Replay a Workflow Execution](/develop/python/testing-suite#replay) ## Failure detection diff --git a/docs/develop/python/test-suites.mdx b/docs/develop/python/testing-suite.mdx similarity index 99% rename from docs/develop/python/test-suites.mdx rename to docs/develop/python/testing-suite.mdx index 9597671b61..2471d9df00 100644 --- a/docs/develop/python/test-suites.mdx +++ b/docs/develop/python/testing-suite.mdx @@ -1,9 +1,8 @@ --- -id: test-suites +id: testing-suite title: Test suites sidebar_label: Test suites description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. -slug: /develop/python/test-suites toc_max_heading_level: 2 keywords: - developer-guide diff --git a/docs/encyclopedia/workflows.mdx b/docs/encyclopedia/workflows.mdx index 9731fa6b30..fef246d68b 100644 --- a/docs/encyclopedia/workflows.mdx +++ b/docs/encyclopedia/workflows.mdx @@ -350,7 +350,7 @@ If a failure occurs, the Workflow Execution picks up where the last recorded eve - [How to use Replay APIs using the Go SDK](/dev-guide/go/testing#replay) - [How to use Replay APIs using the Java SDK](/dev-guide/java/testing#replay) -- [How to use Replay APIs using the Python SDK](/develop/python/test-suites#replay) +- [How to use Replay APIs using the Python SDK](/develop/python/testing-suite#replay) - [How to use Replay APIs using the TypeScript SDK](/dev-guide/typescript/testing#replay) ### Commands and awaitables diff --git a/sidebars.js b/sidebars.js index 14e06bee78..47f7005abd 100644 --- a/sidebars.js +++ b/sidebars.js @@ -118,7 +118,7 @@ module.exports = { items: [ "develop/python/core-application", "develop/python/temporal-clients", - "develop/python/test-suites", + "develop/python/testing-suite", "develop/python/failure-detection", "develop/python/messages", "develop/python/cancellation", From 746f9a49f8fa22bb23928f2aa6fdf28d525dc401 Mon Sep 17 00:00:00 2001 From: Cully Wakelin Date: Thu, 23 May 2024 12:56:10 -0600 Subject: [PATCH 24/26] fix unclosed escapes and broken anchors --- docs/develop/python/debugging.mdx | 7 +++++-- docs/develop/python/index.mdx | 6 +++--- docs/encyclopedia/activities.mdx | 2 +- docs/encyclopedia/visibility.mdx | 12 ++++++------ .../server-frontend-api-reference.mdx | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/develop/python/debugging.mdx b/docs/develop/python/debugging.mdx index a2a2085123..8310181cc3 100644 --- a/docs/develop/python/debugging.mdx +++ b/docs/develop/python/debugging.mdx @@ -23,7 +23,8 @@ tags: This page shows how to do the following: - +- [Debug in a development environment](#debug-in-a-development-environment) +- [Debug in a production environment](#debug-in-a-production-environment) ### Debug in a development environment {#debug-in-a-development-environment} @@ -32,7 +33,9 @@ This page shows how to do the following: When developing Workflows, you can use the normal development tools of logging and a debugger to see what’s happening in your Workflow. In addition to the normal development tools of logging and a debugger, you can also see what’s happening in your Workflow by using the [Web UI](/web-ui) or [Temporal CLI](/cli). -### How to debug in a development production {#debug-in-a-development-production} +### How to debug in a production environment {#debug-in-a-production-environment} + +**How to debug in a production environment using the Temporal Python SDK.** You can debug production Workflows using: diff --git a/docs/develop/python/index.mdx b/docs/develop/python/index.mdx index 9914dd401b..55e29295f4 100644 --- a/docs/develop/python/index.mdx +++ b/docs/develop/python/index.mdx @@ -64,13 +64,13 @@ The [Application messages feature guide](/develop/python/messages) shows how to The [Cancellation feature guide](/develop/python/cancellation)shows how to cancel a Workflow Execution. -- [Cancel an Activity from a Workflow](/develop/python/cancellation#cancel-an-activity) +- [Cancel an Activity from a Workflow](/develop/python/cancellation) ## Asynchronous Activity Completion The [Asynchronous Activity Completion feature guide](/develop/python/asynchronous-activity-completion) shows how to complete Activities asynchronously. -- [Asynchronously Complete an Activity](/develop/python/asynchronous-activity-completion#asynchronously-complete-an-activity) +- [Asynchronously Complete an Activity](/develop/python/asynchronous-activity-completion) ## Versioning @@ -93,7 +93,7 @@ The [Observability feature guide](/develop/python/observability) shows how to co The [Debugging feature guide](/develop/python/debugging) covers the various ways to debug your application. -- [Debugging](/develop/python/debugging#debug) +- [Debugging](/develop/python/debugging) ## Schedules diff --git a/docs/encyclopedia/activities.mdx b/docs/encyclopedia/activities.mdx index 0dd9280c82..11eb93bc54 100644 --- a/docs/encyclopedia/activities.mdx +++ b/docs/encyclopedia/activities.mdx @@ -485,7 +485,7 @@ How to complete an Activity Asynchronously in: - [Go](/dev-guide/go/features#asynchronous-activity-completion) - [Java](/dev-guide/java/features#asynchronous-activity-completion) - [PHP](/dev-guide/php/features#asynchronous-activity-completion) -- [Python](/develop/python/asynchronous-activity-completion#asynchronously-complete-an-activity) +- [Python](/develop/python/asynchronous-activity-completion) - [TypeScript](/dev-guide/typescript/features#asynchronous-activity-completion) #### When to use Async Completion diff --git a/docs/encyclopedia/visibility.mdx b/docs/encyclopedia/visibility.mdx index 4b36fc523d..00265bfa3c 100644 --- a/docs/encyclopedia/visibility.mdx +++ b/docs/encyclopedia/visibility.mdx @@ -36,7 +36,7 @@ The [Visibility store](/self-hosted-guide/visibility) in your Temporal Service s With Temporal Server v1.21, you can set up [Dual Visibility](#dual-visibility) to migrate your Visibility store from one database to another. -Support for separate standard and advanced Visibility setups will be deprecated from Temporal Server v1.21 onwards. Check [Supported databases](/self-hosted-guide/visibility) for updates. \*/} +Support for separate standard and advanced Visibility setups will be deprecated from Temporal Server v1.21 onwards. Check [Supported databases](/self-hosted-guide/visibility) for updates. ## What is standard Visibility? {#standard-visibility} @@ -114,7 +114,7 @@ List Filters support the following operators: The **ORDER BY** operator is currently not supported in Temporal Cloud. -Custom Search Attributes of the `Text` type cannot be used in **ORDER BY** clauses. \*/} +Custom Search Attributes of the `Text` type cannot be used in **ORDER BY** clauses. ### Partial string match @@ -197,7 +197,7 @@ WorkflowId IN ('', '') ```sql WorkflowId = '' and ExecutionStatus = 'Running' -```` +``` ```sql WorkflowId = '' or ExecutionStatus = 'Running' @@ -221,11 +221,11 @@ WorkflowType STARTS_WITH '' ```sql order by StartTime desc, CloseTime asc -```` +``` -````sql +```sql order by CustomIntField asc -``` */} +``` ## What is a Search Attribute? {#search-attribute} diff --git a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx index 2e3db89937..85b933d026 100644 --- a/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx +++ b/docs/production-deployment/self-hosted-guide/server-frontend-api-reference.mdx @@ -114,7 +114,7 @@ As soon as [this HTTP API proposal](https://github.com/temporalio/proposals/pull ::: -To view the API docs, run [`temporal server start-dev`](/cli/#starting-the-temporal-server) and open: +To view the API docs, run [`temporal server start-dev`](/cli#start-dev-server) and open: [`localhost:8233/openapi/`](http://localhost:8233/openapi/) From ab4d5580eb83b081d35ecc62aa8934fed4ff992c Mon Sep 17 00:00:00 2001 From: Cully Wakelin Date: Thu, 23 May 2024 15:00:12 -0600 Subject: [PATCH 25/26] slugs and links --- docs/components/Intro.js | 4 +- docs/components/SdkLogos.js | 2 +- docs/dev-guide/index.mdx | 2 +- .../python/durable-execution.mdx | 5 +- .../python/introduction.mdx | 1 - .../python/project-setup.mdx | 1 - .../asynchronous-activity-completion.mdx | 3 +- docs/develop/python/cancellation.mdx | 3 +- docs/develop/python/child-workflows.mdx | 3 +- docs/develop/python/continue-as-new.mdx | 3 +- docs/develop/python/core-application.mdx | 3 +- docs/develop/python/data-encryption.mdx | 1 - docs/develop/python/debugging.mdx | 3 +- docs/develop/python/failure-detection.mdx | 2 +- docs/develop/python/features.mdx | 1282 ----------------- docs/develop/python/index.mdx | 3 +- docs/develop/python/interrupt-workflow.mdx | 2 +- docs/develop/python/messages.mdx | 2 +- docs/develop/python/observability.mdx | 2 +- docs/develop/python/schedules.mdx | 2 +- docs/develop/python/testing-suite.mdx | 2 +- docs/develop/python/timers.mdx | 2 +- docs/develop/python/versioning.mdx | 2 +- docs/encyclopedia/temporal-sdks.mdx | 2 +- docs/evaluate/major-components.mdx | 2 +- 25 files changed, 23 insertions(+), 1316 deletions(-) rename docs/{develop => dev-guide}/python/durable-execution.mdx (97%) rename docs/{develop => dev-guide}/python/introduction.mdx (99%) rename docs/{develop => dev-guide}/python/project-setup.mdx (99%) delete mode 100644 docs/develop/python/features.mdx diff --git a/docs/components/Intro.js b/docs/components/Intro.js index da96713fd9..9ba9af368d 100644 --- a/docs/components/Intro.js +++ b/docs/components/Intro.js @@ -32,8 +32,8 @@ const appDevGuideLinks = [ name: "Java SDK developer's guide", }, { - path: "/dev-guide/python", - name: "Python SDK developer's guide", + path: "/develop/python", + name: "Python SDK feature guides", }, { path: "/dev-guide/typescript", diff --git a/docs/components/SdkLogos.js b/docs/components/SdkLogos.js index 773fdb2386..3bf0046c54 100644 --- a/docs/components/SdkLogos.js +++ b/docs/components/SdkLogos.js @@ -14,7 +14,7 @@ const supportedTech = [ class: "w-7 h-7", }, { - link: "/dev-guide/python", + link: "/develop/python", image: "/img/python.svg", alt: "Python logo", class: "w-7 h-7", diff --git a/docs/dev-guide/index.mdx b/docs/dev-guide/index.mdx index db0eb1ddbf..1b4499de6b 100644 --- a/docs/dev-guide/index.mdx +++ b/docs/dev-guide/index.mdx @@ -14,7 +14,7 @@ The Temporal SDK developer's guides are meant to provide a comprehensive overvie - Go SDK [developer's guide](/dev-guide/go) and [API reference](http://t.mp/go-api) - Java SDK [developer's guide](/dev-guide/java) and [API reference](http://t.mp/java-api) - PHP SDK [developer's guide](/dev-guide/php) and [API reference](https://php.temporal.io/namespaces/temporal.html) -- Python SDK [developer's guide](/dev-guide/python) and [API reference](https://python.temporal.io) +- Python SDK [developer's guide](/develop/python) and [API reference](https://python.temporal.io) - TypeScript SDK [developer's guide](/dev-guide/typescript) and [API reference](https://typescript.temporal.io) The following SDK does not yet have a developer's guide: diff --git a/docs/develop/python/durable-execution.mdx b/docs/dev-guide/python/durable-execution.mdx similarity index 97% rename from docs/develop/python/durable-execution.mdx rename to docs/dev-guide/python/durable-execution.mdx index c9817669de..3d1fbe8b09 100644 --- a/docs/develop/python/durable-execution.mdx +++ b/docs/dev-guide/python/durable-execution.mdx @@ -3,7 +3,6 @@ id: durable-execution title: Develop code that durably executes - Python SDK dev guide sidebar_label: Develop for durability description: The Durable Execution section of the Temporal Developer's guide covers advanced beginner concepts for working with Temporal, including testing your code, reviewing workflow event history, adding timers, and understanding determinism. Developing for durable execution is a core aspect of Temporal. -slug: /develop/python/durable-execution toc_max_heading_level: 4 keywords: - determinism @@ -62,7 +61,7 @@ The information in this chapter is also available in the [Temporal 102 course](h ::: -This chapter builds on the [Construct a new Temporal Application project](/develop/python/project-setup) chapter and relies on the Background Check use case and sample applications as a means to contextualize the information. +This chapter builds on the [Construct a new Temporal Application project](/dev-guide/python/project-setup) chapter and relies on the Background Check use case and sample applications as a means to contextualize the information. This chapter walks through the following sequence: @@ -360,7 +359,7 @@ You should expect to see the `TestReplayWorkflowHistoryFromFile` test fail. This is because the code we added creates new Events and alters the Event History sequence. To get this test to pass, we must get an updated Event History JSON file. -[Start a new Workflow](/develop/python/project-setup#start-workflow) and after it is complete [download the Event History as a JSON object](#retrieve-event-history). +[Start a new Workflow](/dev-guide/python/project-setup#start-workflow) and after it is complete [download the Event History as a JSON object](#retrieve-event-history). :::info Double check Task Queue names diff --git a/docs/develop/python/introduction.mdx b/docs/dev-guide/python/introduction.mdx similarity index 99% rename from docs/develop/python/introduction.mdx rename to docs/dev-guide/python/introduction.mdx index b5225cc895..42a15d78b2 100644 --- a/docs/develop/python/introduction.mdx +++ b/docs/dev-guide/python/introduction.mdx @@ -3,7 +3,6 @@ id: introduction title: Introduction to the Temporal Python SDK sidebar_label: Introduction description: Learn more about Temporal Python SDK. -slug: /develop/python/introduction toc_max_heading_level: 4 keywords: - guide-context diff --git a/docs/develop/python/project-setup.mdx b/docs/dev-guide/python/project-setup.mdx similarity index 99% rename from docs/develop/python/project-setup.mdx rename to docs/dev-guide/python/project-setup.mdx index 4282686cef..04d1b743ca 100644 --- a/docs/develop/python/project-setup.mdx +++ b/docs/dev-guide/python/project-setup.mdx @@ -3,7 +3,6 @@ id: project-setup title: Set up a Temporal Application project - Python SDK dev guide sidebar_label: Project setup description: The project setup section of the Temporal Python SDK Developer's guide covers the minimum set of concepts and implementation details needed to build and run a Temporal Application in Python—that is, all the relevant steps to start a Workflow Execution that executes an Activity. -slug: /develop/python/project-setup toc_max_heading_level: 4 keywords: - activity diff --git a/docs/develop/python/asynchronous-activity-completion.mdx b/docs/develop/python/asynchronous-activity-completion.mdx index 5e2dc434e8..a3c190a8d4 100644 --- a/docs/develop/python/asynchronous-activity-completion.mdx +++ b/docs/develop/python/asynchronous-activity-completion.mdx @@ -1,9 +1,8 @@ --- id: asynchronous-activity-completion -title: Asynchronous Activity Completion +title: Asynchronous Activity Completion - Python SDK feature guide sidebar_label: Asynchronous Activity Completion description: Complete an Activity without waiting for execution to finish, using Temporal Client and Activity Function. -slug: /develop/python/asynchronous-activity-completion toc_max_heading_level: 2 keywords: - asynchronous activity completion diff --git a/docs/develop/python/cancellation.mdx b/docs/develop/python/cancellation.mdx index 86fcedd991..fdc0d7112f 100644 --- a/docs/develop/python/cancellation.mdx +++ b/docs/develop/python/cancellation.mdx @@ -1,9 +1,8 @@ --- id: cancellation -title: Cancellation +title: Cancellation - Python SDK feature guide sidebar_label: Cancellation description: Cancel an Activity from a Workflow, sending Heartbeats and setting a Heartbeat Timeout, and handling cancellation errors. -slug: /develop/python/cancellation toc_max_heading_level: 2 keywords: - activity cancellation diff --git a/docs/develop/python/child-workflows.mdx b/docs/develop/python/child-workflows.mdx index 812fa5a2a1..a6914c8d20 100644 --- a/docs/develop/python/child-workflows.mdx +++ b/docs/develop/python/child-workflows.mdx @@ -1,9 +1,8 @@ --- id: child-workflows -title: Child Workflows +title: Child Workflows - Python SDK feature guide sidebar_label: Child Workflows description: Spawn a new Workflow from within another Workflow, with options for Parent Close Policy and handling Child Workflow Events. -slug: /develop/python/child-workflows toc_max_heading_level: 2 keywords: - child workflow execution diff --git a/docs/develop/python/continue-as-new.mdx b/docs/develop/python/continue-as-new.mdx index 724dcfe6d2..21006f512b 100644 --- a/docs/develop/python/continue-as-new.mdx +++ b/docs/develop/python/continue-as-new.mdx @@ -1,9 +1,8 @@ --- id: continue-as-new -title: Continue-As-New +title: Continue-As-New - Python SDK feature guide sidebar_label: Continue-As-New description: Close a Workflow Execution and create a new one with the same Workflow ID, new Run ID, and fresh Event History. -slug: /develop/python/continue-as-new toc_max_heading_level: 2 keywords: - continue-as-new workflow diff --git a/docs/develop/python/core-application.mdx b/docs/develop/python/core-application.mdx index dbe762875b..bb8ac2edb8 100644 --- a/docs/develop/python/core-application.mdx +++ b/docs/develop/python/core-application.mdx @@ -1,9 +1,8 @@ --- id: core-application -title: Core application +title: Core application - Python SDK feature guide sidebar_label: Core application description: Develop basic Temporal application with workflows & activities in Python using Temporal SDK. -slug: /develop/python/core-application toc_max_heading_level: 2 keywords: - temporal python core diff --git a/docs/develop/python/data-encryption.mdx b/docs/develop/python/data-encryption.mdx index 738dc6ff6c..0c031260b7 100644 --- a/docs/develop/python/data-encryption.mdx +++ b/docs/develop/python/data-encryption.mdx @@ -3,7 +3,6 @@ id: data-encryption title: Data encryption sidebar_label: Data encryption description: The Converters and Codecs section of the Temporal Developer's guide provides guidance on how to support compression, encryption, and other special data handling by implementing custom converters and codecs. -slug: /develop/python/data-encryption toc_max_heading_level: 2 keywords: - temporal python data encryption diff --git a/docs/develop/python/debugging.mdx b/docs/develop/python/debugging.mdx index 8310181cc3..8277176ab7 100644 --- a/docs/develop/python/debugging.mdx +++ b/docs/develop/python/debugging.mdx @@ -1,9 +1,8 @@ --- id: debugging -title: Debugging +title: Debugging - Python SDK feature guide sidebar_label: Debugging description: The Debugging section of the Temporal Developer's guide covers the many ways to debug your application. -slug: /develop/python/debugging toc_max_heading_level: 2 keywords: - debugging temporal python diff --git a/docs/develop/python/failure-detection.mdx b/docs/develop/python/failure-detection.mdx index 7076d6f25e..956f7e4c98 100644 --- a/docs/develop/python/failure-detection.mdx +++ b/docs/develop/python/failure-detection.mdx @@ -1,6 +1,6 @@ --- id: failure-detection -title: Failure detection +title: Failure detection - Python SDK feature guide sidebar_label: Failure detection Description: Guidance on setting timeouts, retries, and heartbeat functionality for Workflows and Activities in Python with Temporal. slug: /develop/python/failure-detection diff --git a/docs/develop/python/features.mdx b/docs/develop/python/features.mdx deleted file mode 100644 index 4715b9c858..0000000000 --- a/docs/develop/python/features.mdx +++ /dev/null @@ -1,1282 +0,0 @@ ---- -id: features -title: Features - Python SDK feature guide -sidebar_label: Features -description: The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. -toc_max_heading_level: 5 -keywords: - - activity - - child workflow - - client - - code sample - - continue-as-new - - cron - - developer-guide - - developer-guide-doc-type - - dynamic activity - - dynamic query - - dynamic signal - - dynamic workflow - - explanation - - guide-context - - how-to - - parent close policy - - python - - python sdk - - query - - retry policy - - schedule - - scheduled workflow execution - - schedules - - sdk - - signal - - signal with start - - sleep - - timeout - - timer - - timers - - update - - workflow - - workflow-execution -tags: - - activity - - child-workflow - - client - - code-sample - - continue-as-new - - cron - - developer-guide - - developer-guide-doc-type - - dynamic-activity - - dynamic-query - - dynamic-signal - - dynamic-workflow - - explanation - - guide-context - - how-to - - parent-close-policy - - python - - python-sdk - - query - - retry-policy - - schedule - - scheduled-workflow-execution - - schedules - - sdk - - signal - - signal-with-start - - sleep - - timeout - - timer - - timers - - update - - workflow - - workflow-execution ---- - -The Features section of the Temporal Developer's guide provides basic implementation guidance on how to use many of the development features available to Workflows and Activities in the Temporal Platform. - -In this section you can find the following: - -- [How to develop Signals](#signals) -- [How to develop Queries](#queries) -- [How to start a Child Workflow Execution](#child-workflows) -- [How to start a Temporal Cron Job](#temporal-cron-jobs) -- [How to use Continue-As-New](#continue-as-new) -- [How to set Workflow timeouts & retries](#workflow-timeouts) -- [How to set Activity timeouts & retries](#activity-timeouts) -- [How to Heartbeat an Activity](#activity-heartbeats) -- [How to Asynchronously complete an Activity](#asynchronous-activity-completion) -- [How to Schedule a Workflow](#schedule-a-workflow) -- [How to use a Temporal Cron Job](#temporal-cron-jobs) -- [How to use Start Delay](#start-delay) - -## How to develop with Signals {#signals} - -A [Signal](/workflows#signal) is a message sent to a running Workflow Execution. - -Signals are defined in your code and handled in your Workflow Definition. -Signals can be sent to Workflow Executions from a Temporal Client or from another Workflow Execution. - -A Signal has a name and can have arguments. - -- The name, also called a Signal type, is a string. -- The arguments must be serializable. - To define a Signal, set the Signal decorator [`@workflow.signal`](https://python.temporal.io/temporalio.workflow.html#signal) on the Signal function inside your Workflow. - -Non-dynamic methods can only have positional arguments. -Temporal suggests taking a single argument that is an object or data class of fields that can be added to as needed. - -Return values from Signal methods are ignored. - -**Customize names** - -You can have a name parameter to customize the Signal's name, otherwise it defaults to the name of the Signal method. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio import workflow -# ... -# ... - @workflow.signal - async def submit_greeting(self, name: str) -> None: - await self._pending_greetings.put(name) - - @workflow.signal - def exit(self) -> None: -# ... - @workflow.signal(name="Custom Signal Name") - async def custom_signal(self, name: str) -> None: - await self._pending_greetings.put(name) -``` - -Workflows listen for Signals by the Signal's name. - -To send a Signal to the Workflow, use the [signal](https://python.temporal.io/temporalio.client.WorkflowHandle.html#signal) method from the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -# ... -# ... - await handle.signal(GreetingWorkflow.submit_greeting, "User 1") -``` - -### How to send a Signal from a Temporal Client {#send-signal-from-client} - -When a Signal is sent successfully from the Temporal Client, the [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the Event History of the Workflow that receives the Signal. - -To send a Signal from the Client, use the [signal()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#signal) function on the Workflow handle. - -To get the Workflow handle, you can use any of the following options. - -- Use the [get_workflow_handle()](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle) method. -- Use the [get_workflow_handle_for()](https://python.temporal.io/temporalio.client.Client.html#get_workflow_handle_for) method to get a type-safe Workflow handle by its Workflow Id. -- Use the [start_workflow()](https://python.temporal.io/temporalio.client.Client.html#start_workflow) to start a Workflow and return its handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -# ... -# ... - client = await Client.connect("localhost:7233") - handle = await client.start_workflow( - GreetingWorkflow.run, - id="your-greeting-workflow", - task_queue="signal-tq", - ) - await handle.signal(GreetingWorkflow.submit_greeting, "User 1") -``` - -### How to send a Signal from a Workflow {#send-signal-from-workflow} - -A Workflow can send a Signal to another Workflow, in which case it's called an _External Signal_. - -When an External Signal is sent: - -- A [SignalExternalWorkflowExecutionInitiated](/references/events#signalexternalworkflowexecutioninitiated) Event appears in the sender's Event History. -- A [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the recipient's Event History. - -Use [`get_external_workflow_handle_for`](https://python.temporal.io/temporalio.workflow.html#get_external_workflow_handle_for) to get a typed Workflow handle to an existing Workflow by its identifier. -Use [`get_external_workflow_handle`](https://python.temporal.io/temporalio.workflow.html#get_external_workflow_handle) when you don't know the type of the other Workflow. - -:::note - -The Workflow Type passed is only for type annotations and not for validation. - -::: - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn -class WorkflowB: - @workflow.run - async def run(self) -> None: - handle = workflow.get_external_workflow_handle_for(WorkflowA.run, "workflow-a") - await handle.signal(WorkflowA.your_signal, "signal argument") -``` - -### How to Signal-With-Start {#signal-with-start} - -Signal-With-Start is used from the Client. -It takes a Workflow Id, Workflow arguments, a Signal name, and Signal arguments. - -If there's a Workflow running with the given Workflow Id, it will be signaled. If there isn't, a new Workflow will be started and immediately signaled. - -To send a Signal-With-Start in Python, use the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) method and pass the `start_signal` argument with the name of your Signal. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.client import Client -# ... -# ... -async def main(): - client = await Client.connect("localhost:7233") - await client.start_workflow( - GreetingWorkflow.run, - id="your-signal-with-start-workflow", - task_queue="signal-tq", - start_signal="submit_greeting", - start_signal_args=["User Signal with Start"], - ) -``` - -## How to develop with Queries {#queries} - -A [Query](/workflows#query) is a synchronous operation that is used to get the state of a Workflow Execution. - -### How to define a Query {#define-query} - -A Query has a name and can have arguments. - -- The name, also called a Query type, is a string. -- The arguments must be [serializable](/dataconversion). - -To define a Query, set the Query decorator [`@workflow.query`](https://python.temporal.io/temporalio.workflow.html#query) on the Query function inside your Workflow. - -**Customize names** - -You can have a name parameter to customize the Query's name, otherwise it defaults to the name of the Query method. - -:::note - -You can either set the `name` or the `dynamic` parameter in a Query's decorator, but not both. - -::: - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.query - def greeting(self) -> str: - return self._greeting -``` - -### How to handle a Query {#handle-query} - -Queries are handled by your Workflow. - -Don’t include any logic that causes [Command](/workflows#command) generation within a Query handler (such as executing Activities). -Including such logic causes unexpected behavior. - -To send a Query to the Workflow, use the [`query`](https://python.temporal.io/temporalio.client.WorkflowHandle.html#query) method from the [`WorkflowHandle`](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - result = await handle.query(GreetingWorkflow.greeting) -``` - -### How to send a Query {#send-query} - -Queries are sent from a Temporal Client. - -To send a Query to a Workflow Execution from Client code, use the `query()` method on the Workflow handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - result = await handle.query(GreetingWorkflow.greeting) -``` - -## How to develop with Updates {#updates} - -An [Update](/workflows#update) is an operation that can mutate the state of a Workflow Execution and return a response. - -### How to define an Update {#define-update} - -Workflow Updates handlers are methods in your Workflow Definition designed to handle updates. -These updates can be triggered during the lifecycle of a Workflow Execution. - -**Define an Update Handler** - -To define an update handler, use the [@workflow.update](https://python.temporal.io/temporalio.workflow.html#update) decorator on a method within your Workflow. This decorator can be applied to both asynchronous and synchronous methods. - -- **Decorator Usage:** Apply `@workflow.update` to the method intended to handle updates. -- **Overriding:** If a method with this decorator is overridden, the overriding method should also be decorated with `@workflow.update`. -- **Validator Method:** Optionally, you can define a validator method for the update handler. This validator is specified using `@update_handler_method_name.validator` and is invoked before the update handler. -- **Method Parameters:** Update handlers should only use positional parameters. For non-dynamic methods, it's recommended to use a single parameter that is an object or data class, which allows for future expansion of fields. -- **Return Values:** The update handler can return a serializable value. This value is sent back to the caller of the update. - -```python -# ... - @workflow.update - async def update_workflow_status(self) -> str: - self.is_complete = True - return "Workflow status updated" -``` - -### How to send an Update from a Temporal Client {#send-update-from-client} - -To send a Workflow Update from a Temporal Client, call the [execute_update](https://python.temporal.io/temporalio.client.WorkflowHandle.html#execute_update) method on the [WorkflowHandle](https://python.temporal.io/temporalio.client.WorkflowHandle.html) class. - -```python -# ... - update_result = await handle.execute_update( - HelloWorldWorkflow.update_workflow_status - ) - print(f"Update Result: {update_result}") -``` - -## What is a Dynamic Handler {#dynamic-handler} - -Temporal supports Dynamic Workflows, Activities, Signals, and Queries. -These are unnamed handlers that are invoked if no other statically defined handler with the given name exists. - -Dynamic Handlers provide flexibility to handle cases where the names of Workflows, Activities, Signals, or Queries aren't known at run time. - -:::caution - -Dynamic Handlers should be used judiciously as a fallback mechanism rather than the primary approach. -Overusing them can lead to maintainability and debugging issues down the line. - -Instead, Workflows, Activities, Signals, and Queries should be defined statically whenever possible, with clear names that indicate their purpose. -Use static definitions as the primary way of structuring your Workflows. - -Reserve Dynamic Handlers for cases where the handler names are not known at compile time and need to be looked up dynamically at runtime. -They are meant to handle edge cases and act as a catch-all, not as the main way of invoking logic. - -::: - -### How to set a Dynamic Workflow {#set-a-dynamic-workflow} - -A Dynamic Workflow in Temporal is a Workflow that is invoked dynamically at runtime if no other Workflow with the same name is registered. -A Workflow can be made dynamic by adding `dynamic=True` to the `@workflow.defn` decorator. -You must register the Workflow with the [Worker](https://python.temporal.io/temporalio.worker.html) before it can be invoked. - -The Workflow Definition must then accept a single argument of type `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn(dynamic=True) -class DynamicWorkflow: - @workflow.run - async def run(self, args: Sequence[RawValue]) -> str: - name = workflow.payload_converter().from_payload(args[0].payload, str) - return await workflow.execute_activity( - default_greeting, - YourDataClass("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set a Dynamic Activity {#set-a-dynamic-activity} - -A Dynamic Activity in Temporal is an Activity that is invoked dynamically at runtime if no other Activity with the same name is registered. -An Activity can be made dynamic by adding `dynamic=True` to the `@activity.defn` decorator. -You must register the Activity with the [Worker](https://python.temporal.io/temporalio.worker.html) before it can be invoked. - -The Activity Definition must then accept a single argument of type `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.activity.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@activity.defn(dynamic=True) -async def dynamic_greeting(args: Sequence[RawValue]) -> str: - arg1 = activity.payload_converter().from_payload(args[0].payload, YourDataClass) - return ( - f"{arg1.greeting}, {arg1.name}!\nActivity Type: {activity.info().activity_type}" - ) -# ... -@workflow.defn -class GreetingWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_activity( - "unregistered_activity", - YourDataClass("Hello", name), - start_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set a Dynamic Signal {#set-a-dynamic-signal} - -A Dynamic Signal in Temporal is a Signal that is invoked dynamically at runtime if no other Signal with the same input is registered. -A Signal can be made dynamic by adding `dynamic=True` to the `@signal.defn` decorator. - -The Signal Handler should accept `self`, a string input, and a `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.signal(dynamic=True) - async def dynamic_signal(self, name: str, args: Sequence[RawValue]) -> None: - await self._pending_greetings.put(name) -``` - -### How to set a Dynamic Query {#set-a-dynamic-query} - -A Dynamic Query in Temporal is a Query that is invoked dynamically at runtime if no other Query with the same name is registered. -A Query can be made dynamic by adding `dynamic=True` to the `@query.defn` decorator. - -The Query Handler should accept `self`, a string name, and a `Sequence[temporalio.common.RawValue]`. -The [payload_converter()](https://python.temporal.io/temporalio.workflow.html#payload_converter) function is used to convert a `RawValue` object to the desired type. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - @workflow.query(dynamic=True) - def dynamic_query(self, input: str, args: Sequence[RawValue]) -> str: - return self._greeting -``` - -## Workflow timeouts {#workflow-timeouts} - -Each Workflow timeout controls the maximum duration of a different aspect of a Workflow Execution. - -Workflow timeouts are set when [starting the Workflow Execution](#workflow-timeouts). - -- **[Workflow Execution Timeout](/workflows#workflow-execution-timeout)** - restricts the maximum amount of time that a single Workflow Execution can be executed. -- **[Workflow Run Timeout](/workflows#workflow-run-timeout):** restricts the maximum amount of time that a single Workflow Run can last. -- **[Workflow Task Timeout](/workflows#workflow-task-timeout):** restricts the maximum amount of time that a Worker can execute a Workflow Task. - -Set the timeout to either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. - -Available timeouts are: - -- `execution_timeout` -- `run_timeout` -- `task_timeout` - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - result = await client.execute_workflow( - YourWorkflow.run, - "your timeout argument", - id="your-workflow-id", - task_queue="your-task-queue", - # Set Workflow Timeout duration - execution_timeout=timedelta(seconds=2), - # run_timeout=timedelta(seconds=2), - # task_timeout=timedelta(seconds=2), - ) -``` - -### Workflow retries {#workflow-retries} - -A Retry Policy can work in cooperation with the timeouts to provide fine controls to optimize the execution experience. - -Use a [Retry Policy](/retry-policies) to retry a Workflow Execution in the event of a failure. - -Workflow Executions do not retry by default, and Retry Policies should be used with Workflow Executions only in certain situations. - -Set the Retry Policy to either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - handle = await client.execute_workflow( - YourWorkflow.run, - "your retry policy argument", - id="your-workflow-id", - task_queue="your-task-queue", - retry_policy=RetryPolicy(maximum_interval=timedelta(seconds=2)), - ) -``` - -## How to set Activity timeouts {#activity-timeouts} - -Each Activity timeout controls the maximum duration of a different aspect of an Activity Execution. - -The following timeouts are available in the Activity Options. - -- **[Schedule-To-Close Timeout](/activities#schedule-to-close-timeout):** is the maximum amount of time allowed for the overall [Activity Execution](/activities#activity-execution). -- **[Start-To-Close Timeout](/activities#start-to-close-timeout):** is the maximum time allowed for a single [Activity Task Execution](/workers#activity-task-execution). -- **[Schedule-To-Start Timeout](/activities#schedule-to-start-timeout):** is the maximum amount of time that is allowed from when an [Activity Task](/workers#activity-task) is scheduled to when a [Worker](/workers#worker) starts that Activity Task. - -An Activity Execution must have either the Start-To-Close or the Schedule-To-Close Timeout set. - -Activity options are set as keyword arguments after the Activity arguments. - -Available timeouts are: - -- schedule_to_close_timeout -- schedule_to_start_timeout -- start_to_close_timeout - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - activity_timeout_result = await workflow.execute_activity( - your_activity, - YourParams(greeting, "Activity Timeout option"), - # Activity Execution Timeout - start_to_close_timeout=timedelta(seconds=10), - # schedule_to_start_timeout=timedelta(seconds=10), - # schedule_to_close_timeout=timedelta(seconds=10), - ) -``` - -### How to set an Activity Retry Policy {#activity-retries} - -A Retry Policy works in cooperation with the timeouts to provide fine controls to optimize the execution experience. - -Activity Executions are automatically associated with a default [Retry Policy](/retry-policies) if a custom one is not provided. - -To create an Activity Retry Policy in Python, set the [RetryPolicy](https://python.temporal.io/temporalio.common.RetryPolicy.html) class within the [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) or [`execute_activity()`](https://python.temporal.io/temporalio.workflow.html#execute_activity) function. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.common import RetryPolicy -# ... - activity_result = await workflow.execute_activity( - your_activity, - YourParams(greeting, "Retry Policy options"), - start_to_close_timeout=timedelta(seconds=10), - # Retry Policy - retry_policy=RetryPolicy( - backoff_coefficient=2.0, - maximum_attempts=5, - initial_interval=timedelta(seconds=1), - maximum_interval=timedelta(seconds=2), - # non_retryable_error_types=["ValueError"], - ), - ) -``` - -## How to Heartbeat an Activity {#activity-heartbeats} - -An [Activity Heartbeat](/activities#activity-heartbeat) is a ping from the [Worker Process](/workers#worker-process) that is executing the Activity to the [Temporal Cluster](/clusters). -Each Heartbeat informs the Temporal Cluster that the [Activity Execution](/activities#activity-execution) is making progress and the Worker has not crashed. -If the Cluster does not receive a Heartbeat within a [Heartbeat Timeout](/activities#heartbeat-timeout) time period, the Activity will be considered failed and another [Activity Task Execution](/workers#activity-task-execution) may be scheduled according to the Retry Policy. - -Heartbeats may not always be sent to the Cluster—they may be [throttled](/activities#throttling) by the Worker. - -Activity Cancellations are delivered to Activities from the Cluster when they Heartbeat. Activities that don't Heartbeat can't receive a Cancellation. -Heartbeat throttling may lead to Cancellation getting delivered later than expected. - -Heartbeats can contain a `details` field describing the Activity's current progress. -If an Activity gets retried, the Activity can access the `details` from the last Heartbeat that was sent to the Cluster. - -To Heartbeat an Activity Execution in Python, use the [`heartbeat()`](https://python.temporal.io/temporalio.activity.html#heartbeat) API. - -```python -@activity.defn -async def your_activity_definition() -> str: - activity.heartbeat("heartbeat details!") -``` - -In addition to obtaining cancellation information, Heartbeats also support detail data that persists on the server for retrieval during Activity retry. -If an Activity calls `heartbeat(123, 456)` and then fails and is retried, `heartbeat_details` returns an iterable containing `123` and `456` on the next Run. - -#### How to set a Heartbeat Timeout {#heartbeat-timeout} - -A [Heartbeat Timeout](/activities#heartbeat-timeout) works in conjunction with [Activity Heartbeats](/activities#activity-heartbeat). - -[`heartbeat_timeout`](https://python.temporal.io/temporalio.worker.StartActivityInput.html#heartbeat_timeout) is a class variable for the [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) function used to set the maximum time between Activity Heartbeats. - -```python -workflow.start_activity( - activity="your-activity", - schedule_to_close_timeout=timedelta(seconds=5), - heartbeat_timeout=timedelta(seconds=1), -) -``` - -`execute_activity()` is a shortcut for [`start_activity()`](https://python.temporal.io/temporalio.workflow.html#start_activity) that waits on its result. - -To get just the handle to wait and cancel separately, use `start_activity()`. `execute_activity()` should be used in most cases unless advanced task capabilities are needed. - -```python -workflow.execute_activity( - activity="your-activity", - name, - schedule_to_close_timeout=timedelta(seconds=5), - heartbeat_timeout=timedelta(seconds=1), -) -``` - -## How to asynchronously complete an Activity {#asynchronous-activity-completion} - -[Asynchronous Activity Completion](/activities#asynchronous-activity-completion) enables the Activity Function to return without the Activity Execution completing. - -There are three steps to follow: - -1. The Activity provides the external system with identifying information needed to complete the Activity Execution. - Identifying information can be a [Task Token](/activities#task-token), or a combination of Namespace, Workflow Id, and Activity Id. -2. The Activity Function completes in a way that identifies it as waiting to be completed by an external system. -3. The Temporal Client is used to Heartbeat and complete the Activity. - -To mark an Activity as completing asynchronously, do the following inside the Activity. - -```python -# Capture token for later completion -captured_token = activity.info().task_token -activity.raise_complete_async() -``` - -To update an Activity outside the Activity, use the [get_async_activity_handle()](https://python.temporal.io/temporalio.client.Client.html#get_async_activity_handle) method to get the handle of the Activity. - -```python -handle = my_client.get_async_activity_handle(task_token=captured_token) -``` - -Then, on that handle, you can call the results of the Activity, `heartbeat`, `complete`, `fail`, or `report_cancellation` method to update the Activity. - -```python -await handle.complete("Completion value.") -``` - -## Cancel an Activity from a Workflow {#cancel-an-activity} - -Canceling an Activity from within a Workflow requires that the Activity Execution sends Heartbeats and sets a Heartbeat Timeout. -If the Heartbeat is not invoked, the Activity cannot receive a cancellation request. -When any non-immediate Activity is executed, the Activity Execution should send Heartbeats and set a [Heartbeat Timeout](/activities#heartbeat-timeout) to ensure that the server knows it is still working. - -When an Activity is canceled, an error is raised in the Activity at the next available opportunity. -If cleanup logic needs to be performed, it can be done in a `finally` clause or inside a caught cancel error. -However, for the Activity to appear canceled the exception needs to be re-raised. - -:::note - -Unlike regular Activities, [Local Activities](/activities#local-activity) can be canceled if they don't send Heartbeats. -Local Activities are handled locally, and all the information needed to handle the cancellation logic is available in the same Worker process. - -::: - -To cancel an Activity from a Workflow Execution, call the [cancel()](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.cancel) method on the Activity handle that is returned from [start_activity()](https://python.temporal.io/temporalio.workflow.html#start_activity). - -```python -@activity.defn -async def cancellable_activity(input: ComposeArgsInput) -> NoReturn: - try: - while True: - print("Heartbeating cancel activity") - await asyncio.sleep(0.5) - activity.heartbeat("some details") - except asyncio.CancelledError: - print("Activity cancelled") - raise - -@activity.defn -async def run_activity(input: ComposeArgsInput): - print("Executing activity") - return input.arg1 + input.arg2 - -@workflow.defn - class GreetingWorkflow: - @workflow.run - async def run(self, input: ComposeArgsInput) -> None: - activity_handle = workflow.start_activity( - cancellable_activity, - ComposeArgsInput(input.arg1, input.arg2), - start_to_close_timeout=timedelta(minutes=5), - heartbeat_timeout=timedelta(seconds=30), - ) - - await asyncio.sleep(3) - activity_handle.cancel() -``` - -:::note - -The Activity handle is a Python task. -By calling `cancel()`, you're essentially requesting the task to be canceled. - -::: - -## How to interrupt a Workflow Execution {#interrupt-a-workflow-execution} - -You can interrupt a Workflow Execution in one of the following ways: - -- [Cancel](#cancel) -- [Terminate](#terminate) - -The following are the main differences between canceling and terminating a Workflow in Temporal: - -##### Cancel - -Canceling a Workflow provides a graceful way to stop Workflow Execution. -This action resembles sending a `SIGTERM` to a process. - -- The system records a `WorkflowExecutionCancelRequested` event in the Workflow History. -- A Workflow Task gets scheduled to process the cancelation. -- The Workflow code can handle the cancelation and execute any cleanup logic. -- The system doesn't forcefully stop the Workflow. - -For more information, see [How to cancel a Workflow Execution](#cancel-a-workflow-execution). - -##### Terminate - -Terminating a Workflow forcefully stops Workflow Execution. -This action resembles killing a process. - -- The system records a `WorkflowExecutionTerminated` event in the Workflow History. -- The termination forcefully and immediately stops the Workflow Execution. -- The Workflow code gets no chance to handle termination. -- A Workflow Task doesn't get scheduled. - -For more information, see [How to terminate a Workflow Execution](#terminate-a-workflow-execution). - -##### Summary - -In summary: - -- Canceling provides a graceful way to stop the Workflow and allows it to handle cancelation logic. -- Termination forcefully stops the Workflow and prevents any further events. - -In most cases, canceling is preferable because it allows the Workflow to finish gracefully. -Terminate only if the Workflow is stuck and cannot be canceled normally. - -### How to cancel a Workflow Execution in Python {#cancel-a-workflow-execution} - -To cancel a Workflow Execution in Python, use the [cancel()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#cancel) function on the Workflow handle. - -```python -await client.get_workflow_handle("your_workflow_id").cancel() -``` - -### How to terminate a Workflow Execution in Python {#terminate-a-workflow-execution} - -To terminate a Workflow Execution in Python, use the [terminate()](https://python.temporal.io/temporalio.client.WorkflowHandle.html#terminate) function on the Workflow handle. - -```python -await client.get_workflow_handle("your_workflow_id").terminate() -``` - -## How to start a Child Workflow Execution {#child-workflows} - -A [Child Workflow Execution](/encyclopedia/child-workflows) is a Workflow Execution that is scheduled from within another Workflow using a Child Workflow API. - -When using a Child Workflow API, Child Workflow related Events ([StartChildWorkflowExecutionInitiated](/references/events#startchildworkflowexecutioninitiated), [ChildWorkflowExecutionStarted](/references/events#childworkflowexecutionstarted), [ChildWorkflowExecutionCompleted](/references/events#childworkflowexecutioncompleted), etc...) are logged in the Workflow Execution Event History. - -Always block progress until the [ChildWorkflowExecutionStarted](/references/events#childworkflowexecutionstarted) Event is logged to the Event History to ensure the Child Workflow Execution has started. -After that, Child Workflow Executions may be abandoned using the default _Abandon_ [Parent Close Policy](/encyclopedia/child-workflows#parent-close-policy) set in the Child Workflow Options. - -To be sure that the Child Workflow Execution has started, first call the Child Workflow Execution method on the instance of Child Workflow future, which returns a different future. - -Then get the value of an object that acts as a proxy for a result that is initially unknown, which is what waits until the Child Workflow Execution has spawned. - -To spawn a Child Workflow Execution in Python, use the [`execute_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#execute_child_workflow) function which starts the Child Workflow and waits for completion or -use the [`start_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#start_child_workflow) function to start a Child Workflow and return its handle. -This is useful if you want to do something after it has only started, or to get the Workflow/Run ID, or to be able to signal it while running. - -:::note - -`execute_child_workflow()` is a helper function for `start_child_workflow()` plus `await handle`. - -::: - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn -class ComposeGreetingWorkflow: - @workflow.run - async def run(self, input: ComposeGreetingInput) -> str: - return f"{input.greeting}, {input.name}!" - -@workflow.defn -class GreetingWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_child_workflow( - ComposeGreetingWorkflow.run, - ComposeGreetingInput("Hello", name), - id="hello-child-workflow-workflow-child-id", -# ... - ) -``` - -#### How to set a Parent Close Policy {#parent-close-policy} - -A [Parent Close Policy](/encyclopedia/child-workflows#parent-close-policy) determines what happens to a Child Workflow Execution if its Parent changes to a Closed status (Completed, Failed, or Timed Out). - -The default Parent Close Policy option is set to terminate the Child Workflow Execution. - -Set the `parent_close_policy` parameter inside the [`start_child_workflow`](https://python.temporal.io/temporalio.workflow.html#start_child_workflow) function or the [`execute_child_workflow()`](https://python.temporal.io/temporalio.workflow.html#execute_child_workflow) function to specify the behavior of the Child Workflow when the Parent Workflow closes. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -from temporalio.workflow import ParentClosePolicy -# ... -# ... -@workflow.defn -class ComposeGreetingWorkflow: - @workflow.run - async def run(self, input: ComposeGreetingInput) -> str: - return f"{input.greeting}, {input.name}!" - -@workflow.defn -class GreetingWorkflow: - @workflow.run - async def run(self, name: str) -> str: - return await workflow.execute_child_workflow( - ComposeGreetingWorkflow.run, - ComposeGreetingInput("Hello", name), - id="hello-child-workflow-workflow-child-id", - parent_close_policy=ParentClosePolicy.ABANDON, - ) -``` - -## How to Continue-As-New {#continue-as-new} - -[Continue-As-New](/workflows#continue-as-new) enables a Workflow Execution to close successfully and create a new Workflow Execution in a single atomic operation if the number of Events in the Event History is becoming too large. -The Workflow Execution spawned from the use of Continue-As-New has the same Workflow Id, a new Run Id, and a fresh Event History and is passed all the appropriate parameters. - -To Continue-As-New in Python, call the [`continue_as_new()`](https://python.temporal.io/temporalio.workflow.html#continue_as_new) function from inside your Workflow, which will stop the Workflow immediately and Continue-As-New. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -@workflow.defn -class LoopingWorkflow: - @workflow.run - async def run(self, iteration: int) -> None: - if iteration == 5: - return - await asyncio.sleep(10) - workflow.continue_as_new(iteration + 1) -``` - -## What is a Timer? {#timers} - -A Workflow can set a durable timer for a fixed time period. -In some SDKs, the function is called `sleep()`, and in others, it's called `timer()`. - -A Workflow can sleep for months. -Timers are persisted, so even if your Worker or Temporal Cluster is down when the time period completes, as soon as your Worker and Cluster are back up, the `sleep()` call will resolve and your code will continue executing. - -Sleeping is a resource-light operation: it does not tie up the process, and you can run millions of Timers off a single Worker. - -To set a Timer in Python, call the [`asyncio.sleep()`](https://docs.python.org/3/library/asyncio-task.html#sleeping) function and pass the duration in seconds you want to wait before continuing. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - await asyncio.sleep(10) -``` - -## How to Schedule a Workflow {#schedule-a-workflow} - -Scheduling Workflows is a crucial aspect of any automation process, especially when dealing with time-sensitive tasks. By scheduling a Workflow, you can automate repetitive tasks, reduce the need for manual intervention, and ensure timely execution of your business processes - -Use any of the following action to help Schedule a Workflow Execution and take control over your automation process. - -### How to Create a Scheduled Workflow {#create} - -The create action enables you to create a new Schedule. When you create a new Schedule, a unique Schedule ID is generated, which you can use to reference the Schedule in other Schedule commands. - -To create a Scheduled Workflow Execution in Python, use the [create_schedule()](https://python.temporal.io/temporalio.client.Client.html#create_schedule) -asynchronous method on the Client. -Then pass the Schedule ID and the Schedule object to the method to create a Scheduled Workflow Execution. -Set the `action` parameter to `ScheduleActionStartWorkflow` to start a Workflow Execution. -Optionally, you can set the `spec` parameter to `ScheduleSpec` to specify the schedule or set the `intervals` parameter to `ScheduleIntervalSpec` to specify the interval. -Other options include: `cron_expressions`, `skip`, `start_at`, and `jitter`. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - - await client.create_schedule( - "workflow-schedule-id", - Schedule( - action=ScheduleActionStartWorkflow( - YourSchedulesWorkflow.run, - "my schedule arg", - id="schedules-workflow-id", - task_queue="schedules-task-queue", - ), - spec=ScheduleSpec( - intervals=[ScheduleIntervalSpec(every=timedelta(minutes=2))] - ), - state=ScheduleState(note="Here's a note on my Schedule."), - ), - ) -``` - -### How to Backfill a Scheduled Workflow {#backfill} - -The backfill action executes Actions ahead of their specified time range. This command is useful when you need to execute a missed or delayed Action, or when you want to test the Workflow before its scheduled time. - -To Backfill a Scheduled Workflow Execution in Python, use the [backfill()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#backfill) asynchronous -method on the Schedule Handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -import asyncio -from datetime import datetime, timedelta - -from temporalio.client import Client, ScheduleBackfill, ScheduleOverlapPolicy - -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - now = datetime.utcnow() - ( - await handle.backfill( - ScheduleBackfill( - start_at=now - timedelta(minutes=10), - end_at=now - timedelta(minutes=9), - overlap=ScheduleOverlapPolicy.ALLOW_ALL, - ), - ), - ) -``` - -### How to Delete a Scheduled Workflow {#delete} - -The delete action enables you to delete a Schedule. When you delete a Schedule, it does not affect any Workflows that were started by the Schedule. - -To delete a Scheduled Workflow Execution in Python, use the [delete()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#delete) asynchronous method on the Schedule Handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - await handle.delete() -``` - -### How to Describe a Scheduled Workflow {#describe} - -The describe action shows the current Schedule configuration, including information about past, current, and future Workflow Runs. This command is helpful when you want to get a detailed view of the Schedule and its associated Workflow Runs. - -To describe a Scheduled Workflow Execution in Python, use the [describe()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#delete) asynchronous method on the Schedule Handle. -You can get a complete list of the attributes of the Scheduled Workflow Execution from the [ScheduleDescription](https://python.temporal.io/temporalio.client.ScheduleDescription.html) class. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - desc = await handle.describe() - - print(f"Returns the note: {desc.schedule.state.note}") -``` - -### How to List a Scheduled Workflow {#list} - -The list action lists all the available Schedules. This command is useful when you want to view a list of all the Schedules and their respective Schedule IDs. - -To list all schedules, use the [list_schedules()](https://python.temporal.io/temporalio.client.Client.html#list_schedules) asynchronous method on the Client. -If a schedule is added or deleted, it may not be available in the list immediately. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main() -> None: - client = await Client.connect("localhost:7233") - async for schedule in await client.list_schedules(): - print(f"List Schedule Info: {schedule.info}.") -``` - -### How to Pause a Scheduled Workflow {#pause} - -The pause action enables you to pause and unpause a Schedule. When you pause a Schedule, all the future Workflow Runs associated with the Schedule are temporarily stopped. This command is useful when you want to temporarily halt a Workflow due to maintenance or any other reason. - -To pause a Scheduled Workflow Execution in Python, use the [pause()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#pause) asynchronous method on the Schedule Handle. -You can pass a `note` to the `pause()` method to provide a reason for pausing the schedule. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - await handle.pause(note="Pausing the schedule for now") -``` - -### How to Trigger a Scheduled Workflow {#trigger} - -The trigger action triggers an immediate action with a given Schedule. By default, this action is subject to the Overlap Policy of the Schedule. This command is helpful when you want to execute a Workflow outside of its scheduled time. - -To trigger a Scheduled Workflow Execution in Python, use the [trigger()](https://python.temporal.io/temporalio.client.ScheduleHandle.html#trigger) asynchronous method on the Schedule Handle. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... -async def main(): - client = await Client.connect("localhost:7233") - handle = client.get_schedule_handle( - "workflow-schedule-id", - ) - - await handle.trigger() -``` - -### How to Update a Scheduled Workflow {#update} - -The update action enables you to update an existing Schedule. This command is useful when you need to modify the Schedule's configuration, such as changing the start time, end time, or interval. - -Create a function that takes `ScheduleUpdateInput` and returns `ScheduleUpdate`. -To update a Schedule, use a callback to build the update from the description. -The following example updates the Schedule to use a new argument. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - async def update_schedule_simple(input: ScheduleUpdateInput) -> ScheduleUpdate: - schedule_action = input.description.schedule.action - - if isinstance(schedule_action, ScheduleActionStartWorkflow): - schedule_action.args = ["my new schedule arg"] - return ScheduleUpdate(schedule=input.description.schedule) -``` - -## How to use Temporal Cron Jobs {#temporal-cron-jobs} - -A [Temporal Cron Job](/workflows#temporal-cron-job) is the series of Workflow Executions that occur when a Cron Schedule is provided in the call to spawn a Workflow Execution. - -A Cron Schedule is provided as an option when the call to spawn a Workflow Execution is made. - -You can set each Workflow to repeat on a schedule with the `cron_schedule` option from either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods. - -
- - View the source code - {' '} - in the context of the rest of the application code. -
- -```python - -# ... - result = await client.execute_workflow( - CronWorkflow.run, - id="your-workflow-id", - task_queue="your-task-queue", - cron_schedule="* * * * *", - ) - print(f"Results: {result}") -``` - -## How to use Start Delay {#start-delay} - -Use the `start_delay` to schedule a Workflow Execution at a specific one-time future point rather than on a recurring schedule. - -Use the `start_delay` option in either the [`start_workflow()`](https://python.temporal.io/temporalio.client.Client.html#start_workflow) or [`execute_workflow()`](https://python.temporal.io/temporalio.client.Client.html#execute_workflow) asynchronous methods in the Client. - -```python -async def main(): - client = await Client.connect("localhost:7233") - - result = await client.execute_workflow( - YourWorkflow.run, - "your name", - id="your-workflow-id", - task_queue="your-task-queue", - start_delay=timedelta(hours=1, minutes=20, seconds=30) - ) - - print(f"Result: {result}") - -if __name__ == "__main__": - asyncio.run(main()) -``` diff --git a/docs/develop/python/index.mdx b/docs/develop/python/index.mdx index 55e29295f4..a1159e0c32 100644 --- a/docs/develop/python/index.mdx +++ b/docs/develop/python/index.mdx @@ -1,9 +1,8 @@ --- id: index -title: Temporal Python SDK Development Documentation +title: Temporal Python SDK development documentation sidebar_label: Python SDK description: Learn how to use the Temporal Python SDK. -slug: /dev-guide/python toc_max_heading_level: 4 keywords: - dev guide diff --git a/docs/develop/python/interrupt-workflow.mdx b/docs/develop/python/interrupt-workflow.mdx index 415b8fa1bb..57a0937fab 100644 --- a/docs/develop/python/interrupt-workflow.mdx +++ b/docs/develop/python/interrupt-workflow.mdx @@ -1,6 +1,6 @@ --- id: interrupt-a-workflow-execution -title: Interrupt a Workflow Execution +title: Interrupt a Workflow Execution - Python SDK feature guide sidebar_label: Interrupt a Workflow Execution description: Learn how to interrupt a Workflow Execution by canceling or terminating, including the differences and use cases for each method. slug: /develop/python/interrupt-a-workflow-execution diff --git a/docs/develop/python/messages.mdx b/docs/develop/python/messages.mdx index eddf7b4f9f..bf9248da9e 100644 --- a/docs/develop/python/messages.mdx +++ b/docs/develop/python/messages.mdx @@ -1,6 +1,6 @@ --- id: messages -title: Messages +title: Messages - Python SDK feature guide sidebar_label: Messages description: Explore using Signals in Temporal Python to send messages to Workflows, with details on defining, sending, and handling Signals, including customization options. slug: /develop/python/messages diff --git a/docs/develop/python/observability.mdx b/docs/develop/python/observability.mdx index f668f89f3b..c761b7371f 100644 --- a/docs/develop/python/observability.mdx +++ b/docs/develop/python/observability.mdx @@ -1,6 +1,6 @@ --- id: observability -title: Observability +title: Observability - Python SDK feature guide sidebar_label: Observability description: Learn about observability tools for Temporal applications, covering metrics, tracing, logging, and visibility to monitor and troubleshoot Workflows. slug: /develop/python/observability diff --git a/docs/develop/python/schedules.mdx b/docs/develop/python/schedules.mdx index e8dbd80468..6d3b7a30f1 100644 --- a/docs/develop/python/schedules.mdx +++ b/docs/develop/python/schedules.mdx @@ -1,6 +1,6 @@ --- id: schedules -title: Schedules +title: Schedules - Python SDK feature guide sidebar_label: Schedules description: Discover how to effectively Schedule Workflows in Temporal Python, covering creation, management, and operations like backfilling, deleting, and triggering Scheduled Workflows for precise automation timing. slug: /develop/python/schedules diff --git a/docs/develop/python/testing-suite.mdx b/docs/develop/python/testing-suite.mdx index 2471d9df00..6b8ca37447 100644 --- a/docs/develop/python/testing-suite.mdx +++ b/docs/develop/python/testing-suite.mdx @@ -1,6 +1,6 @@ --- id: testing-suite -title: Test suites +title: Testing suite - Python SDK feature guide sidebar_label: Test suites description: The Testing section of the Temporal Developer's guide covers the many ways to test the state of your Temporal Application; that is, ways to view which Workflow Executions are tracked by the Platform and the state of any given Workflow Execution, either currently or at points of an execution. toc_max_heading_level: 2 diff --git a/docs/develop/python/timers.mdx b/docs/develop/python/timers.mdx index 3c07a9875b..d198a78c85 100644 --- a/docs/develop/python/timers.mdx +++ b/docs/develop/python/timers.mdx @@ -1,6 +1,6 @@ --- id: timers -title: Timers +title: Timers - Python SDK feature guide sidebar_label: Timers description: Learn how to use timers within Temporal Workflows to delay execution, enabling durable and long-term scheduling of tasks that can persist even if the worker or cluster goes down. slug: /develop/python/timers diff --git a/docs/develop/python/versioning.mdx b/docs/develop/python/versioning.mdx index 5079f742c2..1045c05f44 100644 --- a/docs/develop/python/versioning.mdx +++ b/docs/develop/python/versioning.mdx @@ -1,6 +1,6 @@ --- id: versioning -title: Versioning +title: Versioning - Python SDK feature guide sidebar_label: Versioning description: The Versioning section of the Temporal Developer's guide covers how to update Workflow Definitions without causing non-deterministic behavior in current long-running Workflows. slug: /develop/python/versioning diff --git a/docs/encyclopedia/temporal-sdks.mdx b/docs/encyclopedia/temporal-sdks.mdx index a20d94b7eb..0e11e1ad58 100644 --- a/docs/encyclopedia/temporal-sdks.mdx +++ b/docs/encyclopedia/temporal-sdks.mdx @@ -59,7 +59,7 @@ Each Temporal SDK targets a specific programming language. - [Go SDK developer's guide](/dev-guide/go/) - [Java SDK developer's guide](/dev-guide/java/introduction) - [PHP SDK developer's guide](/dev-guide/php) -- [Python SDK developer's guide](/develop/python/introduction) +- [Python SDK developer's guide](/develop/python) - [TypeScript SDK developer's guide](/dev-guide/typescript/introduction) - [.NET SDK API reference](https://dotnet.temporal.io/) diff --git a/docs/evaluate/major-components.mdx b/docs/evaluate/major-components.mdx index 12c7ce51f7..c30cfb12da 100644 --- a/docs/evaluate/major-components.mdx +++ b/docs/evaluate/major-components.mdx @@ -34,7 +34,7 @@ Or jump straight into the SDK docs for your preferred language: - [Go SDK](/dev-guide/go) - [Java SDK](/dev-guide/java) - [PHP SDK](/dev-guide/php) -- [Python SDK](/dev-guide/python) +- [Python SDK](/develop/python) - [TypeScript SDK](/dev-guide/typescript) - [.NET SDK API reference](https://dotnet.temporal.io/) From 9a3de6b8e3ffbe94e344995c783fba1e2345deb6 Mon Sep 17 00:00:00 2001 From: Cully Date: Fri, 24 May 2024 07:09:57 -0600 Subject: [PATCH 26/26] Update docs/develop/python/index.mdx --- docs/develop/python/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/develop/python/index.mdx b/docs/develop/python/index.mdx index a1159e0c32..34d4461778 100644 --- a/docs/develop/python/index.mdx +++ b/docs/develop/python/index.mdx @@ -117,7 +117,7 @@ The [Child Workflows feature guide](/develop/python/child-workflows) shows how t ## Continue-As-New -The [Continue-As-New featuer guide](/develop/python/continue-as-new) shows how to continue the Workflow Execution with a new Workflow Execution using the same Workflow ID. +The [Continue-As-New feature guide](/develop/python/continue-as-new) shows how to continue the Workflow Execution with a new Workflow Execution using the same Workflow ID. - [Continue-As-New](/develop/python/continue-as-new)