Skip to content

Commit 89a8936

Browse files
authored
W-14276657: Updating deploy and update_endpoint_info documentation in tabpy_tools (#647)
* Updating documentation to cover updated functionality for deploy, and new functionality for update_endpoint_info * fixed small linting error in markdown * fixed small linting error in markdown * fixed small linting error in markdown * remove spaces from keyword arguments in documentation
1 parent de7b8ab commit 89a8936

File tree

1 file changed

+62
-10
lines changed

1 file changed

+62
-10
lines changed

docs/tabpy-tools.md

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ def add(x,y):
7171
client.deploy('add', add, 'Adds two numbers x and y')
7272
```
7373

74+
If you would like your function to be visible in Tableau using the Custom Functions
75+
Explorer, you will need to deploy setting the optional `is_public` parameter to True.
76+
Functions that have `is_public` set to False, or unset will not be visible.
77+
78+
```python
79+
client.deploy('add', add, 'Adds two numbers x and y', is_public=True)
80+
```
81+
7482
The next example is more complex, using scikit-learn's clustering API:
7583

7684
```python
@@ -100,16 +108,6 @@ endpoint named `clustering`.
100108
It is now reachable as a [REST API](server-rest.md#httppost-queryendpoint), as
101109
well as through the TabPy tools - for details see the next section.
102110

103-
You can re-deploy a function (for example, after you modified its code) by setting
104-
the `override` parameter to `True`:
105-
106-
```python
107-
client.deploy('add', add, 'Adds two numbers x and y', override=True)
108-
```
109-
110-
Each re-deployment of an endpoint will increment its version number, which is also
111-
returned as part of the query result.
112-
113111
When deploying endpoints which rely on supervised learning models, you may want to
114112
load a saved model instead of training on-the-fly for performance reasons.
115113

@@ -158,9 +156,63 @@ The endpoints that are no longer needed can be removed the following way:
158156
```python
159157

160158
client.remove('WillItDefault')
159+
```
160+
161+
## Updating Existing Functions
162+
163+
You can re-deploy a function (for example, after you modified its code) by setting
164+
the `override` parameter to `True`:
165+
166+
```python
167+
client.deploy('add', add, 'Adds two numbers x and y', override=True)
168+
```
169+
170+
Each re-deployment of an endpoint will increment its version number, which is also
171+
returned as part of the query result.
172+
173+
If you do not want to modify the code of a function, you have the option to
174+
update using `update_endpoint_info`. This allows users to update the
175+
description, schema, or whether a function is public using just the function
176+
name.
161177

178+
To update the description of an existing function:
179+
180+
```python
181+
client.update_endpoint_info('add', description = 'Updated description for add')
162182
```
163183

184+
To update whether an existing function is public:
185+
186+
```python
187+
client.update_endpoint_info('add', is_public=True)
188+
```
189+
190+
To update the schema associated with an existing function:
191+
192+
```python
193+
updatedSchema = generate_schema(
194+
input={'x': 3, 'y': 2},
195+
output=5,
196+
input_description={'x': 'first value',
197+
'y': 'second value'},
198+
output_description='the sum of x and y')
199+
200+
201+
client.update_endpoint_info('add', schema=updatedSchema)
202+
```
203+
204+
To update `description`, `is_public`, and `schema` all at once:
205+
206+
```python
207+
client.update_endpoint_info('add',
208+
is_public=True,
209+
description='Updated description for add',
210+
schema=updatedSchema)
211+
```
212+
213+
Each update of an endpoint will increment its version number, which is also
214+
returned as part of the query result.
215+
164216
## Predeployed Functions
165217

166218
### Deploying Models Shipped With TabPy

0 commit comments

Comments
 (0)