Azure Automation runbook stops for no reason - azure

I created a runbook to process multiple partitions of my cube. I launched it and 3 hours later, it stops. There is no error message or warning and nothing in the output pane. The only message I have is this one
Exception
The job was evicted and subsequently reached a Stopped state. The job cannot continue running
I have absolutely no idea of the reason why it stopped.
Any idea ?

Azure Automation runbook can only run for 3 hours.
In order to share resources among all runbooks in the
cloud, Azure Automation will temporarily unload any job after it has
been running for three hours. During this time, jobs for
PowerShell-based runbooks are stopped and are not be restarted. The
job status shows Stopped. This type of runbook is always restarted
from the beginning since they don't support checkpoints.
https://learn.microsoft.com/en-us/azure/automation/automation-runbook-execution#fair-share

Related

Set-AzureRmSqlDatabase takes a long time in Azure Automation

We are using Azure SQL in our development environment and to reduce cost, we have created an Azure Automation runbook to scale down/up the Azure SQL instances. During working hours the databases are running with P2 and outside working hours they fall back to standard. This works fine, but there is a catch...
After a few days the runbook stopped working, because "the quota for the monthly total job run time has been reached". After some investigation it seems that the runbook takes about 30-45 minutes to complete.
I suspect that the runbook waits until the database is actually in the desired state. When I run the Set-AzureRmSqlDatabase from the command-line, then it returns immediately. How can I reproduce this with Azure Automation?
I am using the Scale an Azure SQL DB to a specified edition and tier from the Automation Gallery. Maybe I could create a custom script, but I would rather use standard scripts...

Does the same job will run if web job run on multiple instance?

When I read the documentation for azure WebJobs, it found below statement For Continuous WebJobs to run reliably and on all instances refer to image below
My WebJob workflow:
Need to prepare the report for the newly created user in my application at 12 AM EST and send me the report in Email in daily occurrence.This time is changeable by UI so I need to run job continuously to find and run schedule at selected time
My Question
If WebJob runs all instance say two instances in running now for my web app.
Will I receive two email such that WebJob in each instance prepare the report and send to me?
Will get only one email irrespective of how many WebJobs are running?
A Continuous WebJob by default runs on all instances of your App Service Plan.
Whether your WebJob will run twice depends on how you implemented it. A Service Bus Queue listening WebJob will only run a queue message once, no matter how many instances (though if it fails, it'll run more than once).
If you wish, you can also make the WebJob run on a single instance by including a settings.job file in your WebJob with the following content:
{
"is_singleton": true
}

Long running scheduled WebJob Aborted by Azure

I have a Azure Scheduled Web Job on Azure WebApp. Inside web job, it downloads the excel file from azure blob and read (25 - 30 k records in a file), then it iterate through loop to insert's records in database. Now, when we schedule (Schedule time: 18 hrs) first time the job ran successfully and processed all records from file without any interruptions (between this time site was accessing). But, next time it fails (Aborted) without any reason (No one was accessed site. may be in idle state).
WebJob Abort Status
There is no any indications when i looked into logs. However, first schedule ran successfully and shows success status later all are in Aborted status, Why?
Success
Also done with below settings in webapp:
stopping_wait_time - 3600
WEBJOBS_IDLE_TIMEOUT - 3600
SCM_COMMAND_IDLE_TIMEOUT - 121
Per Azure's documentation,
Always On. By default, web apps are unloaded if they are idle for some
period of time. This lets the system conserve resources. In Basic or
Standard mode, you can enable Always On to keep the app loaded all the
time. If your app runs continuous web jobs, you should enable Always
On, or the web jobs may not run reliably.
So there is no promise from Azure Web Apps for your WebJob to continue running more than 20 minutes. If you need to rely on that you'll need to enable Always On. To enable it. See below.
In the Azure Portal, navigate to your App Services.
Click Application Settings in the SETTINGS menu.
Turn Always On to on, then click Save.
Here the picture:
If you are using the free tier of Azure, maybe this thread will help you: How can I keep my Azure WebJob running without "Always On".

Azure Backup job fails because a backup or restore operation is currently running

Using Azure Backup the scheduled daily job fails every once in a while and a notification is sent:
Backup failure alert has been activated
Severity : Critical
Alert : Backup failure
Description : The operation attempted cannot be performed at this time because a backup or restore operation is currently running.
Recommended action(s) : Wait until the operation finishes or cancel the currently running operation, and then try again.
It seems two jobs are started at the same time. Why?
Also, where can I see the scheduled jobs to confirm that only one daily job is scheduled? For some reason I can't seem to find this information either in the Azure Portal nor the Microsoft Azure Backup client. Am I missing something?

Continious running Azure Webjob goes to sleep

We have a WebJob in our Azure website that was supposed to listen to some messages on Azure Service Bus (ASB), so based on that we were expecting to run a process continuously so that it can listen to bus messages and process them as soon as they arrive. so with this background we chose “Run continuously” as WebJobs’s schedule at deployment time.
After some time, it appears that the WebJob does not work! and as usual we checked the Azure portal in that environment and checked the status of the job and noticed that it is running!
But the observation was, as soon as we open the WebJob tab in the azure portal we could see that it says “Web Job Starting” and after a few seconds it says “Web job Running”!
Any ideas about this behaviour and how to fix it?
There is a setting in the Configure tab called “ALWAYS ON“ which it has a very bold message on top of it that says “Should be turned on if you have a job that runs continuously”.
Here is how this setting looks like:
I also have a blog post about this issue:
https://koukia.ca/microsoft-windows-azure-webjobs-and-how-to-keep-them-awake-16283c28f19f#.nentaowwo

Resources