Skip to content

Commit 8cde9f8

Browse files
committed
TOMHelper
1 parent 668e25b commit 8cde9f8

16 files changed

+1369
-1440
lines changed

Dataset-RefreshAsync-Cancel.ps1

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#Requires -Modules @{ ModuleName="MicrosoftPowerBIMgmt"; ModuleVersion="1.2.1026" }
2+
3+
param(
4+
$workspaceId = "cdee92d2-3ff9-43e2-9f71-0916e888ad27"
5+
,
6+
$datasetId = "ff63139f-eea9-4296-a5e4-3f56c0005701"
7+
)
8+
9+
$currentPath = (Split-Path $MyInvocation.MyCommand.Definition -Parent)
10+
11+
Connect-PowerBIServiceAccount
12+
13+
# Get running refreshes, only 1 operation is allowed "Only one refresh operation at a time is accepted for a dataset. If there's a current running refresh operation and another is submitted"
14+
15+
Write-Host "Get Runnning Refreshes"
16+
17+
$refreshes = Invoke-PowerBIRestMethod -url "groups/$workspaceId/datasets/$datasetId/refreshes?`$top=5" -method Get | ConvertFrom-Json | select -ExpandProperty value
18+
19+
$refreshes = @($refreshes |? { $_.extendedStatus -in @("Unknown", "inProgress", "notStarted") })
20+
21+
Write-Host "Canceling '$($refreshes.Count)' refreshes"
22+
23+
foreach($refresh in $refreshes)
24+
{
25+
$refreshId = $refresh.requestId
26+
27+
do
28+
{
29+
Write-Host "Cancelling..."
30+
31+
Invoke-PowerBIRestMethod -url "groups/$workspaceId/datasets/$datasetId/refreshes/$refreshId" -method Delete | ConvertFrom-Json
32+
33+
$refreshDetails = Invoke-PowerBIRestMethod -url "groups/$workspaceId/datasets/$datasetId/refreshes/$refreshId" -method Get | ConvertFrom-Json
34+
35+
Write-Host "Status: $($refreshDetails.status)"
36+
37+
Write-Host "sleeping..."
38+
39+
Start-Sleep -Seconds 2
40+
41+
}
42+
while($refreshDetails.extendedStatus -iin @("notStarted", "Unknown", "inProgress"))
43+
44+
}

Dataset-RefreshAsync.ps1

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ param(
99
,
1010
$maxParallelism = 3
1111
,
12-
#$commitMode = "transactional"
13-
$commitMode = "partialBatch"
12+
$commitMode = "transactional"
13+
#$commitMode = "partialBatch"
1414
,
1515
$retryCount = 2
1616
,
@@ -72,7 +72,7 @@ Connect-PowerBIServiceAccount
7272

7373
$refreshes = Invoke-PowerBIRestMethod -url "groups/$workspaceId/datasets/$datasetId/refreshes?`$top=10" -method Get | ConvertFrom-Json | select -ExpandProperty value
7474

75-
if (!($refreshes |? { $_.refreshType -eq "ReliableProcessing" -and $_.status -iin @("Unknown", "inProgress", "notStarted") }))
75+
if (!($refreshes |? { $_.refreshType -eq "ViaEnhancedApi" -and $_.status -iin @("Unknown", "inProgress", "notStarted") }))
7676
{
7777
Write-Host "Posting a new Refresh Command"
7878

@@ -96,7 +96,6 @@ do
9696
Start-Sleep -Seconds 2
9797

9898
}
99-
10099
while($refreshDetails.status -iin @("Unknown", "inProgress", "notStarted"))
101100

102101
Write-Host "Refresh complete: $((([datetime]$refreshDetails.endTime) - ([datetime]$refreshDetails.startTime)).TotalSeconds)s"

Modules/ASTabularHelper/ASTabularHelper.psd1

-112
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-684 KB
Binary file not shown.

0 commit comments

Comments
 (0)