-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathprint_result.py
46 lines (38 loc) · 1.75 KB
/
print_result.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from tableau_migration import (
IMigrationManifestEntry,
MigrationManifestEntryStatus,
MigrationResult,
ServerToCloudMigrationPipeline
)
def print_result(result: MigrationResult):
"""Prints the result of a migration."""
print(f'Result: {result.status}')
for pipeline_content_type in ServerToCloudMigrationPipeline.content_types():
content_type = pipeline_content_type.content_type
type_entries = [IMigrationManifestEntry(x) for x in result.manifest.entries.for_content_type(content_type)]
count_total = len(type_entries)
count_migrated = 0
count_skipped = 0
count_errored = 0
count_cancelled = 0
count_pending = 0
for entry in type_entries:
if entry.status == MigrationManifestEntryStatus.MIGRATED:
count_migrated += 1
elif entry.status == MigrationManifestEntryStatus.SKIPPED:
count_skipped += 1
elif entry.status == MigrationManifestEntryStatus.ERROR:
count_errored += 1
elif entry.status == MigrationManifestEntryStatus.CANCELED:
count_cancelled += 1
elif entry.status == MigrationManifestEntryStatus.PENDING:
count_pending += 1
output = f'''
{content_type.Name}
\t{count_migrated}/{count_total} succeeded
\t{count_skipped}/{count_total} skipped
\t{count_errored}/{count_total} errored
\t{count_cancelled}/{count_total} cancelled
\t{count_pending}/{count_total} pending
'''
print(output)