Skip to content

Commit

Permalink
feat: omit deployCost if 0, and populate pod name if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
flash-singh committed Dec 10, 2022
1 parent 631b631 commit 76c420f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io/ioutil"
"strings"
)

type PodOut struct {
Expand Down Expand Up @@ -108,7 +109,7 @@ func GetPods() (pods []*Pod, err error) {
type CreatePodInput struct {
CloudType string `json:"cloudType"`
ContainerDiskInGb int `json:"containerDiskInGb"`
DeployCost float32 `json:"deployCost"`
DeployCost float32 `json:"deployCost,omitempty"`
DockerArgs string `json:"dockerArgs"`
Env []*PodEnv `json:"env"`
GpuCount int `json:"gpuCount"`
Expand All @@ -127,6 +128,11 @@ type PodEnv struct {
}

func CreatePod(podInput *CreatePodInput) (pod map[string]interface{}, err error) {
if podInput.Name == "" {
names := strings.Split(podInput.ImageName, ":")
podInput.Name = names[0]
}

input := Input{
Query: `
mutation createPod($input: PodFindAndDeployOnDemandInput!) {
Expand Down

0 comments on commit 76c420f

Please sign in to comment.