Skip to main content

Deploying a sample worker

In this step, a sample worker container is used.

The sample container can handle two sample commands:

  • testCommand
  • testCommand2

The commands are handled with some sleep, and are then marked as completed.

Add worker to the configuration file

taskurai-tasks-sample/Taskurai.yaml
options:
taskurai:
subscriptionId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
resourceGroupName: rg-taskurai
location: westeurope
taskuraiName: TaskuraiSample
deployment:
deploySecrets: false
workers:
SampleWorker:
container:
imageName: taskurai-worker-sample
image: taskuraisample.azurecr.io/taskurai-worker-sample:latest
resourceAllocation: Cpu_0_25_Memory_0_5Gi
scaling:
scaleOutTaskCount: 100
minInstances: 0
maxInstances: 2
environment:
- name: ENV_VARIABLE_TEST
value: test123
commands:
- testCommand
- testCommand2
cleanupCompletedTasksAfterSeconds: 2592000

Deploy worker to Taskurai

taskurai worker deploy

Testing your setup

To verify that the worker has been successfully deployed to Taskurai, use the following command:

taskurai worker show --name SampleWorker

When the deployment is successful, you should see output similar to the following:

# Signed into Azure account
# Retrieved subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
# Retrieved resource group rg-taskurai

SampleWorker
├── General
│ └── ╭───────────────────────────────────────┬──────────────╮
│ │ Setting │ Value │
│ ├───────────────────────────────────────┼──────────────┤
│ │ Name │ SampleWorker │
│ │ Cleanup Completed Tasks After Seconds │ 2592000
│ │ Provisioning State │ Succeeded │
│ ╰───────────────────────────────────────┴──────────────╯
├── Container
│ └── ╭───────────────────────────┬─────────────────────────────────────────────────────────╮
│ │ Setting │ Value │
│ ├───────────────────────────┼─────────────────────────────────────────────────────────┤
│ │ Image Name │ taskurai-worker-sample │
│ │ Image │ taskuraisample.azurecr.io/taskurai-worker-sample:latest │
│ │ Resource Allocation │ Cpu_0_25_Memory_0_5Gi │
│ │ Server │ null │
│ │ User Name │ null │
│ │ Password Secret Reference │ null │
│ ╰───────────────────────────┴─────────────────────────────────────────────────────────╯
├── Scaling
│ └── ╭──────────────────────┬───────╮
│ │ Setting │ Value │
│ ├──────────────────────┼───────┤
│ │ Scale Out Task Count │ 100
│ │ Min Instances │ 0
│ │ Max Instances │ 2
│ ╰──────────────────────┴───────╯
├── Secrets
│ └── ╭─────────╮
│ │ Secrets │
│ ╰─────────╯
├── Environment
│ └── ╭───────────────────┬─────────────────┬─────────╮
│ │ Name │ SecretReference │ Value │
│ ├───────────────────┼─────────────────┼─────────┤
│ │ ENV_VARIABLE_TEST │ null │ test123 │
│ ╰───────────────────┴─────────────────┴─────────╯
└── Commands
└── ╭──────────────╮
│ Commands │
├──────────────┤
│ testCommand │
│ testCommand2 │
╰──────────────╯