-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Every three minutes validate a random run from the cache. #2029
Conversation
An example of the use of the scheduler start = datetime.now(timezone.utc)
s = Scheduler()
def two_second_timer():
now = datetime.now(timezone.utc)
print(now - start, "I execute every two seconds")
def three_second_timer():
now = datetime.now(timezone.utc)
print(now - start, "I execute every three seconds")
def ten_second_timer():
now = datetime.now(timezone.utc)
print(now - start, "I execute every ten seconds")
def eleven_second_timer():
now = datetime.now(timezone.utc)
print(now - start, "I execute every eleven seconds")
s.add_task(2, two_second_timer)
s.add_task(3, three_second_timer)
s.add_task(10, ten_second_timer)
s.add_task(11, eleven_second_timer)
|
The scheduler is created via
The full signature of
To stop the scheduler (e.g. in a SIGINT/SIGTERM-handler) do
|
bb83e8b
to
ed283d3
Compare
It is perhaps useful to observe that currently
With the scheduler contained in this PR it would be trivial to split this into 3 different tasks, with independent periods. |
498ed94
to
330249d
Compare
concerning flush_buffers, this is also one of the functions that is high up in the sample based profiling. So if some work doesn't need to be scheduled every second, that's a good thing. Do we actually need it to be every second? Actually, that makes me wonder about another feature of the timer: Instead of scheduling it regularly, have a function that schedules the next wake up. Two example use cases:
Thinking a bit more about it. Even for regular scheduled tasks with N sec wait time, it would probably be good that wake up N sec after the scheduled task completed, and not every N sec. This would avoid that for tasks taking more than N seconds a long queue of pending tasks builds up. |
Maybe not. Using a scheduler we can tune this.
If you mean a "one_shot" timer. This is already provided.
Well for now I would prefer simple code so I would only implement such features when needed. Currently I foresee only applications for tasks that execute much quicker than their scheduling period, so that this would not matter. Having a good scheduler would already be important progress compared to the current situation. |
Drafting again since I found a better way to code the scheduler using |
693b952
to
205d681
Compare
592b6cc
to
7e80d4a
Compare
Running on PROD right now after some testing on DEV. |
So far no event log messages... A fleet visit would be the ultimate stress test... Do the following messages appear in the server log? print(f"Validate_random_run: validated aggregated data in cache run {run_id}...", flush=True) Just to verify that the scheduler is working... |
yes, they are in the log. |
The reason for this PR is that before introducing more dynamic updates we would like to verify that the dynamic updates of run["workers"] and run["cores"] introduced in official-stockfish#2010 are bug free. In order to facilitate the use of periodic timers in Fishtest we have introduced a new scheduler in utils.py which may be interesting in its own right. Currently the timers defined are the cache flush timer and the timer introduced in this PR.
Still no event log messages.... Last push is a rebase. |
$ sudo journalctl -u fishtest@6543 --since "120 minutes ago" | grep random -A1
May 31 12:53:30 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6657f5c86b0e318cefa8d7f3...
May 31 12:54:30 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 12:56:22 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 665937e16b0e318cefa905e4...
May 31 12:56:34 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 12:59:19 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6658fe7b6b0e318cefa90232...
May 31 12:59:37 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 13:02:11 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6659a8adea624d64ea5f3206...
May 31 13:02:20 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 13:05:16 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 66568064a86388d5e27dd93e...
May 31 13:05:17 tests.stockfishchess.org pserve[8772]: dead task: run: https://tests.stockfishchess.org/tests/view/665949bc6b0e318cefa9064b task_id: 166 worker: vdv-7cores-3cab8986-91b7*
--
May 31 13:08:15 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 66591f436b0e318cefa902ad...
May 31 13:08:15 tests.stockfishchess.org pserve[8772]: Update_task: task 665946f26b0e318cefa90639/606 is not active
--
May 31 13:11:12 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 66593e196b0e318cefa90608...
May 31 13:11:15 tests.stockfishchess.org pserve[8772]: Update_task: task 6659bf52a27a71165d2475ae/291 is not active
--
May 31 13:14:16 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6657f6e46b0e318cefa8d7f9...
May 31 13:14:27 tests.stockfishchess.org pserve[8772]: Update_task: task 665946f26b0e318cefa90639/575 is not active
--
May 31 13:17:17 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 664e5741928b1fb18de4e345...
May 31 13:17:29 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 13:20:22 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6658d1aa6b0e318cefa90122...
May 31 13:20:33 tests.stockfishchess.org pserve[8772]: Update_task: task 665946f26b0e318cefa90639/587 is not active
--
May 31 13:23:22 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6659bf52a27a71165d2475ae...
May 31 13:24:22 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 13:26:22 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 665945666b0e318cefa90631...
May 31 13:27:14 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 13:29:28 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 66599441e4856a090bda09c8...
May 31 13:29:42 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 13:32:28 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6657f6e46b0e318cefa8d7f9...
May 31 13:32:46 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 13:35:24 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6659bd76a27a71165d2475a2...
May 31 13:35:56 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 13:38:30 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6640edea70e85e1f2ce321f9...
May 31 13:39:01 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue
--
May 31 13:41:27 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6659a8d2ea624d64ea5f320e...
May 31 13:42:04 tests.stockfishchess.org pserve[8772]: Failed_task: failure for: https://tests.stockfishchess.org/tests/view/6659ca56f426908fcc6b5fc4, task_id: 28, worker: vdv-7cores-d06e5604-6ad4*, reason: 'Get request to https://api.github.com/repos/FauziAkram/Stockfish/zipball/4fd04aa13a58c65cd5b63eabab6f936aee0b0f42 failed'
--
May 31 13:44:29 tests.stockfishchess.org pserve[8772]: Validate_random_run: validated aggregated data in cache run 6659481b6b0e318cefa9063e...
May 31 13:45:01 tests.stockfishchess.org pserve[8772]: Request_task: refresh queue |
The validations nicely happen every 3 minutes (+- 5% jitter). |
so, no errors in the logs as far as I can see. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on PROD
Thank you @vdbergh |
Meanwhile logs show quite a few validation errors (passed through
|
The reason for this PR is that before introducing more dynamic updates we would like to verify that the dynamic updates of
run["workers"]
andrun["cores"]
introduced in #2010 are bug free.In order to facilitate the use of periodic timers in Fishtest we have introduced a new scheduler in
utils.py
which may be interesting in its own right.Currently the timers defined are the cache flush timer and the timer introduced in this PR.
Note that it would be best to test this PR on PROD before merging it. If it turns out that it floods the event log with messages about non-validated runs then obviously there is something wrong with #2010 .