Skip to content

Commit

Permalink
Merge pull request #99 from smartdevicelink/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
crokita authored Dec 5, 2019
2 parents e9cfc2f + 5f918fc commit 26c6b25
Show file tree
Hide file tree
Showing 32 changed files with 442 additions and 5,815 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ ADD . /app

RUN npm install

RUN npm run build-webpage

EXPOSE 4000

CMD ["npm", "start"]
4 changes: 2 additions & 2 deletions api/v2/app/interfaces/job/manticore/core-image-settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018, Livio, Inc.
// Copyright (c) 2019, Livio, Inc.
const builder = require('nomad-helper');

//a template for constructing core job files easily
Expand Down Expand Up @@ -35,7 +35,7 @@ function generateJobFile (jobName, body) {
job.addConstraint({
LTarget: "${meta.job}",
Operand: "=",
RTarget: "1"
RTarget: "true"
}, groupName);
//set resource limitations
job.setCPU(groupName, taskName, resources.cpu);
Expand Down
4 changes: 2 additions & 2 deletions api/v2/app/interfaces/job/manticore/hmi-image-settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018, Livio, Inc.
// Copyright (c) 2019, Livio, Inc.
const builder = require('nomad-helper');

//a template for constructing hmi job files easily
Expand Down Expand Up @@ -32,7 +32,7 @@ function generateJobFile (job, body, envs) {
job.addConstraint({
LTarget: "${meta.job}",
Operand: "=",
RTarget: "1"
RTarget: "true"
}, groupName);
//set resource limitations
job.setCPU(groupName, taskName, resources.cpu);
Expand Down
8 changes: 4 additions & 4 deletions api/v2/app/interfaces/job/manticore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const HMI_HEALTH_TIME = 8000;

const jobInfo = {
core: {
versions: ["5.1.3"], //ex. 5.0.1, master, develop
versions: ["6.0.1"], //ex. 5.0.1, master, develop
builds: ["default"]
},
hmis: [{
type: "generic",
versions: ["minimal-0.6.1"] //ex. master, minimal-0.5.1
versions: ["minimal-0.7.2"] //ex. master, minimal-0.5.1
}]
};

Expand Down Expand Up @@ -293,12 +293,12 @@ function formatAddresses (id, services) {
function exampleJobOption () {
return {
core: {
version: "5.1.3",
version: "6.0.1",
build: "default"
},
hmi: {
type: "generic",
version: "minimal-0.6.1"
version: "minimal-0.7.2"
}
};
}
Expand Down
20 changes: 19 additions & 1 deletion api/v2/app/listeners/health/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const {store, job, logger, websocket} = config;
const INTERNAL_JOB_NAME = "internal-health-check"; //the id of this module's request
let requestHistory = [];
let timer = null; //the health update timer
//A group of ids in a hash that are not expected to get a healthy job back
const pardonedIds = {};

//do not listen to events if healthCheck is disabled
if (!config.modes.healthCheck) return module.exports = {};
Expand All @@ -60,9 +62,11 @@ module.exports = {
let resolved = false;

if (ctx.removeUser) { //an error happened with the request
//if the id is in the pardonedIds group, then this does not count as a failure
const success = pardonedIds[ctx.currentRequest.id] === true
requestHistory.push({
id: ctx.currentRequest.id,
success: false,
success: success,
stuckWaiting: false,
date: Date.now()
});
Expand Down Expand Up @@ -110,6 +114,20 @@ module.exports = {
ctx.stuckWaiting = recentStatus.stuckWaiting;
}
next();
},
"removed-request": async (ctx, next) => {
pardonedIds[ctx.id] = true; //add the id to the pardoned group
next();
},
"pre-request": async (ctx, next) => {
//all newly added requests' ids are to be removed from the pardoned group
const { waitingState, requestState } = ctx;
const waitingIds = Object.keys(waitingState)
const newIds = Object.keys(requestState).filter(id => waitingIds.indexOf(id) === -1)
newIds.forEach(id => {
delete pardonedIds[id]
});
next();
}
}

Expand Down
5 changes: 0 additions & 5 deletions babel.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion build/manticore-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function buildManticoreJobFile () {
job.addConstraint({
LTarget: "${meta.manticore}",
Operand: "=",
RTarget: "1"
RTarget: "true"
}, groupName);
job.submitJob(nomadAddress, function (result) {
console.log("Job submitted");
Expand Down
13 changes: 0 additions & 13 deletions dist/index.html

This file was deleted.

3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ const config = require('./config');
app.use(bodyParser());

//serve Manticore webpage if enabled
//Must build it first by running 'npm run build-webpage'
if (!config.webpageDisabled) {
app.use(serve(__dirname + '/dist'));
app.use(serve(__dirname + '/webpage'));
}

//setup all koa middleware under the selected version in /api
Expand Down
Loading

0 comments on commit 26c6b25

Please sign in to comment.