{"id":17122812,"url":"https://github.com/ibrahimgunduz34/shepherdprocesspoolbundle","last_synced_at":"2025-07-13T00:42:11.368Z","repository":{"id":56988361,"uuid":"171550283","full_name":"ibrahimgunduz34/ShepherdProcessPoolBundle","owner":"ibrahimgunduz34","description":"Another simple process pool for Symfony","archived":false,"fork":false,"pushed_at":"2019-03-02T18:21:34.000Z","size":24,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T22:12:53.702Z","etag":null,"topics":["async","library","php","process-manager","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ibrahimgunduz34.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-19T21:10:35.000Z","updated_at":"2023-03-08T16:16:33.000Z","dependencies_parsed_at":"2022-08-21T13:20:17.554Z","dependency_job_id":null,"html_url":"https://github.com/ibrahimgunduz34/ShepherdProcessPoolBundle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrahimgunduz34%2FShepherdProcessPoolBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrahimgunduz34%2FShepherdProcessPoolBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrahimgunduz34%2FShepherdProcessPoolBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrahimgunduz34%2FShepherdProcessPoolBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibrahimgunduz34","download_url":"https://codeload.github.com/ibrahimgunduz34/ShepherdProcessPoolBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670506,"owners_count":21142897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","library","php","process-manager","symfony","symfony-bundle"],"created_at":"2024-10-14T18:23:57.206Z","updated_at":"2025-04-13T05:39:19.666Z","avatar_url":"https://github.com/ibrahimgunduz34.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shepherd Process Pool\n\n[![Build Status](https://travis-ci.org/ibrahimgunduz34/ShepherdProcessPoolBundle.svg?branch=master)](https://travis-ci.org/ibrahimgunduz34/ShepherdProcessPoolBundle)\n\nShepherd is an easy way to run the processes in parallel. \nAlso, you can control how many processes you can run in \nparallel or decide to stop all jobs in the queue if anyone \nis failed.   \n\n## How To Install\n\nCall the following command to add the package to your project as a composer dependency.\n```$xslt\ncomposer require ibrahimgunduz34/shepherd\n```\n\n## How To Configure \nYou can simply define your process pools in `pools` section separately. \nAlso, you can define some default options in `defaults` section and \noverride them in each pool definition if it's needed.\n  \n```yaml\nshepherd:\n    defaults:\n        max_processes: 4\n        fail_on_error: true\n    pools:\n        foo:\n            max_processes: 2\n            fail_on_error: false\n        bar:\n            max_processes: 8\n```\n\n## How To Use \n\nBasically, Shepherd creates services for each pool definition. So \nyou can simply inject the pools anywhere. It creates services \nwith`shepherd.pool.\u003cpool name\u003e` naming convention.\n\n```yaml\nApp\\Service\\MyService:\n    class: App\\Service\\MyService\n    arguments:\n        - '@shepherd.pool.foo'\n```\n\nYou can keep adding new processes until starting the pool processing.\n\n```php\n\u003c?php\nnamespace App\\Service;\n\nuse Shepherd\\Bundle\\ProcessPoolBundle\\ProcessPool;\nuse Symfony\\Component\\Process\\Process;\n\nclass MyService \n{\n    /** @var ProcessPool */\n    private $pool;\n    \n    function __construct(ProcessPool $pool) {\n        $this-\u003epool = $pool; \n    }\n    \n    public function performSomething() {\n        //...\n        $this-\u003epool-\u003eappend(new Process([__DIR__ . '../bin/console', 'do:something', 'param1', 'param2']));\n        $this-\u003epool-\u003eappend(new Process([__DIR__ . '../bin/console', 'do:something', 'param3', 'param4']));\n        $this-\u003epool-\u003eappend(new Process([__DIR__ . '../bin/console', 'do:something', 'param5', 'param6']));\n        //...\n        //...\n        //...\n        $this-\u003epool-\u003estart();\n    }\n}\n```\n\n## How To Stop The Flow If Anyone Of The Jobs Failed\n\nTo fail entire flow if anyone of the jobs failed, you must define `fail_on_error` as true \nwhen you defined the pool.\n\n```yaml\nshepherd:\n    pools:\n      foo:\n        max_processes: 2\n        fail_on_error: true        \n```\n\nThen you must handle the error which is thrown by `start()` method.\n\n```php\n\u003c?php\n //...\n    \n    function performSomething() {\n        //...\n        try {\n            $this-\u003epool-\u003estart();    \n        } catch (Shepherd\\Bundle\\ProcessPoolBundle\\Exception\\ProcessExecutionError $exception) {\n            //TODO: Do something...\n        }\n        //...\n    }   \n //...\n```\n\nYou can find an example use case in the [**this blog post**](https://medium.com/@ibrahimgunduz34/how-to-speed-up-multiple-file-transfer-process-by-parallelizing-the-downloads-in-symfony-1beb160771f0):\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibrahimgunduz34%2Fshepherdprocesspoolbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibrahimgunduz34%2Fshepherdprocesspoolbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibrahimgunduz34%2Fshepherdprocesspoolbundle/lists"}