简体   繁体   English

如何以编程方式停止SSAS多维数据集处理?

[英]How to stop SSAS cube processing programatically?

We are using Microsoft.AnalysisServices library to access our SSAS database (on SQL Server 2014) and programatically process cubes. 我们使用Microsoft.AnalysisServices库来访问我们的SSAS数据库(在SQL Server 2014上)并以编程方式处理多维数据集。

The code looks like this: 代码如下所示:

using (var server = new Server())
{
    server.Connect("someserver");

    if (server.Connected)
    {
        var db = server.Databases.FindByName("somedb");

        if (db != null)
        {
            db.Process(ProcessType.ProcessFull);
        }
    }
}

The problem is, full cube processing may take a long time (in our case over 1h). 问题是,完整立方体处理可能需要很长时间(在我们的情况下超过1小时)。 And we need a way to gracefully stop/cancel it if necessary (the code above is a part of complex Windows Service that sometimes needs to be restarted). 如果需要,我们需要一种方法来优雅地停止/取消它(上面的代码是有时需要重新启动的复杂Windows服务的一部分)。

It is completely acceptable that interrupting the task results in cube not being processed. 中断任务导致不处理多维数据集是完全可以接受的。

Is there a way to write the code above so it is non-blocking? 有没有办法编写上面的代码,所以它是非阻塞的? Or pass a callback somehow? 或以某种方式传递回调? I could not find anything relevant in MSDN documentation: 我在MSDN文档中找不到任何相关的内容:

https://msdn.microsoft.com/en-us/library/microsoft.analysisservices.database.aspx https://msdn.microsoft.com/en-us/library/microsoft.analysisservices.database.aspx

Can you try getting rid of the using block and making your server object a class level member. 您可以尝试摆脱using块并使server对象成为类级成员吗? Then try this on the cancel thread: 然后在取消线程上尝试这个:

server.CancelSession(server.SessionID);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM