Skip to content

Commit

Permalink
update Using Workers
Browse files Browse the repository at this point in the history
  • Loading branch information
liivw committed Dec 12, 2024
1 parent 3542159 commit 7ca5ad2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docs/developer-guides/using-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,17 @@ Get the Conductor Clojure package from [clojars](https://clojars.org/io.orkes/co

### Step 3: Write your worker logic

In general, workers can be instantiated from classes that implement the Worker interface, or that are annotated using a WorkerTask annotation or decorator, depending on the language. A worker in your project may look like this:
In general, workers can be instantiated from classes that implement the Worker interface, or that are annotated using a WorkerTask annotation or decorator, depending on the language.

All workers must have a task definition name, which will used for reference during task polling and execution. The task definition name may be different from the name of the function or method that the worker is responsible for.

A worker in your project may look like this:

<Tabs groupId="language">
<TabItem value="python" label="Python">

Create a Python worker by adding a @worker_task decorator to a function.

``` python
from conductor.client.worker.worker_task import worker_task

Expand All @@ -189,6 +195,8 @@ def greet(name: str) -> str:

<TabItem value="java" label="Java">

Create a Java worker by instantiating a class that implements the Worker interface. The @WorkerTask annotation takes the task definition name as an argument.

``` java
import com.netflix.conductor.sdk.workflow.task.InputParam;
import com.netflix.conductor.sdk.workflow.task.WorkerTask;
Expand Down Expand Up @@ -403,13 +411,13 @@ For more information on creating workers in your preferred language, refer to th
## Setting up the worker
To use the worker in a workflow, you must register the worker task to the Conductor server, set up authorized access, and launch your worker project.
To use the worker in a workflow, you should register the worker task to the Conductor server, set up authorized access, and launch your worker project.
The worker task cannot begin execution until the worker is connected to the Conductor server. If the workflow is run, the task will remain in the Scheduled status until the worker comes online to service the task.
### Register worker task
All worker tasks must be registered to the Conductor server, which is done by creating a task definition. Tasks can be defined in UI, using API, or SDK.
All worker tasks should be registered to the Conductor server, which is done by creating a task definition. The task definition contains configuration options for failure handling and expected input/output payloads. Tasks can be defined in UI, using API, or SDK.
**To define a worker task:**
Expand Down
Binary file modified static/img/using-workers/using_workers-add_task_to_workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/img/using-workers/using_workers-app_permissions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/img/using-workers/using_workers-application_roles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7ca5ad2

Please sign in to comment.