Merge pull request #15247 from overleaf/jpa-submission-backend-class

[web] use n2d instances for compiling submissions

GitOrigin-RevId: 57eb27af230b994c3816c0476673ea558226ac1e
This commit is contained in:
Jakob Ackermann 2023-10-24 12:44:11 +02:00 committed by Copybot
parent 92a38e1311
commit 347da4e6bb
5 changed files with 13 additions and 7 deletions

View file

@ -244,7 +244,7 @@ module.exports = CompileController = {
} }
options.compileGroup = options.compileGroup =
req.body?.compileGroup || Settings.defaultFeatures.compileGroup req.body?.compileGroup || Settings.defaultFeatures.compileGroup
options.compileBackendClass = Settings.apis.clsi.defaultBackendClass options.compileBackendClass = Settings.apis.clsi.submissionBackendClass
options.timeout = options.timeout =
req.body?.timeout || Settings.defaultFeatures.compileTimeout req.body?.timeout || Settings.defaultFeatures.compileTimeout
ClsiManager.sendExternalRequest( ClsiManager.sendExternalRequest(
@ -440,7 +440,7 @@ module.exports = CompileController = {
req.body?.compileGroup || req.body?.compileGroup ||
req.query?.compileGroup || req.query?.compileGroup ||
Settings.defaultFeatures.compileGroup, Settings.defaultFeatures.compileGroup,
compileBackendClass: Settings.apis.clsi.defaultBackendClass, compileBackendClass: Settings.apis.clsi.submissionBackendClass,
} }
CompileController.proxyToClsiWithLimits( CompileController.proxyToClsiWithLimits(
submissionId, submissionId,

View file

@ -226,6 +226,8 @@ module.exports = {
// url: "http://#{process.env['CLSI_LB_HOST']}:3014" // url: "http://#{process.env['CLSI_LB_HOST']}:3014"
backendGroupName: undefined, backendGroupName: undefined,
defaultBackendClass: process.env.CLSI_DEFAULT_BACKEND_CLASS || 'e2', defaultBackendClass: process.env.CLSI_DEFAULT_BACKEND_CLASS || 'e2',
submissionBackendClass:
process.env.CLSI_SUBMISSION_BACKEND_CLASS || 'n2d',
}, },
project_history: { project_history: {
sendProjectStructureOps: true, sendProjectStructureOps: true,

View file

@ -121,6 +121,7 @@ describe('ClsiManager', function () {
clsi: { clsi: {
url: `http://${CLSI_HOST}`, url: `http://${CLSI_HOST}`,
defaultBackendClass: 'e2', defaultBackendClass: 'e2',
submissionBackendClass: 'n2d',
}, },
clsi_priority: { clsi_priority: {
url: 'https://clsipremium.example.com', url: 'https://clsipremium.example.com',

View file

@ -33,6 +33,7 @@ describe('CompileController', function () {
clsi: { clsi: {
url: 'http://clsi.example.com', url: 'http://clsi.example.com',
defaultBackendClass: 'e2', defaultBackendClass: 'e2',
submissionBackendClass: 'n2d',
}, },
clsi_priority: { clsi_priority: {
url: 'http://clsi-priority.example.com', url: 'http://clsi-priority.example.com',
@ -337,7 +338,7 @@ describe('CompileController', function () {
this.ClsiManager.sendExternalRequest.should.have.been.calledWith( this.ClsiManager.sendExternalRequest.should.have.been.calledWith(
this.submission_id, this.submission_id,
{ compileGroup: 'special', timeout: 600 }, { compileGroup: 'special', timeout: 600 },
{ compileGroup: 'special', compileBackendClass: 'e2', timeout: 600 } { compileGroup: 'special', compileBackendClass: 'n2d', timeout: 600 }
) )
}) })
}) })
@ -368,7 +369,7 @@ describe('CompileController', function () {
draft: true, draft: true,
check: 'validate', check: 'validate',
compileGroup: 'standard', compileGroup: 'standard',
compileBackendClass: 'e2', compileBackendClass: 'n2d',
timeout: 60, timeout: 60,
} }
) )
@ -486,7 +487,7 @@ describe('CompileController', function () {
{}, {},
{ {
compileGroup: 'standard', compileGroup: 'standard',
compileBackendClass: 'e2', compileBackendClass: 'n2d',
} }
) )
}) })
@ -510,7 +511,7 @@ describe('CompileController', function () {
{}, {},
{ {
compileGroup: 'special', compileGroup: 'special',
compileBackendClass: 'e2', compileBackendClass: 'n2d',
} }
) )
}) })

View file

@ -22,7 +22,9 @@ describe('CompileManager', function () {
this.CompileManager = SandboxedModule.require(MODULE_PATH, { this.CompileManager = SandboxedModule.require(MODULE_PATH, {
requires: { requires: {
'@overleaf/settings': (this.settings = { '@overleaf/settings': (this.settings = {
apis: { clsi: { defaultBackendClass: 'e2' } }, apis: {
clsi: { defaultBackendClass: 'e2', submissionBackendClass: 'n2d' },
},
redis: { web: { host: 'localhost', port: 42 } }, redis: { web: { host: 'localhost', port: 42 } },
rateLimit: { autoCompile: {} }, rateLimit: { autoCompile: {} },
}), }),