16

In Azure, Once a Triggered Web Job has begun? What do we need to do - to stop it?

Background:

Our Web Job populates a Service Bus Queue that then scale out our worker roles - our worker roles are using a 3rd party API - and are getting errors. This is causing our queue to grow larger and larger - and creating more and more worker roles. This is expensive.

Simcha Khabinsky
  • 1,970
  • 2
  • 19
  • 34

5 Answers5

10

I'm not sure when this was added but I managed to kill the jobs via the Kudu Process Explorer.

https://[websitename].scm.azurewebsites.net/ProcessExplorer/

Wait for the process to appear and simply right click and kill process.

Talon
  • 3,466
  • 3
  • 32
  • 47
7

as Kobynet explained above we are using the kudu api and we have the following powershell snippet for stopping the proccess

    $username = $website.PublishingUsername
    $password = $website.PublishingPassword
    $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
    $ps = Invoke-RestMethod -Uri "$apiBaseUrl/processes" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method GET    
    $id = $($ps | where {$_.name -eq $jobname} ).id
    Invoke-RestMethod -Uri "$apiBaseUrl/processes/$id" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method DELETE    
    write-host "killed process $id"
Srgrn
  • 1,770
  • 16
  • 30
3

The best option we have found is to use KUDU api for getting list of processes, and then kill the desired webjob process.

Kobynet
  • 983
  • 11
  • 23
1

go to azure portal -> app service -> process explorer -> expand instance ->

Find CMD processes and expand to see which one is for the triggered webjob

Then select the process by clicking on the icon which will redirect to the page where you can stop

Click the stop button.

Abi
  • 26
  • 2
0

You can do by clicking on Restart button on the app service that hosts the webjob. it actually clear all jobs and you need to re-deploy.

Note: This button is available on the new portal "portal.azure.com" only but not the old one.

hope this helps.

Mostafa
  • 3,296
  • 2
  • 26
  • 43