{"id":13597566,"url":"https://github.com/santisq/PSParallelPipeline","last_synced_at":"2025-04-10T01:30:56.615Z","repository":{"id":142176800,"uuid":"559658523","full_name":"santisq/PSParallelPipeline","owner":"santisq","description":"Parallel processing of pipeline input objects!","archived":false,"fork":false,"pushed_at":"2025-03-18T15:24:23.000Z","size":232,"stargazers_count":28,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T16:35:59.351Z","etag":null,"topics":["concurrency","csharp","foreach","multithreading","parallel","parallel-processing","powershell","runspace"],"latest_commit_sha":null,"homepage":"https://www.powershellgallery.com/packages/PSParallelPipeline","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/santisq.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-30T19:35:31.000Z","updated_at":"2025-01-24T20:51:20.000Z","dependencies_parsed_at":"2024-01-14T04:43:19.257Z","dependency_job_id":"8fc7b836-3207-4e35-93bf-592171545336","html_url":"https://github.com/santisq/PSParallelPipeline","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santisq%2FPSParallelPipeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santisq%2FPSParallelPipeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santisq%2FPSParallelPipeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santisq%2FPSParallelPipeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/santisq","download_url":"https://codeload.github.com/santisq/PSParallelPipeline/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248140251,"owners_count":21054268,"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":["concurrency","csharp","foreach","multithreading","parallel","parallel-processing","powershell","runspace"],"created_at":"2024-08-01T17:00:36.266Z","updated_at":"2025-04-10T01:30:51.600Z","avatar_url":"https://github.com/santisq.png","language":"C#","readme":"\u003ch1 align=\"center\"\u003ePSParallelPipeline\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n\u003csub\u003eParallel processing of pipeline input objects!\u003c/sub\u003e\n\u003cbr /\u003e\u003cbr /\u003e\n\n[![build](https://github.com/santisq/PSParallelPipeline/actions/workflows/ci.yml/badge.svg)](https://github.com/santisq/PSParallelPipeline/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/santisq/PSParallelPipeline/branch/main/graph/badge.svg?token=b51IOhpLfQ)](https://codecov.io/gh/santisq/PSParallelPipeline)\n[![PowerShell Gallery](https://img.shields.io/powershellgallery/v/PSParallelPipeline?label=gallery)](https://www.powershellgallery.com/packages/PSParallelPipeline)\n[![LICENSE](https://img.shields.io/github/license/santisq/PSParallelPipeline)](https://github.com/santisq/PSParallelPipeline/blob/main/LICENSE)\n\n\u003c/div\u003e\n\nPSParallelPipeline is a PowerShell Module that includes `Invoke-Parallel`, a cmdlet that allows for parallel processing of input objects, sharing similar capabilities as\n[`ForEach-Object -Parallel`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/foreach-object) introduced in PowerShell v7.0.\n\nThis project was inspired by RamblingCookieMonster's [`Invoke-Parallel`](https://github.com/RamblingCookieMonster/Invoke-Parallel) and is developed with Windows PowerShell 5.1 users in mind where the closest there is to parallel pipeline processing is [`Start-ThreadJob`](https://learn.microsoft.com/en-us/powershell/module/threadjob/start-threadjob?view=powershell-7.4).\n\n# What does this Module offer?\n\nExcept for [`-AsJob`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/foreach-object?view=powershell-7.4#-asjob), this module offers the same capabilities as `ForEach-Object -Parallel` in addition to supporting [Common Parameters](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters), a missing feature in the _built-in_ cmdlet.\n\n## Pipeline streaming capabilities\n\n```powershell\nMeasure-Command {\n    $null | Invoke-Parallel { 0..10 | ForEach-Object { Start-Sleep 1; $_ } } |\n        Select-Object -First 1\n} | Select-Object TotalSeconds\n\n# TotalSeconds\n# ------------\n#        1.06\n```\n\n## Support for [CommonParameters](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7.4)\n\nSomething missing on `ForEach-Object -Parallel` as of `v7.5.0.3`.\n\n```powershell\nPS \\\u003e 0..5 | ForEach-Object -Parallel { Write-Error $_ } -ErrorAction Stop\n# ForEach-Object: The following common parameters are not currently supported in the Parallel parameter set:\n# ErrorAction, WarningAction, InformationAction, PipelineVariable\n```\n\nA few examples, they should all work properly, please submit an issue if not 😅.\n\n```powershell\nPS \\\u003e 0..5 | Invoke-Parallel { Write-Error $_ } -ErrorAction Stop\n# Invoke-Parallel: 0\n\nPS \\\u003e  0..5 | Invoke-Parallel { Write-Warning $_ } -WarningAction Stop\n# WARNING: 1\n# Invoke-Parallel: The running command stopped because the preference variable \"WarningPreference\" or common parameter is set to Stop: 1\n\nPS \\\u003e 0..5 | Invoke-Parallel { $_ } -PipelineVariable pipe | ForEach-Object { \"[$pipe]\" }\n# [0]\n# [1]\n# [5]\n# [2]\n# [3]\n# [4]\n```\n\n## Improved `-TimeOutSeconds` error message\n\nIn `ForEach-Object -Parallel` we get an error message per stopped parallel invocation instead of a single one.\n\n```powershell\nPS \\\u003e  0..10 | ForEach-Object -Parallel { $_; Start-Sleep 5 } -TimeoutSeconds 2\n# 0\n# 1\n# 2\n# 3\n# 4\n# InvalidOperation: The pipeline has been stopped.\n# InvalidOperation: The pipeline has been stopped.\n# InvalidOperation: The pipeline has been stopped.\n# InvalidOperation: The pipeline has been stopped.\n# InvalidOperation: The pipeline has been stopped.\n```\n\nWith `Invoke-Parallel` you get a single, _friendlier_, error message.\n\n```powershell\nPS \\\u003e 0..10 | Invoke-Parallel { $_; Start-Sleep 5 } -TimeoutSeconds 2\n# 0\n# 1\n# 2\n# 3\n# 4\n# Invoke-Parallel: Timeout has been reached.\n```\n\n## [`$using:`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_keywords?view=powershell-7.4) Support\n\nSame as `ForEach-Object -Parallel` you can use the `$using:` scope modifier to pass-in variables to the parallel invocations.\n\n```powershell\n$message = 'world!'\n'hello ' | Invoke-Parallel { $_ + $using:message }\n# hello world!\n```\n\n## `-Functions` and `-Variables` Parameters\n\nBoth parameters are a quality of life addition, specially `-Functions`, which adds the locally defined functions to the runspaces [Initial Session State](https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.runspaces.initialsessionstate), a missing feature on `ForEach-Object -Parallel`. This is a much better alternative to passing-in the function definition to the parallel scope.\n\n### [`-Variables` Parameter](./docs/en-US/Invoke-Parallel.md#-variables)\n\n```powershell\n'hello ' | Invoke-Parallel { $_ + $msg } -Variables @{ msg = 'world!' }\n# hello world!\n```\n\n### [`-Functions` Parameter](./docs/en-US/Invoke-Parallel.md#-functions)\n\n```powershell\nfunction Get-Message {param($MyParam) $MyParam + 'world!' }\n'hello ' | Invoke-Parallel { Get-Message $_ } -Functions Get-Message\n# hello world!\n```\n\n## Documentation\n\nCheck out [__the docs__](./docs/en-US/Invoke-Parallel.md) for information about how to use this Module.\n\n## Installation\n\n### Gallery\n\nThe module is available through the [PowerShell Gallery](https://www.powershellgallery.com/packages/PSParallelPipeline):\n\n```powershell\nInstall-Module PSParallelPipeline -Scope CurrentUser\n```\n\n### Source\n\n```powershell\ngit clone 'https://github.com/santisq/PSParallelPipeline.git'\nSet-Location ./PSParallelPipeline\n./build.ps1\n```\n\n## Requirements\n\nThis module has no requirements and is fully compatible with __Windows PowerShell 5.1__ and [__PowerShell Core 7+__](https://github.com/PowerShell/PowerShell).\n\n## Contributing\n\nContributions are more than welcome, if you wish to contribute, fork this repository and submit a pull request with the changes.\n","funding_links":[],"categories":["C# #"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsantisq%2FPSParallelPipeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsantisq%2FPSParallelPipeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsantisq%2FPSParallelPipeline/lists"}