init oc-scheduler

This commit is contained in:
mr 2024-08-08 17:31:17 +02:00
parent 273fc878f7
commit ff54f69127
20 changed files with 186 additions and 1708 deletions

View File

@ -1,4 +1,4 @@
FROM golang:alpine as builder
FROM golang:alpine AS builder
WORKDIR /app
@ -20,11 +20,11 @@ FROM scratch
WORKDIR /app
COPY --from=builder /app/oc-workflow /usr/bin/
COPY --from=builder /app/oc-scheduler /usr/bin/
COPY --from=builder /app/swagger /app/swagger
COPY docker_workflow.json /etc/oc/workflow.json
COPY docker_scheduler.json /etc/oc/scheduler.json
EXPOSE 8080
ENTRYPOINT ["oc-workflow"]
ENTRYPOINT ["oc-scheduler"]

View File

@ -1,6 +1,6 @@
# oc-workflow OpenCloud workflow service.
# oc-scheduler OpenCloud scheduler service.
Manages user workflows
Manages user schedulers
To build :
@ -10,7 +10,3 @@ To build :
If default Swagger page is displayed instead of tyour api, change url in swagger/index.html file to :
url: "swagger.json"
To launch demo workflow :
`./populate.sh ./demo.json`

View File

@ -1,4 +1,4 @@
appname = oc-workflow
appname = oc-scheduler
httpport = 8080
runmode = dev
autorender = false

View File

@ -1,99 +0,0 @@
package controllers
import (
"encoding/json"
oclib "cloud.o-forge.io/core/oc-lib"
beego "github.com/beego/beego/v2/server/web"
)
// Operations about workflow
type WorkflowController struct {
beego.Controller
}
// @Title Search
// @Description search workspace
// @Param search path string true "the word search you want to get"
// @Success 200 {workspace} models.workspace
// @router /search/:search [get]
func (o *WorkflowController) Search() {
// store and return Id or post with UUID
search := o.Ctx.Input.Param(":search")
o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(oclib.WORKFLOW))
o.ServeJSON()
}
// @Title Update
// @Description create workflows
// @Param id path string true "the workflowid you want to get"
// @Param body body models.workflow true "The workflow content"
// @Success 200 {object} models.workflow
// @router /:id [put]
func (o *WorkflowController) Put() {
// store and return Id or post with UUID
var res map[string]interface{}
id := o.Ctx.Input.Param(":id")
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.WORKFLOW), res, id)
o.ServeJSON()
}
// @Title Create
// @Description create workflows
// @Param data body json true "body for data content (Json format)"
// @Success 200 {object} models.workflow
// @router / [post]
func (o *WorkflowController) Post() {
var res map[string]interface{}
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
o.Data["json"] = oclib.StoreOne(oclib.LibDataEnum(oclib.WORKFLOW), res)
o.ServeJSON()
}
// @Title Publish
// @Description create workflows
// @Param id path string true "the workflowid you want to get"
// @Success 200 {object} models.workflow
// @router /publish/:id [post]
func (o *WorkflowController) Publish() {
id := o.Ctx.Input.Param(":id")
data := oclib.LoadOne(oclib.LibDataEnum(oclib.WORKFLOW), id)
if data.Data != nil {
o.Data["json"] = oclib.CopyOne(oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE), data.Data.Serialize())
} else {
o.Data["json"] = data
}
o.ServeJSON()
}
// @Title GetAll
// @Description find workflow by workflowid
// @Success 200 {workflow} models.workflow
// @router / [get]
func (o *WorkflowController) GetAll() {
o.Data["json"] = oclib.LoadAll(oclib.LibDataEnum(oclib.WORKFLOW))
o.ServeJSON()
}
// @Title Get
// @Description find workflow by workflowid
// @Param id path string true "the workflowid you want to get"
// @Success 200 {workflow} models.workflow
// @router /:id [get]
func (o *WorkflowController) Get() {
id := o.Ctx.Input.Param(":id")
o.Data["json"] = oclib.LoadOne(oclib.LibDataEnum(oclib.WORKFLOW), id)
o.ServeJSON()
}
// @Title Delete
// @Description delete the workflow
// @Param id path string true "The workflowId you want to delete"
// @Success 200 {string} delete success!
// @router /:id [delete]
func (o *WorkflowController) Delete() {
id := o.Ctx.Input.Param(":id")
o.Data["json"] = oclib.DeleteOne(oclib.LibDataEnum(oclib.WORKFLOW), id)
o.ServeJSON()
}

View File

@ -5,6 +5,7 @@ import (
oclib "cloud.o-forge.io/core/oc-lib"
dbs "cloud.o-forge.io/core/oc-lib/dbs"
w "cloud.o-forge.io/core/oc-lib/models/workflow"
beego "github.com/beego/beego/v2/server/web"
"go.mongodb.org/mongo-driver/bson/primitive"
)
@ -54,3 +55,52 @@ func (o *WorkflowExecutionController) Get() {
o.Data["json"] = oclib.LoadOne(oclib.LibDataEnum(oclib.WORKFLOW_EXECUTION), id)
o.ServeJSON()
}
// @Title Check
// @Description check booking
// @Param start_date path string "the booking start date" format "2006-01-02T15:04:05"
// @Param end_date path string "the booking end date" format "2006-01-02T15:04:05"
// @Success 200 {object} models.object
// @router /check/:start_date/:end_date [get]
func (o *WorkflowExecutionController) Check() {
// store and return Id or post with UUID
date, err := time.Parse("2006-01-02T15:04:05", o.Ctx.Input.Param(":start_date"))
if err != nil {
o.Data["json"] = map[string]interface{}{
"data": map[string]interface{}{
"is_available": false,
},
"code": 400,
"error": err,
}
} else {
date2, err := time.Parse("2006-01-02T15:04:05", o.Ctx.Input.Param(":end_date"))
if err != nil {
o.Data["json"] = map[string]interface{}{
"data": map[string]interface{}{
"is_available": false,
},
"code": 400,
"error": err,
}
} else {
workflow := &w.Workflow{}
workflow.Schedule = &w.WorkflowSchedule{Start: &date, End: &date2}
isAvailable := workflow.CheckBooking()
code := 200
err := ""
if !isAvailable {
code = 409
err = "booking not available"
}
o.Data["json"] = map[string]interface{}{
"data": map[string]interface{}{
"is_available": isAvailable,
},
"code": code,
"error": err,
}
}
}
o.ServeJSON()
}

View File

@ -1,83 +0,0 @@
package controllers
import (
"encoding/json"
oclib "cloud.o-forge.io/core/oc-lib"
beego "github.com/beego/beego/v2/server/web"
)
// Operations about workflow
type WorkflowResourceController struct {
beego.Controller
}
// @Title Search
// @Description search workspace
// @Param search path string true "the word search you want to get"
// @Success 200 {workspace} models.workspace
// @router /search/:search [get]
func (o *WorkflowResourceController) Search() {
// store and return Id or post with UUID
search := o.Ctx.Input.Param(":search")
o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE))
o.ServeJSON()
}
// @Title GetAll
// @Description find workflow by workflowid
// @Success 200 {workflow} models.workflow
// @router / [get]
func (o *WorkflowResourceController) GetAll() {
o.Data["json"] = oclib.LoadAll(oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE))
o.ServeJSON()
}
// @Title Update
// @Description create workflows
// @Param id path string true "the workflowid you want to get"
// @Param body body models.workflow true "The workflow content"
// @Success 200 {object} models.workflow
// @router /:id [put]
func (o *WorkflowResourceController) Put() {
// store and return Id or post with UUID
var res map[string]interface{}
id := o.Ctx.Input.Param(":id")
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE), res, id)
o.ServeJSON()
}
// @Title Create
// @Description create workflows
// @Param data body json true "body for data content (Json format)"
// @Success 200 {object} models.workflow
// @router / [post]
func (o *WorkflowResourceController) Post() {
var res map[string]interface{}
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
o.Data["json"] = oclib.StoreOne(oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE), res)
o.ServeJSON()
}
// @Title Get
// @Description find workflows
// @Param id path string true "the workflowid you want to get"
// @Success 200 {workflow} models.workflow
// @router /:id [get]
func (o *WorkflowResourceController) Get() {
id := o.Ctx.Input.Param(":id")
o.Data["json"] = oclib.LoadOne(oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE), id)
o.ServeJSON()
}
// @Title Delete
// @Description delete the workflow
// @Param id path string true "The workflowId you want to delete"
// @Success 200 {string} delete success!
// @router /:id [delete]
func (o *WorkflowResourceController) Delete() {
id := o.Ctx.Input.Param(":id")
o.Data["json"] = oclib.DeleteOne(oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE), id)
o.ServeJSON()
}

765
demo.json
View File

@ -1,765 +0,0 @@
[
{
"api": "/oc/data/",
"content": [
{
"name": "Mundi Sentienl 3 SRAL Images",
"short_description": "Mundi Sentinels 3 SAR Altiemter image",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Mundi Sentienl 3 SRAL Images.png",
"description": "A very long description of what this data is",
"owner": "Mundi Web",
"example": "string",
"datatype": "string",
"source_url": "string"
},
{
"name": "Mundi Sentienl 3 OLCI Images",
"short_description": "Mundi Sentinels 3 Ocean and land color Altiemter image",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Mundi Sentienl 3 OLCI Images.png",
"description": "A very long description of what this data is",
"owner": "Mundi Web",
"example": "string",
"datatype": "string",
"source_url": "string"
},
{
"name": "Meteo-France forecasts",
"short_description": "Meteo France weather forecasts",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Meteo-France forecasts.png",
"description": "A very long description of what this data is",
"owner": "Meteo-France",
"example": "string",
"datatype": "string",
"source_url": "string"
},
{
"name": "Meteo-France wind archive",
"short_description": "Meteo France wind archive",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Meteo-France wind archive.png",
"description": "A very long description of what this data is",
"owner": "Meteo-France",
"example": "string",
"datatype": "string",
"source_url": "string"
}
]
},
{
"api": "/oc/processing/",
"content": [
{
"name": "SAR High points",
"short_description": "SAR Altimeter High points extraction Software",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/SAR High points.png",
"description": "A very long description of what this data is",
"owner": "IRT",
"price": 300,
"license": "GPLv2",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 1024,
"storage": 300,
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2,
"source_url": "http://www.google.com"
},
{
"name": "Flammable vegetation slicer",
"short_description": "Analyze land cover and define optimum vegetation slices to prevent fire propagation",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Flammable vegetation slicer.png",
"description": "A very long description of what this data is",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 4096,
"storage": 30000,
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2,
"owner": "Gob.fr",
"price": 330,
"license": "Copyright",
"source_url": "http://www.google.com"
},
{
"name": "Long term fire risk mitigation planner",
"short_description": "Long term fire risk mitigation planner : provides list of actions to be performed to mitigate fire propagation",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Long term fire risk mitigation planner.png",
"description": "A very long description of what this data is",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 1024,
"disk_io": "30 MB/s",
"parallel": false,
"scaling_model": 2,
"owner": "Gob.fr",
"price": 30,
"license": "GPLv3",
"source_url": "http://www.google.com"
},
{
"name": "Fire propagation simulator",
"short_description": "Fire propagation simulator",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Fire propagation simulator.png",
"description": "A very long description of what this data is",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 8192,
"storage": 30000,
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2,
"owner": "Gob.fr",
"price": 39,
"license": "GPLv3",
"source_url": "http://www.google.com"
},
{
"name": "Environment builder",
"short_description": "build simulated environment from real environmental data and fire mitigation rules ",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Environment builder.png",
"description": "A very long description of what this data is",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 2049,
"storage": 500,
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2,
"owner": "Gob.fr",
"price": 39,
"license": "GPLv3",
"source_url": "http://www.google.com"
},
{
"name": "CURL",
"image" : "curlimages/curl:7.88.1",
"short_description": "Transfer or retrieve information from or to a server ",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/curl-logo.png",
"description": "curl is a tool for transferring data from or to a server. It supports these protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS.",
"owner": "IRT",
"price": 300,
"license": "GPLv2",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 1024,
"storage": 300,
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2,
"source_url": "http://www.google.com"
},
{
"name": "alpine",
"image" : "alpine:3.7",
"short_description": "A minimal Docker image ",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/alpine-logo.png",
"description": "Alpine Linux is a Linux distribution built around musl libc and BusyBox. The image is only 5 MB in size and has access to a package repository that is much more complete than other BusyBox based images. This makes Alpine Linux a great image base for utilities and even production applications",
"owner": "IRT",
"price": 300,
"license": "GPLv2",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 1024,
"storage": 300,
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2,
"source_url": "http://www.google.com"
},
{
"name": "alpr",
"image" : "openalpr/openalpr",
"short_description": "Open source Automatic License Plate Recognition library.",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/alpr-logo.png",
"description": "Deploy license plate and vehicle recognition with Rekors OpenALPR suite of solutions designed to provide invaluable vehicle intelligence which enhances business capabilities, automates tasks, and increases overall community safety!",
"owner": "IRT",
"price": 300,
"license": "GPLv2",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 1024,
"storage": 300,
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2,
"source_url": "http://www.google.com"
},
{
"name": "imagemagic",
"image" : "dpokidov/imagemagick:7.1.0-62-2",
"short_description": "ImageMagick® is a free, open-source software suite, used for editing and manipulating digital images.",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/imagemagic-logo.png",
"description": "Use ImageMagick to create, edit, compose, and convert digital images. Resize an image, crop it, change its shades and colors, add captions, and more.",
"owner": "IRT",
"price": 300,
"license": "GPLv2",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 1024,
"storage": 300,
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2,
"source_url": "http://www.google.com"
},
{
"name": "Mosquito server",
"short_description": "open source message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1.",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/mosquitto-logo.png",
"description": "A very long description of what this storage is",
"owner": "IRT",
"price": 300,
"license": "GPLv2",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": 1024,
"storage": 300,
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2,
"source_url": "http://www.google.com"
}
]
},
{
"api": "/oc/storage/",
"content": [
{
"name": "IRT risk database",
"short_description": "IRT Database instance",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/IRT risk database.png",
"owner": "IRT",
"description": "A very long description of what this storage is",
"type": "database",
"acronym": "DC_myDC",
"size": 4000,
"price": 90,
"encryption": false,
"redundancy": "RAID5",
"throughput": "r:200,w:150",
"source_url": "http://www.google.com"
},
{
"name": "IRT local file storage",
"short_description": "S3 compliant IRT file storage",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/IRT local file storage.png",
"description": "A very long description of what this storage is",
"owner": "IRT",
"acronym": "DC_myDC",
"size": 40000,
"encryption": false,
"redundancy": "RAID5S",
"throughput": "r:300,w:350",
"price": 90,
"source_url": "http://www.google.com"
}
]
},
{
"api": "/oc/datacenter/",
"content": [
{
"name": "Mundi datacenter",
"acronym": "DC_myDC",
"hosts": [
"localhost:49618",
"oc-catalog:49618"
],
"short_description": "Mundi Opencloud Instance",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Mundi datacenter.png",
"description": "A very long description of what this data is",
"type": "datacenter",
"bookingPrice": 650,
"owner": "IRT",
"cpus": [{
"cores": 8,
"architecture": "x86",
"shared": false
}],
"ram": {
"size": 16384,
"ecc": false
},
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"source_url": "http://www.google.com"
},
{
"name": "CNES datacenter",
"acronym": "DC_superDC1",
"hosts": [
"localhost:49619",
"dc1:49618"
],
"short_description": "CNES Opencloud Instance",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/CNES datacenter.png",
"description": "A very long description of what this data is",
"type": "datacenter",
"bookingPrice": 650,
"owner": "IRT",
"cpus": [{
"cores": 32,
"architecture": "x86",
"shared": false
}],
"ram": {
"size": 100000,
"ecc": false
},
"gpus": [],
"source_url": "http://www.google.com"
},
{
"name": "Meteo France datacenter",
"acronym": "DC_superDC2",
"hosts": [
"localhost:49620",
"dc2:49618"
],
"short_description": "Meteo France Opencloud Instance",
"logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Meteo France datacenter.png",
"description": "A very long description of what this data is",
"type": "datacenter",
"bookingPrice": 650,
"owner": "Meteo France",
"cpus": [{
"cores": 16,
"architecture": "x86",
"shared": false
}],
"ram": {
"size": 32786,
"ecc": false
},
"gpus": [
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
},
{
"cuda_cores": 10496,
"model": "RTX 3090 FE",
"memory": 24000,
"tensor_cores": 328
}
],
"source_url": "http://www.google.com"
}
]
}
]

View File

@ -1,13 +1,13 @@
version: '3.4'
services:
oc-workflow:
oc-scheduler:
environment:
- MONGO_DATABASE=DC_myDC
image: 'oc-workflow:latest'
image: 'oc-scheduler:latest'
ports:
- 8088:8080
container_name: oc-workflow
- 8090:8080
container_name: oc-scheduler
networks:
- catalog

4
docker_scheduler.json Normal file
View File

@ -0,0 +1,4 @@
{
"MONGO_URL":"mongodb://localhost:27017/",
"MONGO_DATABASE":"DC_myDC"
}

View File

@ -1,4 +0,0 @@
{
"MONGO_URL":"mongodb://mongo:27017/",
"MONGO_DATABASE":"DC_myDC"
}

21
go.mod
View File

@ -1,4 +1,4 @@
module oc-workflow
module oc-scheduler
go 1.22.0
@ -11,7 +11,7 @@ require (
)
require (
cloud.o-forge.io/core/oc-lib v0.0.0-20240806064253-29fcd0e34a72 // indirect
cloud.o-forge.io/core/oc-lib v0.0.0-20240808150044-2ae15c720ab6 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/beego/bee/v2 v2.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
@ -23,7 +23,7 @@ require (
github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3 // indirect
github.com/flosch/pongo2/v6 v6.0.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.5 // indirect
github.com/go-delve/delve v1.23.0 // indirect
github.com/go-delve/liner v1.2.3-0.20231231155935-4726ab1d7f62 // indirect
github.com/go-playground/locales v0.14.1 // indirect
@ -57,6 +57,7 @@ require (
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
@ -75,19 +76,19 @@ require (
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76 // indirect
go.mongodb.org/mongo-driver v1.16.0 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
go.mongodb.org/mongo-driver v1.16.1 // indirect
go.starlark.net v0.0.0-20240705175910-70002002b310 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.23.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect

34
go.sum
View File

@ -138,6 +138,22 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20240805134753-17f62b649523 h1:/gN4169dtvbyi
cloud.o-forge.io/core/oc-lib v0.0.0-20240805134753-17f62b649523/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240806064253-29fcd0e34a72 h1:JWnarWFrCNWPrk3CAuQ66YM/fzTTmvgBcLMSNCoIZaA=
cloud.o-forge.io/core/oc-lib v0.0.0-20240806064253-29fcd0e34a72/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240807165025-9040d141c8ca h1:Cc4kj+Aj2PRzC+1SFvwD/nichwWrerK2evwIn/KFoFk=
cloud.o-forge.io/core/oc-lib v0.0.0-20240807165025-9040d141c8ca/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808074700-47cd9361318f h1:LmJ5BJgN515exnFWZwmCXOdnTgRQA+uw6t5h9isDEQE=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808074700-47cd9361318f/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808075405-f45ad91687c4 h1:3xqz2s6r/PONqLKjoFX3P4OBYTn8eAfQNOT+zRVRCTE=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808075405-f45ad91687c4/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808092610-1cfd684e89b3 h1:goQa/fcp8ULInVerr5EmXBNftqQ5oKpb0pdHICSwgfA=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808092610-1cfd684e89b3/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808093957-5ac4492369be h1:a/6mBp9cEtOn7Wv2iQelVhL4296ytKSI8vQ1UNS2QFg=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808093957-5ac4492369be/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808135648-4688d9c68146 h1:D2ENrOnIpkGAs8G1RD/eNMI4UAukAb3cPIj9hYVWdXI=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808135648-4688d9c68146/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808142619-8dc009564a13 h1:JSkXsMjScEOhiZ+Xb7m3uQrWizcsCMd+xBtgNH3Ijg8=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808142619-8dc009564a13/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808150044-2ae15c720ab6 h1:uePDhEWN1kcF3XByLH/WTb/+wPDGe2cuG/jG0VqJOGw=
cloud.o-forge.io/core/oc-lib v0.0.0-20240808150044-2ae15c720ab6/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
@ -218,6 +234,8 @@ github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uq
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I=
github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s=
github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8Gql0kxn4=
github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
github.com/go-delve/delve v1.20.2 h1:rgPK7Iqb1oQk+i2Ilg0fpH6p5LqyixYiAt4N3Lhx4/Y=
@ -444,6 +462,8 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
@ -534,10 +554,14 @@ github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gi
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76 h1:tBiBTKHnIjovYoLX/TPkcf+OjqqKGQrPtGT3Foz+Pgo=
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76/go.mod h1:SQliXeA7Dhkt//vS29v3zpbEwoa+zb2Cn5xj5uO4K5U=
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.mongodb.org/mongo-driver v1.16.0 h1:tpRsfBJMROVHKpdGyc1BBEzzjDUWjItxbVSZ8Ls4BQ4=
go.mongodb.org/mongo-driver v1.16.0/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw=
go.mongodb.org/mongo-driver v1.16.1 h1:rIVLL3q0IHM39dvE+z2ulZLp9ENZKThVfuvN/IiN4l8=
go.mongodb.org/mongo-driver v1.16.1/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.starlark.net v0.0.0-20220816155156-cfacd8902214 h1:MqijAN3S61c7KWasOk+zIqIjHQPN6WUra/X3+YAkQxQ=
@ -564,6 +588,8 @@ golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -609,6 +635,8 @@ golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -620,6 +648,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -649,6 +679,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -659,6 +691,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

10
main.go
View File

@ -1,20 +1,20 @@
package main
import (
_ "oc-workflow/routers"
_ "oc-scheduler/routers"
oclib "cloud.o-forge.io/core/oc-lib"
beego "github.com/beego/beego/v2/server/web"
"github.com/goraz/onion"
)
const defaultConfigFile = "/etc/oc/workflow.json"
const localConfigFile = "./docker_workflow.json"
const defaultConfigFile = "/etc/oc/scheduler.json"
const localConfigFile = "./docker_scheduler.json"
func main() {
configFile := ""
var o *onion.Onion
l3 := onion.NewEnvLayerPrefix("_", "OCWORKFLOW_")
l3 := onion.NewEnvLayerPrefix("_", "OCSCHEDULER_")
l1, err := onion.NewFileLayer(localConfigFile, nil)
if err == nil {
configFile = localConfigFile
@ -36,7 +36,7 @@ func main() {
o.GetStringDefault("MONGO_URL", "mongodb://127.0.0.1:27017"),
o.GetStringDefault("MONGO_DATABASE", "DC_myDC"),
)
oclib.Init("oc-workflow")
oclib.Init("oc-scheduler")
// Normal beego init
//if beego.BConfig.RunMode == "dev" {
beego.BConfig.WebConfig.DirectoryIndex = true

Binary file not shown.

View File

@ -1,41 +0,0 @@
#!/usr/bin/bash
# Must specify a JSON with a following structure:
ENDPOINT="http://localhost:8087"
if [[ $DOCKER_ENVIRONMENT ]]; then
ENDPOINT="http://oc-catalog:8087"
fi
if [[ $DOCKER_ENDPOINT ]]; then
ENDPOINT="$DOCKER_ENDPOINT"
fi
[[ -z $1 ]] && { echo "Must specify a json path"; exit 1; }
[[ ! -f $1 ]] && { echo "$1 is not a file"; exit 1; }
cat "$1" | jq empty || { echo "$1 is not a valid JSON"; exit 1; }
########
while read row; do
TRGT_ENDPOINT=$(echo $row | jq -r '.api')
while read item; do
echo `echo $item | jq -r '.name'` to $ENDPOINT${TRGT_ENDPOINT}
answer=$(curl --fail "$ENDPOINT${TRGT_ENDPOINT}" \
-X POST \
-H "Content-Type: application/json" \
-d "$item")
echo $answer
if [[ $? -ne 0 || "$answer" == *"<html>"* ]]; then
exit 1
fi
done < <(echo "$row" | jq -c '.content[]')
done < <(jq -c '.[]' $1)
echo
echo
echo
echo "All models submitted correctly!"

View File

@ -7,7 +7,7 @@ import (
func init() {
beego.GlobalControllerRouter["oc-workflow/controllers:VersionController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:VersionController"],
beego.GlobalControllerRouter["oc-scheduler/controllers:VersionController"] = append(beego.GlobalControllerRouter["oc-scheduler/controllers:VersionController"],
beego.ControllerComments{
Method: "GetAll",
Router: `/`,
@ -16,16 +16,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"],
beego.ControllerComments{
Method: "Post",
Router: `/`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"],
beego.GlobalControllerRouter["oc-scheduler/controllers:WorkflowExecutionController"] = append(beego.GlobalControllerRouter["oc-scheduler/controllers:WorkflowExecutionController"],
beego.ControllerComments{
Method: "GetAll",
Router: `/`,
@ -34,16 +25,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"],
beego.ControllerComments{
Method: "Put",
Router: `/:id`,
AllowHTTPMethods: []string{"put"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"],
beego.GlobalControllerRouter["oc-scheduler/controllers:WorkflowExecutionController"] = append(beego.GlobalControllerRouter["oc-scheduler/controllers:WorkflowExecutionController"],
beego.ControllerComments{
Method: "Get",
Router: `/:id`,
@ -52,52 +34,16 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"],
beego.GlobalControllerRouter["oc-scheduler/controllers:WorkflowExecutionController"] = append(beego.GlobalControllerRouter["oc-scheduler/controllers:WorkflowExecutionController"],
beego.ControllerComments{
Method: "Delete",
Router: `/:id`,
AllowHTTPMethods: []string{"delete"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"],
beego.ControllerComments{
Method: "Publish",
Router: `/publish/:id`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowController"],
beego.ControllerComments{
Method: "Search",
Router: `/search/:search`,
Method: "Check",
Router: `/check/:start_date/:end_date`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowExecutionController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowExecutionController"],
beego.ControllerComments{
Method: "GetAll",
Router: `/`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowExecutionController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowExecutionController"],
beego.ControllerComments{
Method: "Get",
Router: `/:id`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowExecutionController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowExecutionController"],
beego.GlobalControllerRouter["oc-scheduler/controllers:WorkflowExecutionController"] = append(beego.GlobalControllerRouter["oc-scheduler/controllers:WorkflowExecutionController"],
beego.ControllerComments{
Method: "Search",
Router: `/search/:start_date/:end_date`,
@ -106,58 +52,4 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"],
beego.ControllerComments{
Method: "GetAll",
Router: `/`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"],
beego.ControllerComments{
Method: "Post",
Router: `/`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"],
beego.ControllerComments{
Method: "Put",
Router: `/:id`,
AllowHTTPMethods: []string{"put"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"],
beego.ControllerComments{
Method: "Get",
Router: `/:id`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"],
beego.ControllerComments{
Method: "Delete",
Router: `/:id`,
AllowHTTPMethods: []string{"delete"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"] = append(beego.GlobalControllerRouter["oc-workflow/controllers:WorkflowResourceController"],
beego.ControllerComments{
Method: "Search",
Router: `/search/:search`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
}

View File

@ -8,23 +8,13 @@
package routers
import (
"oc-workflow/controllers"
"oc-scheduler/controllers"
beego "github.com/beego/beego/v2/server/web"
)
func init() {
ns := beego.NewNamespace("/oc/",
beego.NSNamespace("/workflow",
beego.NSInclude(
&controllers.WorkflowController{},
),
),
beego.NSNamespace("/workflow/resource",
beego.NSInclude(
&controllers.WorkflowResourceController{},
),
),
beego.NSNamespace("/workflow_execution",
beego.NSInclude(
&controllers.WorkflowExecutionController{},

View File

@ -29,312 +29,6 @@
}
}
},
"/workflow/": {
"get": {
"tags": [
"workflow"
],
"description": "find workflow by workflowid\n\u003cbr\u003e",
"operationId": "WorkflowController.GetAll",
"responses": {
"200": {
"description": "{workflow} models.workflow"
}
}
},
"post": {
"tags": [
"workflow"
],
"description": "create workflows\n\u003cbr\u003e",
"operationId": "WorkflowController.Create",
"parameters": [
{
"in": "body",
"name": "data",
"description": "body for data content (Json format)",
"required": true,
"schema": {
"$ref": "#/definitions/json"
}
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/models.workflow"
}
}
}
}
},
"/workflow/publish/{id}": {
"post": {
"tags": [
"workflow"
],
"description": "create workflows\n\u003cbr\u003e",
"operationId": "WorkflowController.Publish",
"parameters": [
{
"in": "path",
"name": "id",
"description": "the workflowid you want to get",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/models.workflow"
}
}
}
}
},
"/workflow/resource/": {
"get": {
"tags": [
"workflow/resource"
],
"description": "find workflow by workflowid\n\u003cbr\u003e",
"operationId": "WorkflowResourceController.GetAll",
"responses": {
"200": {
"description": "{workflow} models.workflow"
}
}
},
"post": {
"tags": [
"workflow/resource"
],
"description": "create workflows\n\u003cbr\u003e",
"operationId": "WorkflowResourceController.Create",
"parameters": [
{
"in": "body",
"name": "data",
"description": "body for data content (Json format)",
"required": true,
"schema": {
"$ref": "#/definitions/json"
}
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/models.workflow"
}
}
}
}
},
"/workflow/resource/search/{search}": {
"get": {
"tags": [
"workflow/resource"
],
"description": "search workspace\n\u003cbr\u003e",
"operationId": "WorkflowResourceController.Search",
"parameters": [
{
"in": "path",
"name": "search",
"description": "the word search you want to get",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{workspace} models.workspace"
}
}
}
},
"/workflow/resource/{id}": {
"get": {
"tags": [
"workflow/resource"
],
"description": "find workflows\n\u003cbr\u003e",
"operationId": "WorkflowResourceController.Get",
"parameters": [
{
"in": "path",
"name": "id",
"description": "the workflowid you want to get",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{workflow} models.workflow"
}
}
},
"put": {
"tags": [
"workflow/resource"
],
"description": "create workflows\n\u003cbr\u003e",
"operationId": "WorkflowResourceController.Update",
"parameters": [
{
"in": "path",
"name": "id",
"description": "the workflowid you want to get",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "body",
"description": "The workflow content",
"required": true,
"schema": {
"$ref": "#/definitions/models.workflow"
}
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/models.workflow"
}
}
}
},
"delete": {
"tags": [
"workflow/resource"
],
"description": "delete the workflow\n\u003cbr\u003e",
"operationId": "WorkflowResourceController.Delete",
"parameters": [
{
"in": "path",
"name": "id",
"description": "The workflowId you want to delete",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{string} delete success!"
}
}
}
},
"/workflow/search/{search}": {
"get": {
"tags": [
"workflow"
],
"description": "search workspace\n\u003cbr\u003e",
"operationId": "WorkflowController.Search",
"parameters": [
{
"in": "path",
"name": "search",
"description": "the word search you want to get",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{workspace} models.workspace"
}
}
}
},
"/workflow/{id}": {
"get": {
"tags": [
"workflow"
],
"description": "find workflow by workflowid\n\u003cbr\u003e",
"operationId": "WorkflowController.Get",
"parameters": [
{
"in": "path",
"name": "id",
"description": "the workflowid you want to get",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{workflow} models.workflow"
}
}
},
"put": {
"tags": [
"workflow"
],
"description": "create workflows\n\u003cbr\u003e",
"operationId": "WorkflowController.Update",
"parameters": [
{
"in": "path",
"name": "id",
"description": "the workflowid you want to get",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "body",
"description": "The workflow content",
"required": true,
"schema": {
"$ref": "#/definitions/models.workflow"
}
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/models.workflow"
}
}
}
},
"delete": {
"tags": [
"workflow"
],
"description": "delete the workflow\n\u003cbr\u003e",
"operationId": "WorkflowController.Delete",
"parameters": [
{
"in": "path",
"name": "id",
"description": "The workflowId you want to delete",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{string} delete success!"
}
}
}
},
"/workflow_execution/": {
"get": {
"tags": [
@ -349,6 +43,39 @@
}
}
},
"/workflow_execution/check/{start_date}/{end_date}": {
"get": {
"tags": [
"workflow_execution"
],
"description": "check booking\n\u003cbr\u003e",
"operationId": "WorkflowExecutionController.Check",
"parameters": [
{
"in": "path",
"name": "start_date",
"description": "2006-01-02T15:04:05",
"type": "string",
"default": "the booking start date"
},
{
"in": "path",
"name": "end_date",
"description": "2006-01-02T15:04:05",
"type": "string",
"default": "the booking end date"
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/models.object"
}
}
}
}
},
"/workflow_execution/search/{start_date}/{end_date}": {
"get": {
"tags": [
@ -404,24 +131,12 @@
}
},
"definitions": {
"json": {
"title": "json",
"type": "object"
},
"models.workflow": {
"title": "workflow",
"models.object": {
"title": "object",
"type": "object"
}
},
"tags": [
{
"name": "workflow",
"description": "Operations about workflow\n"
},
{
"name": "workflow/resource",
"description": "Operations about workflow\n"
},
{
"name": "workflow_execution",
"description": "Operations about workflow\n"

View File

@ -23,233 +23,6 @@ paths:
responses:
"200":
description: ""
/workflow/:
get:
tags:
- workflow
description: |-
find workflow by workflowid
<br>
operationId: WorkflowController.GetAll
responses:
"200":
description: '{workflow} models.workflow'
post:
tags:
- workflow
description: |-
create workflows
<br>
operationId: WorkflowController.Create
parameters:
- in: body
name: data
description: body for data content (Json format)
required: true
schema:
$ref: '#/definitions/json'
responses:
"200":
description: ""
schema:
$ref: '#/definitions/models.workflow'
/workflow/{id}:
get:
tags:
- workflow
description: |-
find workflow by workflowid
<br>
operationId: WorkflowController.Get
parameters:
- in: path
name: id
description: the workflowid you want to get
required: true
type: string
responses:
"200":
description: '{workflow} models.workflow'
put:
tags:
- workflow
description: |-
create workflows
<br>
operationId: WorkflowController.Update
parameters:
- in: path
name: id
description: the workflowid you want to get
required: true
type: string
- in: body
name: body
description: The workflow content
required: true
schema:
$ref: '#/definitions/models.workflow'
responses:
"200":
description: ""
schema:
$ref: '#/definitions/models.workflow'
delete:
tags:
- workflow
description: |-
delete the workflow
<br>
operationId: WorkflowController.Delete
parameters:
- in: path
name: id
description: The workflowId you want to delete
required: true
type: string
responses:
"200":
description: '{string} delete success!'
/workflow/publish/{id}:
post:
tags:
- workflow
description: |-
create workflows
<br>
operationId: WorkflowController.Publish
parameters:
- in: path
name: id
description: the workflowid you want to get
required: true
type: string
responses:
"200":
description: ""
schema:
$ref: '#/definitions/models.workflow'
/workflow/resource/:
get:
tags:
- workflow/resource
description: |-
find workflow by workflowid
<br>
operationId: WorkflowResourceController.GetAll
responses:
"200":
description: '{workflow} models.workflow'
post:
tags:
- workflow/resource
description: |-
create workflows
<br>
operationId: WorkflowResourceController.Create
parameters:
- in: body
name: data
description: body for data content (Json format)
required: true
schema:
$ref: '#/definitions/json'
responses:
"200":
description: ""
schema:
$ref: '#/definitions/models.workflow'
/workflow/resource/{id}:
get:
tags:
- workflow/resource
description: |-
find workflows
<br>
operationId: WorkflowResourceController.Get
parameters:
- in: path
name: id
description: the workflowid you want to get
required: true
type: string
responses:
"200":
description: '{workflow} models.workflow'
put:
tags:
- workflow/resource
description: |-
create workflows
<br>
operationId: WorkflowResourceController.Update
parameters:
- in: path
name: id
description: the workflowid you want to get
required: true
type: string
- in: body
name: body
description: The workflow content
required: true
schema:
$ref: '#/definitions/models.workflow'
responses:
"200":
description: ""
schema:
$ref: '#/definitions/models.workflow'
delete:
tags:
- workflow/resource
description: |-
delete the workflow
<br>
operationId: WorkflowResourceController.Delete
parameters:
- in: path
name: id
description: The workflowId you want to delete
required: true
type: string
responses:
"200":
description: '{string} delete success!'
/workflow/resource/search/{search}:
get:
tags:
- workflow/resource
description: |-
search workspace
<br>
operationId: WorkflowResourceController.Search
parameters:
- in: path
name: search
description: the word search you want to get
required: true
type: string
responses:
"200":
description: '{workspace} models.workspace'
/workflow/search/{search}:
get:
tags:
- workflow
description: |-
search workspace
<br>
operationId: WorkflowController.Search
parameters:
- in: path
name: search
description: the word search you want to get
required: true
type: string
responses:
"200":
description: '{workspace} models.workspace'
/workflow_execution/:
get:
tags:
@ -278,6 +51,30 @@ paths:
responses:
"200":
description: '{workflow} models.workflow'
/workflow_execution/check/{start_date}/{end_date}:
get:
tags:
- workflow_execution
description: |-
check booking
<br>
operationId: WorkflowExecutionController.Check
parameters:
- in: path
name: start_date
description: 2006-01-02T15:04:05
type: string
default: the booking start date
- in: path
name: end_date
description: 2006-01-02T15:04:05
type: string
default: the booking end date
responses:
"200":
description: ""
schema:
$ref: '#/definitions/models.object'
/workflow_execution/search/{start_date}/{end_date}:
get:
tags:
@ -301,19 +98,10 @@ paths:
"200":
description: '{workspace} models.workspace'
definitions:
json:
title: json
type: object
models.workflow:
title: workflow
models.object:
title: object
type: object
tags:
- name: workflow
description: |
Operations about workflow
- name: workflow/resource
description: |
Operations about workflow
- name: workflow_execution
description: |
Operations about workflow

View File

@ -6,7 +6,7 @@ import (
"testing"
"runtime"
"path/filepath"
_ "oc-workflow/routers"
_ "oc-scheduler/routers"
beego "github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/core/logs"