Skip to content

Commit 4e2def7

Browse files
Merge pull request #276911 from Ratulac-Azure/ninpan/job
Edit "Add concept and how-to guide for job #274630"
2 parents fcfbb39 + f15265d commit 4e2def7

File tree

5 files changed

+406
-12
lines changed

5 files changed

+406
-12
lines changed

articles/spring-apps/basic-standard/quickstart-setup-log-analytics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ You can set up Azure Monitor Logs for your application in Azure Spring Apps to c
2525

2626
## Prerequisites
2727

28-
Complete the previous quickstart in this series: [Provision an Azure Spring Apps service](./quickstart-provision-service-instance.md).
28+
Complete the previous quickstart in this series: [Provision an Azure Spring Apps service instance](./quickstart-provision-service-instance.md).
2929

3030
#### [Portal](#tab/Azure-Portal)
3131

3232
## Create a Log Analytics workspace
3333

34-
To create a workspace, follow the steps in [Create a Log Analytics workspace in the Azure portal](../../azure-monitor/logs/quick-create-workspace.md).
34+
To create a workspace, follow the steps in [Create a Log Analytics workspace](../../azure-monitor/logs/quick-create-workspace.md).
3535

3636
## Set up Log Analytics for a new service
3737

@@ -50,7 +50,7 @@ In the wizard for creating an Azure Spring Apps service instance, you can config
5050
1. Fill out the form on the **Diagnostic setting** page:
5151

5252
- **Diagnostic setting name**: Set a unique name for the configuration.
53-
- **Logs** > **Categories**: Select **ApplicationConsole** and **SystemLogs**. For more information on log categories and contents, see [Create diagnostic settings to send Azure Monitor platform logs and metrics to different destinations](../../azure-monitor/essentials/diagnostic-settings.md).
53+
- **Logs** > **Categories**: Select **ApplicationConsole** and **SystemLogs**. For more information on log categories and contents, see [Diagnostic settings in Azure Monitor](../../azure-monitor/essentials/diagnostic-settings.md).
5454
- **Destination details**: Select **Send to Log Analytics workspace** and specify the Log Analytics workspace that you created previously.
5555

5656
:::image type="content" source="media/quickstart-setup-log-analytics/diagnostic-settings-edit-form.png" alt-text="Screenshot that shows an example of set-up diagnostic settings." lightbox="media/quickstart-setup-log-analytics/diagnostic-settings-edit-form.png":::
@@ -95,7 +95,7 @@ Setting up for a new service isn't applicable when you're using the Azure CLI.
9595
--query id --output tsv
9696
```
9797
98-
1. Configure the diagnostic settings. For more information on log categories and contents, see [Create diagnostic settings to send Azure Monitor platform logs and metrics to different destinations](../../azure-monitor/essentials/diagnostic-settings.md).
98+
1. Configure the diagnostic settings. For more information on log categories and contents, see [Diagnostic settings in Azure Monitor](../../azure-monitor/essentials/diagnostic-settings.md).
9999
100100
```azurecli
101101
az monitor diagnostic-settings create \
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: Job in Azure Spring Apps
3+
description: Learn more about the Job concept in Azure Spring Apps.
4+
author: KarlErickson
5+
ms.author: ninpan
6+
ms.service: spring-apps
7+
ms.topic: conceptual
8+
ms.date: 06/06/2024
9+
ms.custom: devx-track-java, devx-track-extended-java
10+
---
11+
12+
# Job in Azure Spring Apps (Preview)
13+
14+
> [!NOTE]
15+
> Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
16+
17+
**This article applies to:** ✔️ Java ✔️ C#
18+
19+
**This article applies to:** ❌ Basic/Standard ✔️ Enterprise
20+
21+
*Job* is a key concept in the resource model of Azure Spring Apps. Like *App* in Azure Spring Apps, both are considered resources managed within the service.
22+
23+
An *App* runs a workload continuously, whereas a *Job* enables customers to run workloads that complete within a finite duration. Examples of apps include web apps and background services that process input continuously. Examples of jobs include batch processes and on-demand tasks.
24+
25+
Spring developers who write jobs probably choose the Spring Batch framework or Spring Cloud Task. While Spring Batch excels in handling large-scale batch processing tasks, Spring Cloud Task is specialized for managing short-lived tasks with minimal overhead. You can run both types efficiently in Azure Spring Apps jobs to meet diverse requirements.
26+
27+
## Job execution
28+
29+
A *job execution* refers to the process of running a particular task or set of tasks defined within a job. It encompasses the entire lifecycle of executing those tasks, including initializing, processing, and completing the job according to its specifications.
30+
31+
A common lifecycle of a job execution in Azure Spring Apps is from `pending` and `running` to a termination status of `completed` or `failed`, depending on whether the execution finishes successfully.
32+
33+
Each time the job is executed, it adopts its preset configuration from the job, with certain aspects allowing for customization to accommodate different runs.
34+
35+
In nonparallel job execution, only one instance runs at a time. In parallel execution, multiple instances can run simultaneously.
36+
37+
## Configuration
38+
39+
The job establishes the default configuration used for each execution, encompassing elements like the user application source and trigger configuration. Each execution of the job inherits the configuration, enabling certain parameters to be overridden with new values for individual executions.
40+
41+
The following table shows the configuration in job level or job execution level:
42+
43+
| Property name | Scope | Notes |
44+
|------------------------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
45+
| Trigger type | Job | The manual trigger for public preview. More trigger types are planned for later. |
46+
| Parallelism | Job | The count of instances of the job that executes in the same time. The default value is 1. For parallel jobs, you can get the index of each instance through the `JOB_COMPLETION_INDEX` environment variable. |
47+
| Retry limit | Job | The maximum number of times a job attempts execution after encountering a failure or error. The default value is 0, which means the job doesn't retry if it fails. |
48+
| Timeout | Job | The maximum number of seconds to wait for a job to complete before its status is set to `failed`. You can leave it unset or set the value to 0, which means the job has no timeout. |
49+
| Arguments | Job/Execution | The value of arguments specified for the execution override of the job. |
50+
| Environment variables | Job/Execution | Variables in key-value pairs format. The environment variables specified at the job level are default values for each execution. The environment variables specified at the execution level have higher priority. You can specify environment variables when you start an execution to override the value at the job level. |
51+
| Secret environment variables | Job/Execution | Variables that contain credentials where the secret values are encrypted. |
52+
| CPU | Job/Execution | The value specified for the execution overrides the value specified for the job. |
53+
| Memory | Job/Execution | The value specified for the execution overrides the value specified for the job. |
54+
55+
The configuration at the job level applies when creating or updating the job resource. The configuration at the job execution level applies when starting a job execution.
56+
57+
## Next step
58+
59+
[How to manage and use jobs in the Azure Spring Apps Enterprise plan](how-to-manage-job.md)

articles/spring-apps/enterprise/how-to-job-log-streaming.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ Use the following command to assign an Azure role:
6565

6666
---
6767

68-
## List all instances in a job execution
68+
## View tail logs
69+
70+
This section provides examples of using the Azure CLI to produce tail logs.
71+
72+
### View tail logs for a specific instance
6973

7074
Every time a job is triggered, a new job execution is created. Also, depending on the parallelism setting for your job, several replicas or instances execute in parallel.
7175

@@ -79,11 +83,7 @@ az spring job execution instance list \
7983
--execution <job-execution-name>
8084
```
8185

82-
## View tail logs
83-
84-
This section provides examples of using the Azure CLI to produce tail logs.
85-
86-
### View tail logs for a specific instance
86+
You can get all instance names of the job execution from the output.
8787

8888
To view the tail logs for a specific instance, use the `az spring job logs` command with the `-i/--instance` argument, as shown in the following example:
8989

@@ -117,9 +117,15 @@ When you use the `-f/--follow` option to tail instant logs, the Azure Spring App
117117

118118
### Stream logs for a specific instance
119119

120-
Use the following command to stream logs for a specific instance:
120+
Use the following commands to get instance names and stream logs for a specific instance:
121121

122122
```azurecli
123+
az spring job execution instance list \
124+
--resource-group <resource-group-name> \
125+
--service <Azure-Spring-Apps-instance-name> \
126+
--job <job-name> \
127+
--execution <job-execution-name>
128+
123129
az spring job logs \
124130
--resource-group <resource-group-name> \
125131
--service <Azure-Spring-Apps-instance-name> \
@@ -158,7 +164,7 @@ Azure Spring Apps also enables you to access real-time job logs from a public ne
158164

159165
Use the following steps to enable a log streaming endpoint on the public network:
160166

161-
1. Select the Azure Spring Apps service instance deployed in your virtual network and then select **Networking** in the navigation menu.
167+
1. Select the Azure Spring Apps service instance deployed in your virtual network and then select **Networking** in the navigation pane.
162168

163169
1. Select the **Vnet injection** tab.
164170

0 commit comments

Comments
 (0)