天蓝色-安排网络作业 [英] azure - scheduling a webjob

查看:88
本文介绍了天蓝色-安排网络作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个Webjob,并且在对其进行测试时,我将其设置为手动触发.我对该功能感到满意,现在我希望将其设置为每30分钟运行一次.

我在发布文件(webjob-publish-settings.json)中设置了"runMode": "Continuous",并在其中包含了具有此设置的setings.job文件

{
  "schedule": "0 */30 * * * *"
}

我最初将其设置为如果更新则复制",然后上传了Webjob.在天蓝色的webjobs"部分中,我有一个针对此webjob的列表,type = continuous,其中显示了计划设置.

我不得不进行一些修改,然后再次上传,但是现在状态显示为"Pending Restart",计划信息已消失.我将settings.job文件更改为始终复制",但计划仍未显示.(仅适用于n/a)

此过程应该如何工作?

**更新

我仍然无法使它正常工作,在我的主程序文件中,我有这个

Task callTask = host.CallAsync(typeof(Functions).GetMethod("CreateQueueMessage"));
        callTask.Wait();

然后我有了一个webjob-publish-settings.json文件,

"runMode":按需"

最后是一个与此相关的settings.job文件

时间表":"0 0,15,30,45 * * * *"

所以我希望它现在每15分钟运行一次,但事实并非如此,时间表甚至不会在网络作业旁边显示

解决方案

如果您的目标是计划的WebJob,则不应将其部署为Continuous WebJob,这是非常不同的事情.连续Web作业适用于您的可执行文件启动且永不终止的情况.当您的exe启动,执行一项任务然后终止时,将使用触发的(和计划的)WebJob.

在连续的Web作业中,计划完全被忽略.

看到连续作业每分钟运行的原因是系统一直在尝试重新启动它,因为它希望它永远不会终止.

I've developed a webjob and while I've been testing it, I set it to be manually triggered. I'm happy with the functionality and now I want to set it to run every 30 minutes.

In the publish file (webjob-publish-settings.json) I set this "runMode": "Continuous" and I included a setings.job file with this setting

{
  "schedule": "0 */30 * * * *"
}

I initially set it to 'copy if newer' and I uploaded the webjob. In the azure webjobs section I had a listing for this webjob, type = continuous and it showed the schedule setting.

I've had to make some amendments and upload again but now the status says 'Pending Restart' and the schedule info has gone. I changed the settings.job file to 'copy always' but the schedule still isn't showing.(just n/a)

how is this process supposed to work ?

** UPDATE

I still cant get this to work, in my main program file I have this

Task callTask = host.CallAsync(typeof(Functions).GetMethod("CreateQueueMessage"));
        callTask.Wait();

I then have a webjob-publish-settings.json file with this

"runMode": "OnDemand"

and finally, a settings.job file with this

"schedule": "0 0,15,30,45 * * * *"

so I would expect it to run every 15 mins now, but it doesn't, the schedule doesn't even show up alongside the webjob

解决方案

If your goal is to have a scheduled WebJob, you should not be deploying it as a Continuous WebJob, which is a very different thing. Continuous WebJobs are for cases where you have an executable that starts and never terminates. Triggered (and scheduled) WebJobs are used when you have an exe that starts, performs one task, and then terminates.

The schedule is completely ignored in continuous WebJobs.

The reason you're seeing your Continuous job run every minute is that the system keeps trying to restart it, since it expects it to never terminate.

这篇关于天蓝色-安排网络作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆