Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specs for start, stop & executions for Container Apps Jobs #22594

Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,25 @@
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$"
},
{
"name": "template",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rkmanda we have addressed some of the comments. For the others related to the operation names, the current names best define the operation behavior. Can you please proceed with merging this PR?

"in": "body",
"description": "Properties used to create a container apps job",
anandanthony marked this conversation as resolved.
Show resolved Hide resolved
"required": true,
"schema": {
"$ref": "#/definitions/JobExecutionTemplate"
}
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "Container Apps Jobs started successfully."
"description": "OK",
"schema": {
"$ref": "#/definitions/JobExecutionBase"
}
},
"202": {
"description": "OK",
Expand Down Expand Up @@ -383,7 +395,7 @@
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop": {
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop": {
"post": {
"tags": [
"Jobs"
Expand All @@ -407,6 +419,14 @@
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$"
},
{
"name": "jobExecutionName",
"in": "path",
"description": "Name of the Container Apps Job's Execution.",
anandanthony marked this conversation as resolved.
Show resolved Hide resolved
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$"
}
],
"responses": {
Expand All @@ -430,9 +450,136 @@
},
"x-ms-examples": {
"Terminate a Container Apps Job": {
"$ref": "./examples/Job_Stop.json"
"$ref": "./examples/Job__Stop_Execution.json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__

typo? (double underscore)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vinisoto yes, it was a typo.. fixed it.

}
},
"x-ms-long-running-operation": true,
"x-ms-long-running-operation-options": {
"final-state-via": "location"
}
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add the stopAll endpoint here and implement it to reduce overhead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trajkobal can we reuse this endpoint? If the customer does not give a payload consisting of the job executions to be stopped, we stop all? I believe we would have to rename the endpoint to "StopAll" just so their is no confusion and the payload will make sense then, that if we have a payload passed we will only stop those job executions.?
OR
we need a seperate endpoint /stopAll? The only concern with that is we would have 3 endpoints just for stop.

  • /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop
  • /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop
  • /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stopAll

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the difference between these two in this case?:

/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stopAll

I think it is clearer to have only /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop. If a the payload is empty, we stop all executions; and if the payload contains a list of executions, we stop only that ilst.

"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop": {
"post": {
"tags": [
"Jobs"
],
"summary": "Terminates execution of a running container apps job",
"operationId": "Job_terminateMultipleExecutions",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
},
{
"name": "jobName",
"in": "path",
"description": "Name of the Container Apps Job.",
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$"
},
{
"name": "jobExecutionName",
"in": "body",
"description": "List of all job executions that should be stopped.",
"required": true,
"schema": {
"$ref": "#/definitions/JobExecutionNamesCollection"
}
}
],
"responses": {
"200": {
"description": "Container Apps Jobs terminated successfully."
anandanthony marked this conversation as resolved.
Show resolved Hide resolved
},
"202": {
"description": "OK",
"headers": {
"Location": {
"type": "string"
}
}
},
"default": {
"description": "Common error response.",
"schema": {
"$ref": "./CommonDefinitions.json#/definitions/DefaultErrorResponse"
}
}
},
"x-ms-examples": {
"Terminate Multiple Container Apps Job": {
"$ref": "./examples/Job_Stop_Multiple.json"
}
},
"x-ms-long-running-operation": true,
"x-ms-long-running-operation-options": {
"final-state-via": "location"
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions": {
"post": {
"tags": [
"Jobs"
],
"summary": "Get a Container Apps Job's executions",
"operationId": "Job_Executions",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter"
},
{
"name": "jobName",
"in": "path",
"description": "Name of the Container Apps Job.",
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ContainerAppJobExecutions"
}
},
"202": {
"description": "OK",
"headers": {
"Location": {
"type": "string"
}
}
},
"default": {
"description": "Common error response.",
"schema": {
"$ref": "./CommonDefinitions.json#/definitions/DefaultErrorResponse"
}
}
},
"x-ms-examples": {
"Run a Container Apps Job": {
"$ref": "./examples/Job_Executions.json"
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
},
"x-ms-long-running-operation": true,
"x-ms-long-running-operation-options": {
"final-state-via": "location"
Expand Down Expand Up @@ -758,6 +905,169 @@
"description": "Number of parallel replicas of a job that can run at a given time.",
"format": "int32",
"type": "integer"
},
"JobExecutionBase": {
"description": "Container App's Job execution name.",
"type": "object",
"properties": {
"name": {
"description": "Job execution name.",
"type": "string"
},
"id": {
"description": "Job execution Id.",
"type": "string"
}
}
},
"JobExecution": {
"description": "Container Apps Jobs execution.",
"type": "object",
"properties": {
"name": {
"description": "Job execution Name.",
"type": "string"
},
"id": {
"description": "Job execution Id.",
"type": "string"
},
"type": {
"description": "Job Type.",
"type": "string"
},
"status": {
"description": "Current running State of the job",
"enum": [
"Running",
"Processing",
"Stopped",
"Degraded",
"Failed",
"Unknown"
],
"type": "string",
"readOnly": true,
"x-ms-enum": {
"name": "JobExecutionRunningState",
"modelAsString": true
}
},
"startTime": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

startTime

also add endTIme

"description": "Job execution start time.",
"format": "date-time",
"type": "string"
},
"template": {
"description": "Job's execution container.",
"$ref": "#/definitions/JobExecutionTemplate"
}
}
},
"ContainerAppJobExecutions": {
"description": "Container App executions collection ARM resource.",
"type": "object",
"properties": {
"value": {
"description": "Collection of resources.",
"type": "array",
"items": {
"$ref": "#/definitions/JobExecution"
}
},
"nextLink": {
"description": "Link to next page of resources.",
"type": "string",
"readOnly": true
}
},
"required": [
"value"
]
},
"JobExecutionNamesCollection": {
"description": "Container App executions names list.",
"required": [
"value"
],
"type": "object",
"properties": {
"value": {
"description": "Collection of resources.",
"type": "array",
"items": {
"$ref": "#/definitions/JobExecutionBase"
}
}
}
},
"JobExecutionTemplate": {
"description": "Job's execution template, containing container configuration for a job's execution",
"type": "object",
"properties": {
"containers": {
"description": "List of container definitions for the Container Apps Job.",
"type": "array",
"items": {
"$ref": "#/definitions/JobExecutionContainer"
},
"x-ms-identifiers": [
"name"
]
},
"initContainers": {
"description": "List of specialized containers that run before job containers.",
"type": "array",
"items": {
"$ref": "#/definitions/JobExecutionContainer"
},
"x-ms-identifiers": [
"name"
]
}
}
},
"JobExecutionContainer": {
"description": "Container Apps Jobs execution container definition.",
"type": "object",
"properties": {
"image": {
"description": "Container image tag.",
"type": "string"
},
"name": {
"description": "Custom container name.",
"type": "string"
},
"command": {
"description": "Container start command.",
"type": "array",
"items": {
"type": "string"
}
},
"args": {
"description": "Container start command arguments.",
"type": "array",
"items": {
"type": "string"
}
},
"env": {
"description": "Container environment variables.",
"type": "array",
"items": {
"$ref": "./CommonDefinitions.json#/definitions/EnvironmentVar"
},
"x-ms-identifiers": [
"name"
]
},
"resources": {
"$ref": "./CommonDefinitions.json#/definitions/ContainerResources",
"description": "Container resource requirements."
}
}
}
},
"securityDefinitions": {
Expand Down
Loading