{"id":20956071,"url":"https://github.com/try2code/jobqueue","last_synced_at":"2025-12-27T13:18:35.718Z","repository":{"id":2026743,"uuid":"2963064","full_name":"Try2Code/jobQueue","owner":"Try2Code","description":"Parallelize Ruby things and shell jobs on a defined number of threads","archived":false,"fork":false,"pushed_at":"2018-09-09T10:47:22.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-03-15T06:46:28.511Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Try2Code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-12-12T09:19:45.000Z","updated_at":"2018-09-09T10:47:23.000Z","dependencies_parsed_at":"2022-08-20T11:40:39.949Z","dependency_job_id":null,"html_url":"https://github.com/Try2Code/jobQueue","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/Try2Code%2FjobQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Try2Code%2FjobQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Try2Code%2FjobQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Try2Code%2FjobQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Try2Code","download_url":"https://codeload.github.com/Try2Code/jobQueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243351858,"owners_count":20276911,"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":[],"created_at":"2024-11-19T01:24:08.015Z","updated_at":"2025-12-27T13:18:35.633Z","avatar_url":"https://github.com/Try2Code.png","language":"Ruby","readme":"# JobQueue / ParallelQueue - Let run your jobs in parallel\n\nThis repository contains JobQueue and ParallelQueue. Both libraries provide\nsimilar functionality: Push arbitrary blocks of code to a Queue and execute\nthem on a user-defined number of Threads.\n\nJobQueue offers no support for returning the results of the blocks, i.e. the\nuser has to collect them. ParallelQueue is based on [parallel]\n(https://github.com/grosser/parallel, https://rubygems.org/gems/parallel) which\nhandles the return values internally and users can get the results\nout-of-the-box. \n\nFor the moment I keep both classes, but the ParallelQueue class is a lot\ncleaner and also includes the slightly faster JobQueue implentation. That's why\nI'll remove the JobQueue class sometime in the future.\n\njobQueue/parallelQueue can do the following things:\n\n* Run blocks, Procs and Lambdas\n* Run instance and class methods\n* Respect user definded locks (not needed on ParallelQueue)\n* Parallelizing System commands is removed, because it can easily be implemented with 'parallel'\n\nI started a python2 implementation of this, which can be installed via [pip]\n(https://pypi.python.org/pypi/jobqueue). But I stopped because the\nmultiprocessing.Pool module nearly does what I need ... and blocks do _not_\nexist in python ;-)\n\n## Installation\n\n### Gem Installation\n\nDownload and install jobQueue with the following.\n```\n   gem install jobQueue\n   gem install parallelQueue\n```\n### Requirements\n\nJobQueue requires Ruby only, but versions 1.9.x are needed to make use of system threads.\n\n## Usage\n\n### Parallelize Ruby's blocks, procs, lambdas and things\n\nCreate a JobQueue with nThreads worker with:\n```ruby\n  jq = JobQueue.new(nThreads)\n  pq = ParallelQueue.new\n```\nParallelQueue does not need the number of workers in the constructor. It has to\nbe provided in the run methods.\n\nUse its push method to put in something to do\n\n* For blocks:\n```ruby\n    jq.push do\n      myObject.method0(...)\n      myObject.method1(...)\n      myObject.method3(...)\n    end\n```\n\n* For procs and lambdas: \n```ruby    \n    jp.push(myProc,arg0,arg1,...)\n```\n* For object methods:\n```ruby\n    jq.push([myObject,[:method,arg0,arg1,...])\n```\n\n* Same code can be used for class methods:\n```ruby\n    jq.push(myClass,[:myClassMethod,arg0,arg1,...])\n```\n\nTo start the workers, call \n```ruby\n  jq.run\n  results = qp.run(8)\n  pq.justRun(8)        # no results\n```\n\nThat's it. You might have look at tests.\n\n## Support, Issues, Bugs, ...\n\nplease use personal mail, ruby-lang mailing list or github\n\n## Changelog\n\nJobQueue:\n\n* 1.0.11: prun.rb now ignores empty lines\n* 1.0.10: more flexible logging control (new switches '-l' and '-b')\n* 1.0.9: print out stdout and stderr from the jobs given to prun.rb, use '-D' to avoid printing\n* 1.0.8: support AIX for getting the maximum number of processors, improve processor count for jruby and rbx\n\nParallelQueue:\n\n* 1.0.0: parallel-based child-class of Queue, JobQueue.run is implementation as justRun\n\n## Credits\n\n[\u003cb\u003eRobert Klemme\u003c/b\u003e] For the first hints: https://www.ruby-forum.com/topic/68001#86298\n\n## License\n\njobQueue use the BSD License\nparallelQueue use the IRC License\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftry2code%2Fjobqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftry2code%2Fjobqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftry2code%2Fjobqueue/lists"}