Replay one cassette VCR specific times - vcr

How to config use_cassette to replay a specific times? Such as 2 times or 3 times?
it 'failed twice and then success' do
VCR.use_cassette('success_request') do
VCR.use_cassette('failed_request') do # need to fail exactly twice
run_my_case
end
end
end

Related

Flink: the result of SocketWindowCount example isn't what I expected

I am new to flink. I follow the quickstart on the flink website and deploy flink on a single machine. After I do "./bin/flink run examples/streaming/SocketWindowWordCount.jar --port 9000" and enter the words as the website described, I get the result:final result
It seems that the program didn't do the reduce,I just want to know why? Thanks.
The program did do a reduce, but not fully, because your input must have fallen into two different 5 second windows. That's why the 4 instances of ipsum where reported as 1 + 3 -- the first one fell into one window, and the other 3 into another window (along with the "bye").
Flink's window boundaries are based on alignment with the clock. So if your input events occurred between 14:00:04 and 14:00:08, for example, they would fall into two 5 second windows -- one for 14:00:00 - 14:00:04.999 and another for 14:00:05 - 14:00:09.999 -- even though all of your events fit into a single interval that's only 4 seconds long.
If you try again, you can expect to see similar, but probably different results. That's a consequence of doing windowed analytics based on "processing time". If you want your applications to get repeatable results, you should plan on using "event time" analytics instead (where the timestamps are based on when the events occurred, rather than when they were processed).

How to run a cron command every hour taking script execution time in account?

I have a bunch of data to monitor. My data are statistics that can only be retrieved every hour but can change every second and I want to store into a database as much values as I can for each data set.
I've though about several approaches for this problem and I finally chose to refresh and read all statistics at once instead of reading them independently.
So that, I came out with command mycommand which reads all my statics with the cost of several minutes (let's say 30) of execution. Now I would like to run this script every hour, but taking the script execution into account.
I actually run
* */1 * * * mycommand.sh
and receive many annoying error emails (actually one every hour) and I effectly retrieve my statistics every 2 hours.
1h 30 minutes is the half of 3 hours. So you could have two entries in crontab(5) running the same /home/gogaz/mycommand.sh script, one to run it at 1, 4, 7, ... hours (every 3 hours from 1am) and another to run it at 2:30, 5:30, 8:30 hours, ... (every 3 hours from 2:30am) etc
Writing these entries is left as an exercise to the reader.
See also anacrontab(5) and at(1). For example, you might run your script once using batch, but terminate your script with an at command rescheduling that same script (the drawback is handling of unexpected errors).
If you redirect your stdout and stderr in your crontab entry, you won't get any emails.

Inserting an idle time when looping

I have written a VBA code to generate some database entries based on an excel list: due to the way the database is set up, I need to first generate an URL and then open the URL to generate the online DB entry.
I could loop through the entire list, but I am afraid that launching 50 or even more consecutive instances of IE with this loop will hung the computer. It's worth mentioning that upon manually opening a single URL the DB takes some seconds to display the proper page.
Is there a way to define an idle time at the end of each iteration?
What about Application.Wait()? For example, count from 0 to 10 every 5 seconds:
Sub main()
For i = 0 To 10
MsgBox i
Application.Wait (Now() + TimeValue("0:00:05"))
Next i
End Sub

Delay time between transactions

I have a JMeter script which has multiple Transaction controllers and each Transaction controllers have multiple samples. I want to implement 5 secs delay time between each transaction controllers. What is the right approach?
The script has n number of Threads.
Add "Constant Timer" after each "Transaction Controller" by giving delay of 5 sec.It is a simplest and easy approach for that.
Add constant timer/Uniform random timer of 5 sec only in first sample of each transaction controller (no need to include in first sample of first transaction controller)

GAE Task Queues how to make the delay?

In Task Queues code is executed to connect to the server side
through URL Fetch.
My file queue.yaml.
queue:
- Name: default
rate: 10 / m
bucket_size: 1
In such settings, Tusk performed all at once, simultaneously.
Specificity is that between the requests should be delayed at least 5
sec. Task must perform on stage with a difference> 5 sec. (but
does not parallel).
What are the values set in queue.yaml?
You can't specify minimum delays between tasks in queue.yaml, currently; you should do it (partly) in your own code. For example, if you specify a bucket size of 1 (so that more than one task should never be executing at once) and make sure the tasks runs for at least 5 seconds (get a start=time.time() at the start, time.sleep(time.time()-(5+start)) at the end) this should work. If it doesn't, have each task record in the store the timestamp it finished, and when it start check if the last task ended less than 5 seconds ago, and in that case terminate immediately.
The other way could be store the task data in table. In your task-queue add a id parameter. Fetch 1st task from table and pass its id to task queue processing servlet. In servlet at the end delay for 5 second and feth next task, pass its id and.... so on.

Resources