Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cancel or warn, when saving model that is being processed/blocked #730

Closed
zenzeinet opened this issue Nov 30, 2022 · 3 comments
Closed
Labels
feature: enhancement Request is a enchacement to existing feature
Milestone

Comments

@zenzeinet
Copy link

zenzeinet commented Nov 30, 2022

TE3: When saving a model, it would be nice if te3 would first check if a transaction is open, so that te3 doesn't become frozen while trying to save (until the open transaction finishes), and allow/warn the user. Alternatively, allow to cancel saving the model.

@otykier
Copy link
Collaborator

otykier commented Dec 5, 2022

Performing the check upon every save could add precious seconds to the time a save operation takes (especially when working against a remote AAS or Power BI model, as there is a round-trip overhead). And the TOM SaveChanges method unfortunately does not allow cancelation, so I'm afraid we're a bit out of luck on this for now. I've reached out to Microsoft, to see if they can provide any suggestions.

@otykier otykier added the issue: as engine/TOM Issue is caused by a limitation of the AS engine or the TOM client libraries label Dec 5, 2022
@zenzeinet
Copy link
Author

zenzeinet commented Dec 21, 2022

Maybe if the TOM SaveChanges itself doesn't allow cancelling, then it should be possible doing the following (have done it manually sometimes). Would this be possible?

  • After the SaveChanges, independently
  • Query the SPID [1]
  • if the user wants to cancel , push an XMLA Cancel [2]
  • reconnect if needed

[1] -- similar to

SELECT 
	ssasSessions.SESSION_SPID AS [SPID],
	ssasSessions.SESSION_USER_NAME AS [User ID],
	ssasSessions.SESSION_CURRENT_DATABASE AS [Database],
	ssasConnections.connection_host_name AS 'Client IP address',
	ROUND(CAST(ssasCommands.COMMAND_CPU_TIME_MS AS int)/1000, 2) AS [Command Time(in sec)],
	ssasCommands.COMMAND_START_TIME AS [Command Start Time],
	ssasCommands.COMMAND_END_TIME AS [Command End Time],
	ssasCommands.COMMAND_TEXT AS [MDX Command],
	connection_host_application AS 'Application',
	CHARINDEX('</Process>',ssasCommands.COMMAND_TEXT) AS ProcessRunning
	, ssasSessions.*
	, ssasCommands.*
	, ssasConnections.*
FROM OPENQUERY(SSAS,'select * from $system.discover_sessions') AS ssasSessions
	LEFT JOIN OPENQUERY(SSAS,'select * from $system.discover_commands') AS ssasCommands ON ssasSessions.SESSION_SPID = ssasCommands.SESSION_SPID
	LEFT JOIN OPENQUERY(SSAS,'select * from $system.discover_connections') AS ssasConnections ON ssasSessions.SESSION_connection_id = ssasConnections.connection_id
where 
    ((ssasCommands.COMMAND_END_TIME is null) OR (@showFinished = 1))
    AND NOT (try_cast(ssasCommands.COMMAND_TEXT as nvarchar(2000)) = N'select * from $system.discover_commands')
ORDER BY [Command End Time], [Command Start Time] DESC

[2] -- similar to

<Cancel xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
  <ConnectionID>[CID]</ConnectionID>
  <SessionID>[SID]</SessionID>
  <SPID>[SPID]</SPID>
  <CancelAssociated>[true/false]</CancelAssociated>
</Cancel> 

@otykier otykier added feature: enhancement Request is a enchacement to existing feature and removed issue: as engine/TOM Issue is caused by a limitation of the AS engine or the TOM client libraries labels Dec 23, 2022
@otykier otykier added this to the 3.4.0 milestone Dec 23, 2022
@otykier
Copy link
Collaborator

otykier commented Dec 23, 2022

This is now possible in 3.4.0. Thanks for reporting!

@otykier otykier closed this as completed Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: enhancement Request is a enchacement to existing feature
Development

No branches or pull requests

2 participants