Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Stop a Triggered Web Job

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.

like image 391
Simcha Khabinsky Avatar asked Oct 29 '14 17:10

Simcha Khabinsky


2 Answers

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"
like image 191
Srgrn Avatar answered Sep 18 '22 13:09

Srgrn


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.

like image 40
Talon Avatar answered Sep 20 '22 13:09

Talon