PoshRSJob | greater performance | Runtime Evironment library

 by   proxb PowerShell Version: 1.7.4.4 License: MIT

kandi X-RAY | PoshRSJob Summary

kandi X-RAY | PoshRSJob Summary

PoshRSJob is a PowerShell library typically used in Server, Runtime Evironment, Nodejs, Symfony applications. PoshRSJob has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

[Join the chat at Provides an alternative to PSjobs with greater performance and less overhead to run commands in the background, freeing up the console.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              PoshRSJob has a low active ecosystem.
              It has 459 star(s) with 80 fork(s). There are 61 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 50 open issues and 119 have been closed. On average issues are closed in 207 days. There are 6 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of PoshRSJob is 1.7.4.4

            kandi-Quality Quality

              PoshRSJob has no bugs reported.

            kandi-Security Security

              PoshRSJob has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              PoshRSJob is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              PoshRSJob releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PoshRSJob
            Get all kandi verified functions for this library.

            PoshRSJob Key Features

            No Key Features are available at this moment for PoshRSJob.

            PoshRSJob Examples and Code Snippets

            No Code Snippets are available at this moment for PoshRSJob.

            Community Discussions

            QUESTION

            Use local functions in PowerShell Job
            Asked 2020-Oct-26 at 14:16

            I am writing custom cmdlets to perform a task. One of the cmdlets depends on the other ones and is taking a really long time, so I wanted to perform that task inside a job. Well guess what, you can't because the other cmdlets are not available inside that Job's scope. Why? The other languages out there like C++, Java, C# allow you to use variables, objects, functions from whitin the same scope, why isn't this available in PowerShell? Why is it so decoupled? I feel like it makes it harder for developers. Maybe I don't get the topic, but I would like to do something like this:

            ...

            ANSWER

            Answered 2020-Oct-26 at 14:16

            Start-Job is very limited and slow. It was implemented very poorly imho and I never use it. You can use runspaces for fast and lightweight "background jobs", and import functions and variables from your current session.

            Example:

            Source https://stackoverflow.com/questions/64536409

            QUESTION

            How is the new PowerShell 7 ForEach-Object Parallel implemented?
            Asked 2020-May-20 at 02:43

            PowerShell 7 introduced a much needed feature for running pipeline input in parallel.

            The documentation for PowerShell 7 does not provide any detail on how this is implemented.

            Having leveraged PoshRSJob and Invoke-Parallel modules before, I'm aware that runspaces were traditionally considered the much more efficient approach for parallel operations in powershell over running PowerShell jobs. I've read some mixed content indicating that this is using threading now and not runspaces, but can't find anything else specific.

            I'd really appreciate some technical insight into:

            1. What is the lifecycle of an execution from a .NET perspective
            2. Is the new functionality runspaces or threads? (or is a runspace just a .NET thread in System.Management.Automation?)
            3. Does this bring about any complexity in traditional debugging now that we are moving into parallel operations? Historically I had a rough time debugging with runspaces, and not sure what options might have been improved
            ...

            ANSWER

            Answered 2020-May-08 at 19:27

            Found this fantastic blog post PowerShell ForEach-Object Parallel Feature by Paul Higinbotham.

            From this blog post the key highlights I took away:

            Script blocks run in a context called a PowerShell runspace. The runspace context contains all of the defined variables, functions and loaded modules.

            As previously mentioned, the new ForEach-Object -Parallel feature uses existing PowerShell functionality to run script blocks concurrently....PowerShell itself imposes conditions on how scripts run concurrently, based on its design and history. Scripts have to run in runspace contexts and only one script thread can run at a time within a runspace. So in order to run multiple scripts simultaneously multiple runspaces must be created.

            So it confirms runspaces are the main driver for this and provides some further information on threadsafe operations and more. Any prior answers or detail provided on runspaces are relevant here as this is a matured implementation of runspaces for parallel operations in the official standard library. Other implementations have been done by the community that are runspace oriented, but this is now included with no external module dependencies.

            Thanks Paul for such a good contribution to the community!

            Source https://stackoverflow.com/questions/60837777

            QUESTION

            Why can my Azure PowerShell Task script find a module using find-module but not with import-module?
            Asked 2019-Jun-06 at 17:19

            I've been having difficulty importing the community module PoshRSJob in PowerShell script through an Azure PowerShell task. It keeps giving me this error:

            The specified module 'PoshRSJob' was not loaded because no valid module file was found in any module directory.

            What I did to attempt to fix this was install another module called InstallModuleFromGitHub, which I used to directly install PoshRSJob using the command Find-Module PoshRSJob | Install-ModuleFromGitHub. I built with the script only installing the InstallModuleFromGitHub and the PoshRSJob modules (and everything else commented out), and it succeeded. The rest of the script calls functions that call Import-Module PoshRSJob, so, if the module installed correctly, everything else should have worked. Well, despite the module supposedly installing successfully, the build failed with the same error as before. When I call Find-Module -Name PoshRSJob, the build successfully locates it. But when I call Import-Module -Name PoshRSJob, the build fails and gives me the error again.

            These are the console logs from the failed build:

            ...

            ANSWER

            Answered 2019-Jun-06 at 17:19

            I solved it! Install-ModuleFromGitHub ended up installing PoshRSJob in a repository that the agent couldn't reach. I uninstalled the module by means of Uninstall-Module -Name PoshRSJob -AllVersions -Force. Then, I tried to use just a normal Install-Module command. This wasn't working before, which is part of the reason I was trying to use Install-ModuleFromGitHub, but it works now for some reason. So anyways, after calling Install-Module -Name PoshRSJob -Force, I imported it using Import-Module -Name PoshRSJob. I tested by building through tfs, and it not only was able to find PoshRSJob, but it managed to execute a lot of code before something else broke! But that isn't relevant to this specific question so I'll leave it at that.

            Source https://stackoverflow.com/questions/56465276

            QUESTION

            Passing active Powershell PSSession connection as argument in Start-Job
            Asked 2019-Apr-05 at 20:25

            I am writing a script which gathers data from Exchange Online concerning mailbox permissions for each mailbox in our organization. To do this I gather all mailbox data into a variable then I use foreach to iterate through each mailbox and check the mailbox permissions applied to it. This takes time when you are working with over 15000 mailboxes.

            I would like to use Powershell Jobs to speed this process up by having multiple jobs checking permissions and appending them to a single CSV file. Is there a way to pass an active PSSession into a new job so that the job "shares" the active session of the parent process that spawned the job and does not require a new one to be established?

            I could place a New-PSSession call into the function but Microsoft has active session limits in Exchange Online PSSessions so it would limit the number of jobs I could have running at one time to 3. The rest would have to be queued through a while loop. If I can share a single session between multiple jobs I would be limited by computer resources rather than connection restrictions.

            Has anyone successfully passed an active PSSession through to a job before?

            Edit:

            I've been working on using runspaces to try to accomplish this with Boe Prox's PoshRSJobs module. Still having some difficulty getting it to work properly. Doesn't create the CSV or append to it but only if I try to sort out the permissions within the foreach statement. The Write-Output inside the scriptblock only outputs the implicit remoting information too which is odd.

            Code is below.

            ...

            ANSWER

            Answered 2019-Mar-28 at 20:16

            You have specifications here, but you are not showing code and yet, asking for an opinion.

            That is, as many would say here, off topic, because the goal here is to assist with code that is not working or the like. So, at this point, have you tried what you are asking, and if so, what happened?

            So, IMHO … Yet, since you are here. let's not send you away empty handed.

            As per a similar ask here, the accepted answer delivered was...

            … you have a current PSSession opened up on your console and then you are attempting to use that same session in a background job. This will not work because you are using two different PowerShell processes and are unable to share the live data between the runspaces as it is deserialized and loses all of its capabilities. You will need to look at creating your own PowerShell runspaces if your goal is to share live variables across multiple PowerShell sessions.

            Even with the above, you still have those consumption limits you mention and technically based on your use case, you'd more than likely end up with serious performance issues as well.

            Source https://stackoverflow.com/questions/55381787

            QUESTION

            How to use PowerShell multithreading and still unit test with Pester Mocks
            Asked 2017-Dec-20 at 21:00

            I'm trying to do a simple parallel operation in Powershell. I am using PoshRSJobs for multithreading, though I have also tried Invoke-Parallel with the same issue. I need to call a couple of my own functions in the scriptbody of the job, but this does not allow me to MOCK those functions for unit testing (they end up being the original non-mocked functions). At this point, I'm just trying to assert that they have been called the correct number of times.

            Here is the original class (the functionality of the imported modules are irrelevant - the actual implementations are currently returning test strings)...

            ...

            ANSWER

            Answered 2017-Dec-20 at 20:54

            I don't consider this a full answer, and I don't work on the Pester project, but I would say that this is simply not a supported scenario for Pester. This might change when/if concurrent programming becomes part of PowerShell proper (or it may not).

            If you're willing to change your implementation you might be able to write around this limitation to support some sort of testing.

            For example, maybe your function doesn't use an RSJob when it only has 1 thing to do (which conveniently might be the case when testing).

            Or maybe you implement a -Serial or -NoParallel or -SingleRunspace switch (or a -ConcurrencyFactor which you set to 1 in tests), wherein you don't use a runspace for those conditions.

            Based on your example it's difficult to tell if that kind of test adequately tests what you want, but it seems like it does.

            Source https://stackoverflow.com/questions/47913985

            QUESTION

            PoshRsJob Performance Issue
            Asked 2017-Jun-12 at 15:17

            Why is using Multithreading in PowerShell so unbelievable slow. Am I doing anything wrong? I am using the PoshRsJob Module.

            RSJobs:

            ...

            ANSWER

            Answered 2017-Jun-12 at 15:17

            Creating a new runspace has overhead. So with many small jobs then you are adding the overhead every single time.

            Source https://stackoverflow.com/questions/44495502

            QUESTION

            Import-Module PoshRSJob with Executionpolicy RemoteSigned
            Asked 2017-Mar-13 at 17:00

            I downloaded the PoshRSJob module. When I try to import the module it always throws the following error (translated from German):

            ...

            ANSWER

            Answered 2017-Mar-13 at 17:00

            It might be that Windows is treating the files as remote files despite being on your machine locally. Sometimes Windows will know when files have come from the internet (for example if you download through IE or Edge instead of say, Firefox). Behind the scenes, this is storing zone information in an alternate data stream associated with the file, but that can be modified or stripped off.

            Right click the PSD1, PS1, PSM1 files inside the module and choose "Properties" and if there's an unblock option, make sure it's unticked.

            Alternatively you could run the cmdlet Unblock-File if you have PowerShell 5.1 or greater.

            Source https://stackoverflow.com/questions/42768102

            QUESTION

            PoshRSJob Looping through file directory
            Asked 2017-Feb-26 at 14:13

            I am trying to loop through a directory (sorting by smallest file), get the path, and the file name and then pump those results into a utility.exe program.

            I am trying to do this multi threading with PoshRSJob, but I am not even seeing the utility program show up in task manager, I am getting an error "A null key is not allowed in a hash literal.", for every file that exists (if 50 files are in the directory, then I get 50 errors). I also cannot test if the throttling is working, because nothing is actually running.

            ...

            ANSWER

            Answered 2017-Feb-26 at 14:13

            Your scriptblock is creating an object where you are defining $null = .\utility.exe +++ as a property. As it says, value of $null (nothing) can't be a property name.. I would suggest just running the lines..

            You might also want to change the Wait-RSJob-part. You don't specify a job, so it never waits for anything. Try:

            Try changing the scriptblock to:

            Source https://stackoverflow.com/questions/42469370

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install PoshRSJob

            You can download it from GitHub.

            Support

            More information and examples here: http://learn-powershell.net/2015/04/19/latest-updates-to-poshrsjob/. Older post with some legacy examples found here: http://learn-powershell.net/2015/03/31/introducing-poshrsjob-as-an-alternative-to-powershell-jobs/.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link