Cavalcade-Runner Daemon for Cavalcade, a scalable WordPress jobs system. |
|
A Human Made project. Maintained by @rmccue. |
|
This is the runner for Cavalcade. Head over to the Cavalcade repo to learn more about running this.
Daemon for Cavalcade, a scalable WordPress jobs system.
Cavalcade-Runner Daemon for Cavalcade, a scalable WordPress jobs system. |
|
A Human Made project. Maintained by @rmccue. |
|
This is the runner for Cavalcade. Head over to the Cavalcade repo to learn more about running this.
Failed IMDSv2 token retrieval causes startup to block forever.
Log execution delay.
Show version number on each log.
Rerun abandoned jobs after restart.
Fix a bug related to IMDSv2.
Never run deleted jobs.
Validate database schema at startup.
Ref: tarosky/Cavalcade#22
Fix endless "MySQL server has gone away" error:
{
"timestamp": "2022-01-03T10:33:20.973+0000",
"level": "ERROR",
"type": "infra",
"version": "build-55",
"message": "database error",
"dump": "",
"err_content": [
"HY000",
2006,
"MySQL server has gone away"
]
}
{
"timestamp": "2022-01-03T10:33:20.973+0000",
"level": "ERROR",
"type": "infra",
"version": "build-55",
"message": "failed to get next job",
"ex_message": "database error"
}
Use IMDSv2.
Make healthcheck customizable.
Support updated DB schema of Cavalcade.
Fix failed to open stream: Connection refused
error which occurs when getting the current IPs.
Remove completed job if finished_at
is NULL
.
This is to cleanup old jobs.
{
"timestamp": "2023-01-17T05:48:11.488+0000",
"level": "ERROR",
"type": "infra",
"version": "build-85",
"message": "exception during starting job",
"ex_message": "PHP error ocurred: Invalid callback HM\\Cavalcade\\Runner\\Runner::terminate_by_signal, cannot access protected method HM\\Cavalcade\\Runner\\Runner::terminate_by_signal()"
}
Move drop log table outside lock.
Show "app" or "infra" as type name of log.
Fix healthcheck error.
Remove migration support.
PHPに限らず、処理と定義をわける→ Avoid Side effect
値を保持したい場合は、クラスにしてメンバー変数などにするか、関数の場合は static変数 を使う
/**
* トークンを取得する
* @return string
* @throw Exception
*/
function get_token() {
static $token = null;
static $tried = 0;
if ( is_null( $token ) ) {
// まだ実行されてない?
if ( ! $tried ) {
$tried++;
$token = get_fresh_token();
} elseif ( $tried < MAX_RETRY ) {
// まだリトライ可能
$tried++;
$token = renew_token( $token ); // renew_token は失敗するとnullを返す
} else {
trow new Exception( 'トークンが取れませんでした。' );
}
}
return $token;
}
あとは呼び出し側を工夫するか、ジェネレータ を使うかなどとして、トークンを利用する処理が「最大3回までリトライを許容しつつトークン取得を試み続ける」という使い方をすればよいと思います。
Make Code Sniffer work.
Fix drop table.
Support only MariaDB.
Lower log level of abandoned jobs.
Fix duplicate logs caused by CloudWatch Agent bug.
Use GitHub Actions to build.
Hide useless PHP error related to HTTP request failure.
Write tests for Cavalcade-Runner.
Change executable name from cavalcade
to cavalcade-runner
to match the repo name.
Reclaim abandoned running
jobs and reschedule them.
Send logs to file instead of DB.
Replace failed
and completed
statuses with done
status since execution results are logged.
Ref: tarosky/Cavalcade#16
Support environment where multiple EIPs exist.
Stop runner while .maintenance
exists.
Never run the same task repeatedly.
Warn empty args_digest
column.
Handle EIP error gracefully.
Use PSR-12 instead of WordPress style since this code is not part of WordPress framework.
Drop cavalcade_logs
table if exists.
Remove duplicate jobs from cavalcade_jobs
table.
Support PHP 8.2.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.