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

Improving logic to cancel a running job #213

Merged
merged 3 commits into from
Jun 11, 2022
Merged

Improving logic to cancel a running job #213

merged 3 commits into from
Jun 11, 2022

Conversation

alfespa17
Copy link
Member

@alfespa17 alfespa17 commented Jun 11, 2022

The following request will cancel a running job and will prevent all pending job steps to continue executing.

PATCH {{server}}/api/v1/organization/{{organizationId}}/job/{{jobId}}

{
  "data": {
    "type": "job",
    "id": "{{jobId}}",
    "attributes": {
      "status": "cancelled"
    }
  }
}

Improving these logic:

  • When the job scheduler in the API checks the status cancelled it will mark all pending job steps as "cancelled" and delete the job context from quartz.
  • When the executor finishes executing a job step it will validate if the status of the job is cancelled

Limitation:

  • Once the job is running inside the executor the terraform spring boot starter does not allow to cancel any terraform operation and release the block in the backend storage.
  • The job step that is running wil be completed, for now it can not be completely cancelled.

@alfespa17 alfespa17 changed the title Adding logic to cancel a running job Adding more logic to cancel a running job Jun 11, 2022
@alfespa17 alfespa17 changed the title Adding more logic to cancel a running job Improving logic to cancel a running job Jun 11, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

4.7% 4.7% Coverage
0.0% 0.0% Duplication

@alfespa17 alfespa17 merged commit b1c6c21 into main Jun 11, 2022
@jcanizalez jcanizalez deleted the stop-job-logic branch June 14, 2022 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant