Skip to content

Commit

Permalink
W-14276657: Updating deploy and update_endpoint_info documentation in…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
jmoens authored Sep 19, 2024
1 parent de7b8ab commit 89a8936
Showing 1 changed file with 62 additions and 10 deletions.
72 changes: 62 additions & 10 deletions docs/tabpy-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ def add(x,y):
client.deploy('add', add, 'Adds two numbers x and y')
```

If you would like your function to be visible in Tableau using the Custom Functions
Explorer, you will need to deploy setting the optional `is_public` parameter to True.
Functions that have `is_public` set to False, or unset will not be visible.

```python
client.deploy('add', add, 'Adds two numbers x and y', is_public=True)
```

The next example is more complex, using scikit-learn's clustering API:

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

You can re-deploy a function (for example, after you modified its code) by setting
the `override` parameter to `True`:

```python
client.deploy('add', add, 'Adds two numbers x and y', override=True)
```

Each re-deployment of an endpoint will increment its version number, which is also
returned as part of the query result.

When deploying endpoints which rely on supervised learning models, you may want to
load a saved model instead of training on-the-fly for performance reasons.

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

client.remove('WillItDefault')
```

## Updating Existing Functions

You can re-deploy a function (for example, after you modified its code) by setting
the `override` parameter to `True`:

```python
client.deploy('add', add, 'Adds two numbers x and y', override=True)
```

Each re-deployment of an endpoint will increment its version number, which is also
returned as part of the query result.

If you do not want to modify the code of a function, you have the option to
update using `update_endpoint_info`. This allows users to update the
description, schema, or whether a function is public using just the function
name.

To update the description of an existing function:

```python
client.update_endpoint_info('add', description = 'Updated description for add')
```

To update whether an existing function is public:

```python
client.update_endpoint_info('add', is_public=True)
```

To update the schema associated with an existing function:

```python
updatedSchema = generate_schema(
input={'x': 3, 'y': 2},
output=5,
input_description={'x': 'first value',
'y': 'second value'},
output_description='the sum of x and y')


client.update_endpoint_info('add', schema=updatedSchema)
```

To update `description`, `is_public`, and `schema` all at once:

```python
client.update_endpoint_info('add',
is_public=True,
description='Updated description for add',
schema=updatedSchema)
```

Each update of an endpoint will increment its version number, which is also
returned as part of the query result.

## Predeployed Functions

### Deploying Models Shipped With TabPy
Expand Down

0 comments on commit 89a8936

Please sign in to comment.