22 "cells" : [
33 {
44 "cell_type" : " markdown" ,
5+ "metadata" : {},
56 "source" : [
67 " # Getting Started with PrimeHub Python SDK\n " ,
78 " \n " ,
89 " PrimeHub Python SDK makes you automation with PrimeHub Platform.\n "
9- ],
10- "metadata" : {}
10+ ]
1111 },
1212 {
1313 "cell_type" : " markdown" ,
14+ "metadata" : {},
1415 "source" : [
1516 " In order to make the SDK working, you have to \n " ,
1617 " * install the library with `pip`\n " ,
1718 " * create a config file in the `~/.primehub/config.json`"
18- ],
19- "metadata" : {}
19+ ]
2020 },
2121 {
2222 "cell_type" : " markdown" ,
23+ "metadata" : {},
2324 "source" : [
2425 " ## Install with pip\n " ,
2526 " \n " ,
2627 " * Let's install PrimeHub Python SDK with `pip`. "
27- ],
28- "metadata" : {}
28+ ]
2929 },
3030 {
3131 "cell_type" : " code" ,
3232 "execution_count" : null ,
33+ "metadata" : {},
34+ "outputs" : [],
3335 "source" : [
3436 " !pip install primehub-python-sdk"
35- ],
36- "outputs" : [],
37- "metadata" : {}
37+ ]
3838 },
3939 {
4040 "cell_type" : " markdown" ,
41+ "metadata" : {},
4142 "source" : [
42- " ## Configuration file\n " ,
43+ " ## Request the API Token\n " ,
44+ " \n " ,
45+ " In order to get the token, you have to have an account in the PrimeHub cluster, the following process will ask you loing with your account.\n " ,
4346 " \n " ,
44- " * After installed, the SDK needs a configuration in the `~/.primehub/config.json`, in this structure:\n " ,
47+ " PLEASE UPDATE `PRIMEHUB_CLUSTER` to your cluster"
48+ ]
49+ },
50+ {
51+ "cell_type" : " code" ,
52+ "execution_count" : null ,
53+ "metadata" : {},
54+ "outputs" : [],
55+ "source" : [
56+ " PRIMEHUB_CLUSTER = 'http://primehub-python-sdk.primehub.io'\n " ,
4557 " \n " ,
46- " ```json\n " ,
47- " {\n " ,
48- " \" api-token\" : \" <api-token>\" ,\n " ,
49- " \" endpoint\" : \" https://<primehub-server-domain>/api/graphql\" ,\n " ,
50- " \" group\" : {\n " ,
51- " \" name\" : \" <the-name-of-current-group>\"\n " ,
52- " }\n " ,
53- " }\n " ,
54- " ```\n "
55- ],
56- "metadata" : {}
58+ " from primehub import PrimeHub, PrimeHubConfig\n " ,
59+ " ph = PrimeHub(PrimeHubConfig())\n " ,
60+ " ph.config.generate(PRIMEHUB_CLUSTER)"
61+ ]
5762 },
5863 {
5964 "cell_type" : " markdown" ,
65+ "metadata" : {},
6066 "source" : [
6167 " ### Verify configration with PrimeHub Python SDK"
62- ],
63- "metadata" : {}
68+ ]
6469 },
6570 {
6671 "cell_type" : " code" ,
6772 "execution_count" : null ,
73+ "metadata" : {},
74+ "outputs" : [],
6875 "source" : [
69- " from primehub import PrimeHub, PrimeHubConfig\n " ,
70- " ph = PrimeHub(PrimeHubConfig())\n " ,
71- " \n " ,
7276 " if ph.is_ready():\n " ,
7377 " print(\" PrimeHub Python SDK setup successfully\" )\n " ,
7478 " print(\" Current Group:\" , ph.primehub_config.current_group)\n " ,
7579 " else:\n " ,
7680 " print(\" PrimeHub Python SDK couldn't get the group information, please check the configuration.\" )"
77- ],
78- "outputs" : [],
79- "metadata" : {}
81+ ]
8082 },
8183 {
8284 "cell_type" : " markdown" ,
85+ "metadata" : {},
8386 "source" : [
8487 " ## Here is all available commands in the PrimeHub SDK\n " ,
8588 " \n " ,
8891 " `PrimeHub.<command>.<method>(*args, **kwargs)`\n " ,
8992 " \n " ,
9093 " You could look up all supported commands with `get_all_commands()` method."
91- ],
92- "metadata" : {}
94+ ]
9395 },
9496 {
9597 "cell_type" : " code" ,
9698 "execution_count" : null ,
99+ "metadata" : {},
100+ "outputs" : [],
97101 "source" : [
98102 " for cmd in ph.get_all_commands():\n " ,
99103 " print(cmd)"
100- ],
101- "outputs" : [],
102- "metadata" : {}
104+ ]
103105 },
104106 {
105107 "cell_type" : " markdown" ,
108+ "metadata" : {},
106109 "source" : [
107110 " ## Please check command details \n " ,
108111 " \n " ,
122125 " * schedules\n " ,
123126 " \n " ,
124127 " * notebooks command\n "
125- ],
126- "metadata" : {}
128+ ]
127129 }
128130 ],
129131 "metadata" : {
130132 "interpreter" : {
131133 "hash" : " b2ec084f4af1cfdda5df94d11be181b9273da0e6177ccab952b78bb7bed491ac"
132134 },
133135 "kernelspec" : {
134- "display_name" : " Python 3.7.6 64-bit ('venv': venv)" ,
135- "name" : " python3"
136+ "display_name" : " PrimeHub SDK" ,
137+ "language" : " python" ,
138+ "name" : " myenv"
136139 },
137140 "language_info" : {
138141 "codemirror_mode" : {
149152 },
150153 "nbformat" : 4 ,
151154 "nbformat_minor" : 4
152- }
155+ }
0 commit comments