-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlist.py
executable file
·61 lines (49 loc) · 1.5 KB
/
list.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import kfp
import argparse
from utils.auth.azure import get_access_token
# Initially derived from https://github.com/kaizentm/kubemlops
def main():
# Demonstrating how to access KFP API (list of pipeines)
# With an authentication token provided by Azure AD
#
# Usage:
# python list.py --kfp_host <kfp_host> --tenant <tenant> --service_principal <Service Principal> --sp_secret <Service Principal Secret> --sp_audience <Audience> # noqa: E501
parser = argparse.ArgumentParser("run pipeline")
parser.add_argument(
"--kfp_host",
type=str,
required=False,
default="http://localhost:8080/pipeline",
help="KFP endpoint"
)
parser.add_argument(
"--tenant",
type=str,
required=True,
help="Tenant"
)
parser.add_argument(
"--service_principal",
type=str,
required=True,
help="Service Principal"
)
parser.add_argument(
"--sp_secret",
type=str,
required=True,
help="Service Principal Secret"
)
parser.add_argument(
"--sp_audience",
type=str,
required=True,
help="Service Principal Audience"
)
args = parser.parse_args()
token = get_access_token(args.tenant, args.service_principal, args.sp_secret, args.sp_audience) # noqa: E501
client = kfp.Client(host=args.kfp_host, existing_token=token)
pipelines = client.list_pipelines()
print(pipelines)
if __name__ == '__main__':
exit(main())