Service

class Service : KotlinCustomResource

Provides a PAI Service resource. Eas service instance. For information about PAI Service and how to use it, see What is Service.

NOTE: Available since v1.238.0.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = new alicloud.pai.Service("default", {
labels: {
"0": JSON.stringify({
LabelKey: "examplekey",
LabelValue: "examplevalue",
}),
},
develop: "false",
serviceConfig: JSON.stringify({
metadata: {
cpu: 1,
gpu: 0,
instance: 1,
memory: 2000,
name: "tfexample",
rpc: {
keepalive: 70000,
},
},
model_path: "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz",
processor_entry: "libecho.so",
processor_path: "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz",
processor_type: "cpp",
}),
});
import pulumi
import json
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.pai.Service("default",
labels={
"0": json.dumps({
"LabelKey": "examplekey",
"LabelValue": "examplevalue",
}),
},
develop="false",
service_config=json.dumps({
"metadata": {
"cpu": 1,
"gpu": 0,
"instance": 1,
"memory": 2000,
"name": "tfexample",
"rpc": {
"keepalive": 70000,
},
},
"model_path": "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz",
"processor_entry": "libecho.so",
"processor_path": "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz",
"processor_type": "cpp",
}))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = new AliCloud.Pai.Service("default", new()
{
Labels =
{
{ "0", JsonSerializer.Serialize(new Dictionary<string, object?>
{
["LabelKey"] = "examplekey",
["LabelValue"] = "examplevalue",
}) },
},
Develop = "false",
ServiceConfig = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["metadata"] = new Dictionary<string, object?>
{
["cpu"] = 1,
["gpu"] = 0,
["instance"] = 1,
["memory"] = 2000,
["name"] = "tfexample",
["rpc"] = new Dictionary<string, object?>
{
["keepalive"] = 70000,
},
},
["model_path"] = "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz",
["processor_entry"] = "libecho.so",
["processor_path"] = "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz",
["processor_type"] = "cpp",
}),
});
});
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/pai"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"LabelKey": "examplekey",
"LabelValue": "examplevalue",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
tmpJSON1, err := json.Marshal(map[string]interface{}{
"metadata": map[string]interface{}{
"cpu": 1,
"gpu": 0,
"instance": 1,
"memory": 2000,
"name": "tfexample",
"rpc": map[string]interface{}{
"keepalive": 70000,
},
},
"model_path": "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz",
"processor_entry": "libecho.so",
"processor_path": "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz",
"processor_type": "cpp",
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
_, err = pai.NewService(ctx, "default", &pai.ServiceArgs{
Labels: pulumi.StringMap{
"0": pulumi.String(json0),
},
Develop: pulumi.String("false"),
ServiceConfig: pulumi.String(json1),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.pai.Service;
import com.pulumi.alicloud.pai.ServiceArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
var default_ = new Service("default", ServiceArgs.builder()
.labels(Map.of("0", serializeJson(
jsonObject(
jsonProperty("LabelKey", "examplekey"),
jsonProperty("LabelValue", "examplevalue")
))))
.develop("false")
.serviceConfig(serializeJson(
jsonObject(
jsonProperty("metadata", jsonObject(
jsonProperty("cpu", 1),
jsonProperty("gpu", 0),
jsonProperty("instance", 1),
jsonProperty("memory", 2000),
jsonProperty("name", "tfexample"),
jsonProperty("rpc", jsonObject(
jsonProperty("keepalive", 70000)
))
)),
jsonProperty("model_path", "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz"),
jsonProperty("processor_entry", "libecho.so"),
jsonProperty("processor_path", "http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz"),
jsonProperty("processor_type", "cpp")
)))
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
default:
type: alicloud:pai:Service
properties:
labels:
'0':
fn::toJSON:
LabelKey: examplekey
LabelValue: examplevalue
develop: 'false'
serviceConfig:
fn::toJSON:
metadata:
cpu: 1
gpu: 0
instance: 1
memory: 2000
name: tfexample
rpc:
keepalive: 70000
model_path: http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz
processor_entry: libecho.so
processor_path: http://eas-data.oss-cn-shanghai.aliyuncs.com/processors/echo_processor_release.tar.gz
processor_type: cpp

Import

PAI Service can be imported using the id, e.g.

$ pulumi import alicloud:pai/service:Service example <id>

Properties

Link copied to clipboard
val createTime: Output<String>

Creation time of the service

Link copied to clipboard
val develop: Output<String>?

Whether to enter the development mode.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val labels: Output<Map<String, String>>?

Service Tag.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val regionId: Output<String>

The region ID of the resource

Link copied to clipboard
val serviceConfig: Output<String>

Service configuration information. Please refer to https://www.alibabacloud.com/help/en/pai/user-guide/parameters-of-model-services

Link copied to clipboard
val status: Output<String>

Service Current Status, valid values Running, Stopped.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val workspaceId: Output<String>?

Workspace id