Sync with latest version of clone executor

This commit is contained in:
Matias committed 2019-04-01 12:09:16 +02:00
1 parent 3dd3e6dbd6
commit 9a2d671a97
14 files changed
+500 -452

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
{
"apiVersion": "batch/v1",
"kind": "Job",
"metadata": {
"labels": {
"app": "clone-executor"
},
"name": "clone-executor"
},
"spec": {
"template": {
"spec": {
"restartPolicy": "OnFailure",
"containers": [
{
"name": "clone-executor",
"image": "superalgos/clone-executor:v1.0",
"command": ["node", "Run.js"],
"env": [
]
}
]
},
"metadata": {
"labels": {
"app": "clone-executor"
}
}
}
}
}
+2 -2
View File
@@ -1,11 +1,11 @@
export const Trading = 'Trading'
export const Indicator = 'Indicator'
export const Extraction = 'Extraction'
export const Sensor = 'Sensor'
export const BotTypesEnum = [
Trading,
Indicator,
Extraction
Sensor
]
export default BotTypesEnum
+7 -3
View File
@@ -4,7 +4,7 @@ import { KubernateError } from '../errors'
import { Client, config } from 'kubernetes-client'
import deploymentManifest from '../config/clone-deployment.json'
import { BACKTEST, COMPETITION, LIVE, NO_TIME } from '../enums/CloneMode'
import { Trading, Indicator, Extraction } from '../enums/BotTypes'
import { Trading, Indicator, Sensor } from '../enums/BotTypes'
const createClone = async (clone) => {
try {
@@ -80,6 +80,10 @@ const createClone = async (clone) => {
'name': 'PROCESS',
'value': clone.processName
})
env.push({
'name': 'EXCHANGE_NAME',
'value': clone.exchangeName
})
logger.debug('createClone Trading Configuration.')
if (clone.botType === Trading) {
@@ -130,7 +134,7 @@ const createClone = async (clone) => {
'value': clone.keyId
})
}
} else if (clone.botType === Indicator || clone.botType === Extraction) {
} else if (clone.botType === Indicator || clone.botType === Sensor) {
if (clone.mode === NO_TIME) {
if (!clone.resumeExecution) {
env.push({
@@ -159,7 +163,7 @@ const createClone = async (clone) => {
}
deploymentManifest.spec.template.spec.containers[0].env = env
logger.debug('ENV %s: ', JSON.stringify(env))
await client.apis.batch.v1.namespaces('default').jobs.post(
{ body: deploymentManifest })
+1
View File
@@ -10,6 +10,7 @@ const cloneDetails = (selectedBot, clone) => {
clone.teamSlug = selectedBot.team.slug
clone.teamAvatar = selectedBot.team.profile.avatar
clone.userLoggedIn = selectedBot.team.members[0].member.alias
clone.botType = selectedBot.kind
}
return clone
}
@@ -31,7 +31,6 @@ const resolve = async(parent, { botType }, context) => {
let bot = allUserBots[j].node
if(clones[i].botId === bot.id){
let clone = cloneDetails(bot, clones[i])
clone.botType = bot.kind
cloneResponse.push(clone)
break
}
-1
View File
@@ -34,7 +34,6 @@ const resolve = async (parent, { botType, queryLogs }, context) => {
let bot = allUserBots[j].node
if(clones[i].botId === bot.id){
let clone = cloneDetails(bot, clones[i])
clone.botType = bot.kind
cloneResponse.push(clone)
break
}
+2 -1
View File
@@ -25,7 +25,8 @@ const Type = new GraphQLInputObjectType({
processName: { type: new GraphQLNonNull(GraphQLString) },
botType: { type: new GraphQLNonNull(GraphQLString) },
keyId: { type: GraphQLString },
timePeriod: { type: GraphQLString }
timePeriod: { type: GraphQLString },
exchangeName: { type: GraphQLString }
})
})