Điểm qua phpDocumentor/Parallel: 17 sao trên GitHub. A separate module to introduce parallelization into a project. Can be used in any project.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
This is a library for introducing Parallelization into your project.
See the example.php file for an example how to use this library.
Theory of Operation
This library will enable the developer to execute a given amount of tasks
(workers) in parallel. This is achieved by adding workers onto a manager,
optionally defining how many processes to run simultaneously and then execute
the manager.
Under Linux this library will try to detect the number of processors and allow
a maximum number of processes to run equal to the number of processors. If this
cannot be determined or the user is running Windows then a default of 2 is used.
Requirements and graceful degradation
Parallelization has several requirements. But to allow distribution, without
adding several requirements to your application, will this library execute the
given tasks in serie if the requirements are not met. And throw a E_USER_NOTICE
php error that explains to the user that dependencies are missing.
The requirements for this library are:
A *NIX compatible operating system
Scripts must not run from an apache module
the PCNTL PHP extension (http://php.net/manual/en/book.pcntl.php)
Workers
Workers are basically wrappers around callback functions or methods. As such you
can use anything in your existing project and parallelize it.
Do note that each parallel process is a duplicate of the original. This means
that, for example, if you pass an object (or other reference) and change that,
that the changes that you have made do not carry over to the caller.
The return value of the given callback is stored as result on the worker and
can be read using the getResult() method.
Any exception that is thrown will result in an error, where the getReturnCode()
method will return the exception code (be warned: this may be 0!) and the
getError() method will return the exception message.
Errors and exceptions
if a task throws an exception it is caught and registered as an error. The
exception's code is used as error number, where the message is used as error
message.
By using this, instead of dying, you can continue execution of the other parallel
processes and handle errors yourself after all processes have been executed.
$mgr = new DocBlox_Parallel_Manager();
$mgr[] = new DocBlox_Parallel_Worker(function() { sleep(1); return 'f'; });
$mgr[] = new DocBlox_Parallel_Worker(function() { sleep(1); return 'g'; });
$mgr[] = new DocBlox_Parallel_Worker(function() { sleep(1); return 'h'; });
$mgr[] = new DocBlox_Parallel_Worker(function() { sleep(1); return 'i'; });
$mgr[] = new DocBlox_Parallel_Worker(function() { sleep(1); return 'j'; });
$mgr->execute();
/** @var DocBlox_Parallel_Worker $worker */
foreach ($mgr as $worker) {
var_dump($worker->getResult());
}
TODO
Improve docs
More intelligent process slots; currently only the oldest in a 'set' of slots
is waited on but if this runs for a longer time then the other slots than
those will not be filled as long as the first slot is occupied.
Last parts of IPC (Inter-Process Communication), to be able to return
information from Workers to the Manager.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/phpDocumentor/Parallel là nguồn chính thức.
phpDocumentor/Parallel có bao nhiêu sao?
phpDocumentor/Parallel có 17 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/phpDocumentor/Parallel. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
phpDocumentor/Parallel có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho phpDocumentor/Parallel. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
phpDocumentor/Parallel còn đang phát triển không?
Commit gần nhất trên phpDocumentor/Parallel là 14.6 năm trước (theo timestamp GitHub). Repo có 3 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
phpDocumentor/Parallel là gì?
phpDocumentor/Parallel (phpDocumentor/Parallel) là dự án đa ngôn ngữ trên GitHub. Theo mô tả gốc: A separate module to introduce parallelization into a project. Can be used in any project.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về Parallel?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về Parallel.