嵌套并行工作流与暂停 [英] Nested Parallel Workflow With Pause

查看:75
本文介绍了嵌套并行工作流与暂停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在每个SQL Server上同时在两个数据库上运行SharePoint Upgrade-SPContentDatabase命令。我们有四个SQL服务器托管几TB的SharePoint数据。使用powershell工作流程我可以完成它,但是存在以下问题。

Trying to run SharePoint Upgrade-SPContentDatabase command on two database concurrently per SQL server. We have four SQL servers hosting few terabytes of SharePoint data. Using the powershell workflows I can accomplish it but there are some issues as below.

1)升级命令导致SharePoint生成日志文件,因为我并行执行,SP生成错误消息日志文件<< filename>>已经存在。

1) Upgrade command causes SharePoint to generate log file, since I am executing in parallel, SP generates error message that log file <<filename>> already exist.

2)我必须在服务器上升级Powershell版本才能使用工作流程。

2) I have to upgrade Powershell version on server in order to utilize Workflows.

想知道是否有人可以帮我介绍在每个Upgrade命令之前暂停并行进程或使用其他方法。第二个问题是次要问题。

Wondering if somebody can help me either with introducing pause in parallel process before each Upgrade command or use a different approach. The second issue is minor.

以下是我正在使用的代码

The following is the code I am using

workflow UpgradeContentDB
{
    Param($csvPath,$throttle,$sleepSec)

    $dbColl = Import-Csv $csvPath |
                Select-Object Server,Name,@{ n = "Size"; e = { [int]($_.Size) } }  |
                Sort-Object Size -Descending |
                Group-Object -Property "Server"

    foreach -Parallel ($svr in $dbColl)
    {
        foreach -Parallel -throttlelimit $throttle ($db in $svr.Group)
        {
            Sequence
            {  
                InlineScript {
                    Add-PSSnapin Microsoft.Sharepoint.Powershell;
                    Get-Date -Format G
                    " Server: " + $using:db.Server + " Database: " + $using:db.Name +  " Size: " + $using:db.Size;
                    Upgrade-SPContentDatabase $using:db.Name -Confirm:$false;
                    Start-Sleep -Seconds $using:sleepSec;
                }
            }
        }
    }
 }

推荐答案

也许这篇文章对您有用,它更多地讲述了"如何在单个工作流内嵌套两个工作流,以便两个工作流并行运行":

Maybe this post is useful to you, it tells more about "how to nest two workflows inside of a single workflow so the two workflows function in parallel":

https:/ /stackoverflow.com/questions/33699545/nest-two-workflows-in-a-single-workflow-to-run-parallel

祝你好运,

Allen Bai

Allen Bai


这篇关于嵌套并行工作流与暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆