0
votes

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

1
Ive checked in the sql server query profiler for the db and the webjob is running constantly, no schedule at all, so how on earth do you set a schedule ?proteus
changed the settings.job file to this "schedule": "0,30 * * * *" but it made no difference, its running every minute or so, crazy !proteus

1 Answers

2
votes

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.