GithubHelp home page GithubHelp logo

Comments (6)

RamblingCookieMonster avatar RamblingCookieMonster commented on August 21, 2024

Yep! There are a few ways around that:

  • Use mutexes
  • If they're unique, use the inputobject as the basis for the file name (I.e. One file per item)

Cheers!

from invoke-parallel.

codykonior avatar codykonior commented on August 21, 2024

I get this same issue. I think that the default log file name should include this logic.

from invoke-parallel.

RamblingCookieMonster avatar RamblingCookieMonster commented on August 21, 2024

Oh, misread this, you're talking the Invoke-Parallel log file.

Any preferences on a workaround?

  • Add mutex support for any log file we point at, in case folks want to use one log file for concurrent Invoke-Parallel invocations
  • Remove default of C:\temp\log.log, let user specify a more unique name if desired
  • Change default log to something unique, e.g. Join-Path $ENV:AppData Invoke-Parallel-<a new guid>.log?
  • Something else?

Cheers!

from invoke-parallel.

RGibsonNGPVAN avatar RGibsonNGPVAN commented on August 21, 2024

Just thought I would leave another suggestion here for you.

Original:

if($logFile -and $log){
    ($log | ConvertTo-Csv -Delimiter ";" -NoTypeInformation)[1] | out-file $LogFile -append
}

Modified:

if($logFile -and $log){
    $isOutFileComplete = $false
    While ($isOutFileComplete -eq $false) {
        Try {
            ($log | ConvertTo-Csv -Delimiter ";" -NoTypeInformation)[1] | out-file $LogFile -append
            $isOutFileComplete = $true
        }
        Catch {
            Start-Sleep -Milliseconds 50
        }
    }
}

This should allow for all code to be written to the same log file without blocking errors. Only downside is that it may be a little slower when multiple processes are writing to the log at once and have to sleep.

FYI - 50 Milliseconds was an arbitrary number, might be able to get away with 10 milliseconds.

from invoke-parallel.

RamblingCookieMonster avatar RamblingCookieMonster commented on August 21, 2024

Alrighty, workaround for now is that Invoke-Parallel won't log unless you explicitly tell it to by including a log file path. At some point, mutexes or a bound 'check every few milliseconds' bit might help

Cheers!

from invoke-parallel.

RamblingCookieMonster avatar RamblingCookieMonster commented on August 21, 2024

Temporary workaround in place, closing this out. If someone wants to tackle adding mutex support when logging is specified, that would be awesome, just open a new issue - cheers!

from invoke-parallel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.