Deploying using the new ParallelTask

May 8, 2012 at 1:37 AM

Hi Mike,

First and foremost thank you for a great product in the Extension Pack!

Building in parallel doesn't seem to work in conjunction with batching.  Target batching in particular.  I currently have a script that deploys code across 20+ servers using target batching.  What I would like to do with the parallel task is my transform my current "MegaTarget" into "EvenTarget" and "OddTarget" and deploy them in parallel.  The goal utilizing your new task, is to instantly cut my deployment time in half.  Not to mention that I boasted to the boss that I'd cut deployment times in half. Doh!

The problem is the new parallel task seems to choke on this. It doesn't seem to properly handle item transformations. Is this a known limitation or new? Any ideas?  I can email  you a sample file of what I'm trying to do if my description is unclear.  Thanks in advance!

- IP

May 8, 2012 at 1:42 AM

Actually in the interest of time, here's the file.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="QuickDeploy" ToolsVersion="4.0">
    <PropertyGroup>
        <TPath>$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks')">(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)" />


    <Target Name="QuickDeploy">
        <MSBuild.ExtensionPack.Framework.Parallel TaskAction="BuildTargetsInParallel" Targets="DeployEven;DeployOdd;" />
    </Target>


    <Target Name="DeployEven" Outputs="%(EvenHost.Identity)">
        <Message Text="Stop IIS: @(EvenHost->'%(Name)')" Importance="high" />
        <!-- There are a bunch of steps here -->
        <Message Text="Start IIS: @(EvenHost->'%(Name)')" Importance="high" />
    </Target>

    <Target Name="DeployOdd" Outputs="%(OddHost.Identity)">
        <Message Text="Stop IIS: @(OddHost->'%(Name)')" Importance="high" />
        <!-- There are a bunch of steps here -->
        <Message Text="Start IIS: @(OddHost->'%(Name)')" Importance="high" />
    </Target>


    <ItemGroup>
        <OddHost Include="Server01.com">
            <Name>Server01.com</Name>
        </OddHost>
        <OddHost Include="Server03.com">
            <Name>Server03.com</Name>
        </OddHost>
        <OddHost Include="Server05.com">
            <Name>Server05.com</Name>
        </OddHost>
        <OddHost Include="Server07.com">
            <Name>Server07.com</Name>
        </OddHost>
        <OddHost Include="Server09.com">
            <Name>Server09.com</Name>
        </OddHost>
    </ItemGroup>

    <ItemGroup>
        <EvenHost Include="Server02.com">
            <Name>Server02.com</Name>
        </EvenHost>
        <EvenHost Include="Server04.com">
            <Name>Server04.com</Name>
        </EvenHost>
        <EvenHost Include="Server06.com">
            <Name>Server06.com</Name>
        </EvenHost>
        <EvenHost Include="Server08.com">
            <Name>Server08.com</Name>
        </EvenHost>
        <EvenHost Include="Server10.com">
            <Name>Server10.com</Name>
        </EvenHost>
    </ItemGroup>


</Project>

Coordinator
May 8, 2012 at 9:20 PM

If I run that I see the even and odd building in parallel

What am I missing?

 

Mike

May 9, 2012 at 12:07 AM

I cannot see all the servers in the build output when I run "QuickDeploy".  For example when I execute:
msbuild /t:DeployEven File.proj
msbuild /t:DeployOdd File.proj

I can see every server was hit as expected.

However, when I execute:
msbuild /t:QuickDeploy File.proj

I get varying results, either:
1) No servers
2) 3 even and 3 odd
3) Never more than 7 servers

I can send you a screenshot if it helps.

Coordinator
May 9, 2012 at 3:50 PM

Don't rely on console output for the truth. can you log to file and see what that says.

 

just add something like /l:FileLogger,Microsoft.Build.Engine;logfile=mylog.txt to your call

May 9, 2012 at 7:08 PM

I added the logger and it shows the exact same output as the console.  I increased the verbosity level to v=diag and it looks like the item array is being properly collected, but the task seems to choke before hitting every item.

The version of the file I am using is slightly modified from the one I sent earlier.  Would you please try cutting and pasting to see if you get the same behavior? It could be because the earlier version I sent you above has a smaller array.

<ItemGroup>
        <OddHost Include="core01.com">
            <Name>core01.com</Name>
        </OddHost>
        <OddHost Include="core03.com">
            <Name>core03.com</Name>
        </OddHost>
        <OddHost Include="core05.com">
            <Name>core05.com</Name>
        </OddHost>
        <OddHost Include="core07.com">
            <Name>core07.com</Name>
        </OddHost>
        <OddHost Include="core09.com">
            <Name>core09.com</Name>
        </OddHost>
        <OddHost Include="core11.com">
            <Name>core11.com</Name>
        </OddHost>
        <OddHost Include="core13.com">
            <Name>core13.com</Name>
        </OddHost>
        <OddHost Include="core15.com">
            <Name>core15.com</Name>
        </OddHost>
        <OddHost Include="core17.com">
            <Name>core17.com</Name>
        </OddHost>
        <OddHost Include="core19.com">
            <Name>core19.com</Name>
        </OddHost>
        <OddHost Include="core21.com">
            <Name>core21.com</Name>
        </OddHost>
    </ItemGroup>

    <ItemGroup>
        <EvenHost Include="core02.com">
            <Name>core02.com</Name>
        </EvenHost>
        <EvenHost Include="core04.com">
            <Name>core04.com</Name>
        </EvenHost>
        <EvenHost Include="core06.com">
            <Name>core06.com</Name>
        </EvenHost>
        <EvenHost Include="core08.com">
            <Name>core08.com</Name>
        </EvenHost>
        <EvenHost Include="core10.com">
            <Name>core10.com</Name>
        </EvenHost>
        <EvenHost Include="core12.com">
            <Name>core12.com</Name>
        </EvenHost>
        <EvenHost Include="core14.com">
            <Name>core14.com</Name>
        </EvenHost>
        <EvenHost Include="core16.com">
            <Name>core16.com</Name>
        </EvenHost>
        <EvenHost Include="core18.com">
            <Name>core18.com</Name>
        </EvenHost>
        <EvenHost Include="core20.com">
            <Name>core20.com</Name>
        </EvenHost>
    </ItemGroup>

Coordinator
May 10, 2012 at 11:16 PM

Sorry for the delay, I'll try look into this further soon... Mike

May 15, 2012 at 10:26 PM

Hi Mike,

I wasn't sure what your last comment meant, for clarity, did it mean:

A) With the new item list you provided I can now reproduce the issue and I will need time to look further into the cause

or

B) I haven't had time to reproduce the issue, and I will need time to look further into it

Thanks!

- IP