Skip to content

Resolve "Implement the algorithm to save the compute job's result"

Checklist

  • I have update updated the @version string in main.go. See https://semver.org/
  • I have update CHANGELOG.md with a short description of changes.
  • I have run swag init to update the swagger docs.

Description

What this MR has:

  • Code to create a gist
  • Code to update gist every 2 minutes with docker logs of running container while the container is running

What this MR does not have:

  • Code to send back the ack message
  • Implementation of this idea
  • The personal access token from GitHub. NuNet need to have a profile/org on GitHub.

How to test this branch

Use this deployment body:

{
  "address_user": "foobar-address",
  "max_ntx": 10,
  "blockchain": "Cardano",
  "service_type": "ml-training-gpu",
  "timestamp": "2022-11-07T16:57:18.179522557+05:30",
  "params": {
    "image_id": "registry.gitlab.com/nunet/ml-on-gpu/ml-on-gpu-service/develop/pytorch",
    "model_url": "https://raw.githubusercontent.com/PacktPublishing/Hands-On-GPU-Computing-with-Python/master/Chapter10/10.10.%20Writing%20your%20first%20GPU%20accelerated%20machine%20learning%20programs/pytorch_cifar-10.py",
    "packages": [
      "matplotlib"
    ]
  },
  "constraints": {
    "complexity": "Low",
    "cpu": 500,
    "ram": 2000,
    "vram": 2000,
    "power": 170,
    "time": 10
  },
  "traceinfo": {
    "trace_id": "433dc413e887686d",
    "span_id": "aafa0f4880a8cbd1456f039110ed043d",
    "trace_flags": "01",
    "trace_state": ""
  }
}

Save above json with name deployment_request.json. Save below file at <dms-repo>/cmd/deployment/main.go:

package main

import (
	"encoding/json"
	"fmt"
	"os"
	"time"

	"gitlab.com/nunet/device-management-service/docker"
	"gitlab.com/nunet/device-management-service/models"
)

func main() {
	runDeployment()
}

func runDeployment() {
	depReqBytes, err := os.ReadFile("deployment_request.json")
	if err != nil {
		panic(err)
	}

	var depReq models.DeploymentRequest
	var depRes models.DeploymentResponse

	err = json.Unmarshal(depReqBytes, &depReq)
	if err != nil {
		panic(err)
	}

	response := docker.HandleDeployment(depReq, depRes)
	fmt.Println(response)

	time.Sleep(1 * time.Hour)
}

Closes #64 (closed)

Edited by Santosh Kumar

Merge request reports

Loading