Skip to content

Update g3doc for remote gRPC usage #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions g3doc/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,37 @@ connection_config {
}
```

* Create the client stub and use it in Python
* Create the `MetadataStore` providing a `MetadataStoreClientConfig` object

```python
import ml_metadata as mlmd
from ml_metadata.metadata_store import metadata_store
from ml_metadata.proto import metadata_store_pb2

# Setup store client config
client_connection_config = metadata_store_pb2.MetadataStoreClientConfig()
client_connection_config.host = 'localhost'
client_connection_config.port = 8080

store = metadata_store.MetadataStore(client_connection_config)
```

* Use MLMD store following the same instructions provided in [Integrate ML Metadata into your ML Workflows](#integrate-ml-metadata-into-your-ml-workflows) section.

```python
# Create ArtifactType, e.g., DataSet
data_type = metadata_store_pb2.ArtifactType()
data_type.name = "DataSet"
data_type.properties["day"] = metadata_store_pb2.INT
data_type.properties["split"] = metadata_store_pb2.STRING
data_type_id = store.put_artifact_type(data_type)

...
```

Alternatively, to have complete control over gRPC requests and responses:

* Create the `MetadataStoreServiceStub` by supplying a gRPC connection and use it in Python

```python
from grpc import insecure_channel
Expand All @@ -402,7 +432,7 @@ channel = insecure_channel('localhost:8080')
stub = metadata_store_service_pb2_grpc.MetadataStoreServiceStub(channel)
```

* Use MLMD with RPC calls
* Use MLMD stub with RPC calls

```python
# Create ArtifactTypes, e.g., Data and Model
Expand Down