简体   繁体   English

如何停止/取消正在运行的 Azure 网络作业?

[英]How to stop/cancel a running Azure webjob?

We've deployed an on demand Azure webjob and it is in an endless loop.我们已经部署了一个按需 Azure webjob,它处于无限循环中。 We figured out the bug, did a redeploy and that failed.我们找出了错误,进行了重新部署,但失败了。 So we deleted the old job and went to deploy it again but now the job won't start.所以我们删除了旧作业并再次部署它,但现在作业不会启动。 There is a file called triggeredJob.lock that I've tried to delete but it is in use and I believe that is what's causing the conflict.我试图删除一个名为 triggeredJob.lock 的文件,但它正在使用中,我相信这就是导致冲突的原因。

Is there a way to recycle the whole app to get this to stop and release the files?有没有办法回收整个应用程序以使其停止并释放文件?

Two solutions: 两种解决方案

The simplest is to just hit the Restart button in the Azure portal for the Web App that hosts your WebJob, giving a clean start to all processes. 最简单的方法是在Azure门户中单击“重新启动”按钮,以获取承载WebJob的Web应用程序,从而为所有进程提供干净的启动。

The more complex but less heavy weight is to go to your Web App's Kudu Console . 更复杂但重量更轻的是去你的Web App的Kudu控制台 From there, click on the Process Explorer tab. 从那里,单击Process Explorer选项卡。 Find the relevant WebJob process in the list, right click it and choose Kill. 在列表中找到相关的WebJob流程,右键单击它并选择Kill。

Here are the steps to Kill a Web Jobs in Azure, 以下是在Azure中杀死Web作业的步骤,

Kudu is the Tool in Azure to check Background process. Kudu是Azure中用于检查后台进程的工具。

Kudu URL Format: yourWebSite.scm.azurewebsites.net Kudu URL格式:yourWebSite.scm.azurewebsites.net

Sample URL: google.scm.azurewebsites.net 示例网址:google.scm.azurewebsites.net

Login to KUDU web site portal 登录KUDU网站门户

In Kudu - Select the Process option Menu option 在Kudu中 - 选择“处理选项菜单”选项

Select on Web Jobs – that suppose to be killed [Properties] 在Web作业上选择 - 假设被杀[属性]

Use Kill Option below, drag down to see the "KILL" button 使用下面的Kill Option,向下拖动以查看“KILL”按钮

Click on button "KILL", Killing of Process – Indicated [Red Color] 点击按钮“KILL”,杀死进程 - 指示[红色]

Once Process Killed Successfully, it will not be displayed. 一旦Process Killed Successfully,它将不会显示。

How ever the webjobs will be in Failed state. webjobs如何处于失败状态。

在此输入图像描述

Open App Service Configuration, create a WEBJOBS_STOPPED entry and set its value to 1 or 0. I think this is the easiest way!打开 App Service Configuration,创建一个 WEBJOBS_STOPPED 条目并将其值设置为 1 或 0。我认为这是最简单的方法!

Hope your issue resolved. 希望你的问题得到解决 In case if you stooped webjob and still looks like getting desired output. 如果你弯腰webjob仍然看起来像获得所需的输出。 For eg one webjob wrote to send emails after 1 hrs daily. 例如,一个webjob写道,每天1小时后发送电子邮件。 But after stopped it still sending emails. 但在停止后仍然发送电子邮件。 So if this is PRODUCTION it is not good practice to restart application. 因此,如果这是PRODUCTION,重新启动应用程序并不是一个好习惯。 You can do one thing go to app setting and keep always on setting to OFF. 你可以做一件事去app设置,并始终保持设置为OFF。 This will remove unnecessary running process for same webjob. 这将删除相同webjob的不必要的运行过程。

Hope this help 希望这有帮助

Regards Kunal 关心库纳尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM