I have a logic app which is triggered when a blob is added or modified. It checks every few minutes. Given that logic apps are charged for each run of the Trigger (I think), how can I stop the Trigger running at weekends? I can't see anything on here
You can create a azure timer trigger function with the cron expression to schedule the function run every Friday evening and call this api in the timer trigger function to disable your logic app.
For example, the cron expression could be:
59 59 23 * * Fri
Then create another timer trigger function with the cron expression to schedule the function run every Monday morning and call this api in the timer trigger function to enable your logic app.
For example, the cron expression could be:
0 0 0 * * Mon
Another solution:
You can add a condition after the blob trigger(before the actions which the logic will do), shown as below:
The expression of "dayOfWeek()" is:
dayOfWeek(utcNow())
In the response of dayOfWeek() method, Sunday --> 0, Monday --> 1.
So in the conditon above, most of the actions will just run on Monday to Friday. On Saturday and Sunday, you will just pay for the trigger but not for most of the actions in your logic app. But you need to pay attention to the time zone if use this solution. You an know more information about the pricing of logic app in this link.
By the way, I think the second solution may suit you better. Because in first solution we can't call the api easily in azure function, we have to get the access token(in implicit flow) before request the api.
You can also use Powershell to disable you Logic App. One option to run it is from Azure Functions with Managed identity, which you can give permissions to the required Logic Apps.
Set-AzLogicApp -ResourceGroupName "MyResourceGroup" -Name "MyLogicApp" -State Disabled -Force
And to enable, just switch the State option to "Enabled"
Related
I'm working on my app developed with codename one. Now I need to perform an action every 10 seconds to update: Is there a sort of timer-thread which run always in background every N seconds?
If you need that action to happen off the EDT you can use java.util.Timer. If you want that action to happen on the EDT (e.g. you need to show something in the UI you) can use UITimer.
Notice that the latter is Form specific which might be an advantage or disadvantage based on the app requirements. So if you change a Form the UITimer won't be bound and you would need to create a new one.
Is there a way to set a global variable/constant in .feature files in Behave?
For an analytical service, I have many scenarios like this one
Scenario: Some scenario
Given do some action
And wait for 90 seconds while the action results are ready
Then verifying some result
And recently the requirements has updated and the service can wait for a longer time. This requirement may be changed in future. Is there a way not to find and replace all the "wait for 90 seconds" but have some constant in a feature file that I can update in one place?
My current approach is to refactor the step into wait for a reasonable time while the action results are ready and set the constant of reasonable time in Python. But in this approach, it's not clear from the tests logs what is the reasonable time for a specific run.
Waiting a constant amount of time is bad practice
Correct scenario defininition should be:
Scenario: Some scenario
Given do some action
And wait for the action results are ready
Then verifying some result
In the step implementation of "wait for the action results are ready" an active wait must be made that will end when results are ready
I have this meter job for which I need to build some think time between certain HTTP Requests. But during those thinking time I still need to send a keep alive request on specific interval.
For example:
User login
get some profile information.
Then he start to do some work.
each unit of work is delayed by some random delay varying from 1 to 30 minutes.
During that time we still need to send to there server a ImAlive request at fix interval (like 5 minutes).
Once the thinking time is expired which could be at 17m12s for example, then the loop exit.
For simulate the delay you can use Runtime Controller which will be executed with given seconds you define the keep alive requests, inside Runtime Controller add Timer as Gaussian Random Timer to add delay between keep alive requests.
You can use While Controller with condition like:
${__groovy(${__time(,)} - ${TESTSTART.MS} < 1032000,)}
Where:
__time() function - returns current time in milliseconds since start of Unix epoch
${TESTSTART.MS} - pre-defined JMeter property where test start time lives
__groovy() function - allows execution of arbitrary Groovy code
1032000 - milliseconds representation of 17m12s - (17 * 60 + 12) * 1000
So children of the While Controller will be executed for 17 minutes and 12 seconds after test start. If needed you can add another condition just in case you want to exit the loop earlier. See Using the While Controller in JMeter guide for more details.
Apologies if this request is similar to others - I am new to JMeter and have searched for other relevants posts but couldn't find anything - or maybe I just didn't understand them!
I'm performance testing a system with a web based application. The front end system will be processing records submitted into the system via MQ - the front end allows the user to pick up a record from the queue, validate some detail, make changes and submit the changes.
There will be 20 users using the front end to do this message validation, update and submission.
Each user is expected to need 30 seconds to pick a message from queue, make changes and resubmit - so we are expecting 1 user to process 120 records/hour, so 20 users will be expected to process 2400 records/hour
The picking up the record off the queue, changing it and submitting the changes will be done via 3 individual web pages.
SO - think time across the 3 pages has been defined as 24 seconds (leaving 6 of the 30 second limit for rendering, server responses, db calls etc.)
However I don't know how to specify this within JMeter. From my reading I can see that I can add a Timer in as a parent to a sampler and I assume I can add a Timer in as a parent of the Recording Controller? - but I need to be able to specify that the 24 second think time is spread across those 3 different pages.
I read a post elsewhere suggesting that if I record using the proxy after adding the Gaussian Random Timer in as a child of the Test Plan (parent to everything else) then the http proxy will record the think time as a ${T} variable in the Gaussian Random Timer - I tried this and this didn't work (also I don't want to rely on this - I'd like to be able to understand and make changes to think time properly rather than relying on JMETER to do it for me.)
To reiterate - 20 users, 30 seconds for 1 user to complete a transaction, TT defined as 24 seconds - I am struggling what Timer to use, where to put it so that the think-time is spread across the samplers that equate to the GETS associated with the 3 pages the user will navigate through.
Apologies for the lengthy post - I just wanted to be clear and concise.
Many thanks in advance,
As per JMeter Timers documentation
Note that timers are processed before each sampler in the scope in which they are found; if there are several timers in the same scope, all the timers will be processed before each sampler.
Timers are only processed in conjunction with a sampler. A timer which is not in the same scope as a sampler will not be processed at all.
To apply a timer to a single sampler, add the timer as a child element of the sampler. The timer will be applied before the sampler is executed. To apply a timer after a sampler, either add it to the next sampler, or add it as the child of a Test Action Sampler.
Now regarding "what timer to use"
There are 2 scenarios:
Virtual-User-oriented scenario - when you try to simulate N users working together
Goal-Oriented-scenario - when you try to produce N hits per second load.
In case of scenario 1 even Constant Timer can be quite enough, besides it will provide repeatability of results. See above quote for information on where to put your timer(s)
In case of scenario 2 you'll need Constant Throughput Timer. If 20 users process 2400 records per hour and each record assumes 3 web page calls, it means that 7200 requests will be made in one hour which in its turn stands for 120 requests per minute (this is what you should enter into the timer's "throughput" area) or 2 requests per second.
I have a service that is being monitored during normal business hours but, occasionally, the service will go Critical at the last minute. This Critical status will carry on through non-business hours.
Is there a setting to change the value outside of this timeperiod? Or does anyone have scripts that I can throw into cron to mark certain services as OK when outside of their timeperiod?
Yes, it is possible.
In timeperiods.cfg, define your custom time.
And use those defined timeperiods in service template (in check_period¬ification_period)