1
votes

We are using Microsoft.AnalysisServices library to access our SSAS database (on SQL Server 2014) and programatically process cubes.

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). 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).

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:

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

1
I'm not sure how much this helps you but thinknook.com/… is an article about Killing SSAS execution through XMLA query.DiscipleMichael
We use XMLA queries for other cubes, which cannot be processed in "Full" mode. So far, it was unnecessary here. If there's no better solution, we'll probably rewrite the code. At the very least, we should be able to interrupt the work after each processed dimension. It will still require waiting, but not 1h.Marcin Synak
If you simply restart the service does it successfully cancel processing? Or does it just hang?GregGalloway

1 Answers

0
votes

Can you try getting rid of the using block and making your serverobject a class level member. Then try this on the cancel thread:

server.CancelSession(server.SessionID);