Compute¶
paystone.compute
is a wrapper around the many clients of google.cloud.compute
that go into creating machine learning services and training jobs. It has three main components:
- Clients.
- ML Stacks.
- Pricing.
Clients¶
paystone.compute.clients
contains one wrapper class per relevant Compute Engine resource in the stack. That stack is covered in detail in our MLServing API article. It also has one for Instances, as these are what training jobs are deployed on.
Because all Compute Engine clients have the same interface, there is a base class from which all of our wrapper classes inherit, which creates, updates, lists, gets, and deletes resources of the given type.
The primary way in which the resource-specific subclasses differ is in how they translate a given experiment and its infrastructure into a "resource specification", which is used when creating and updating resources. It uses the name of the experiment to name the resources, and uses the infrastructure configuration to provision the correct amount of compute and apply the correct settings to each component.
In short: create
, delete
, get
, list
, and update
all work in the same way. create_specification
and update_specification
are resource-specific.
ML Stacks¶
paystone.compute.ml
handles the application of clients to the two machine learning scenarios.
paystone.compute.ml.serving
composes the components of a serving application into a single interface. It can deploy and undeploy its resources in the correct order, and with the correct application of configuration from a data model containing experiment infrastructure. This is a ServingEndpoint
.
paystone.compute.ml.training
wraps a Compute Engine Instance, again applying the configuration from an experiment infrastructure data model to provision the correct resources for the instance.
Pricing¶
paystone.compute.pricing
is a utility for parsing the output of the Billing API to determine the cost of a given configuration. It is primarily used by the CLI function psml experiments price
to analyze the cost of a given experiment based on its serving and training configurations.
psml experiments price
looks up the machine type, GPU type, number of machines, and number of GPUs in the given experiment infrastructure to find their hourly prices, and adds up the cost into a single hourly number.