Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mirera-db
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Antony Orlovsky
mirera-db
Commits
db872a57
Commit
db872a57
authored
Apr 16, 2021
by
Antony Orlovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added limits to compiler and task
parent
3ac773da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
compiler.js
compiler.js
+15
-3
task.js
task.js
+9
-4
No files found.
compiler.js
View file @
db872a57
...
...
@@ -37,6 +37,18 @@ const CompilerSchema = new mongoose.Schema({
extensions
:
{
type
:
[
String
],
default
:
[]
},
index
:
{
type
:
Number
,
default
:
0
},
cpuTimeLimit
:
{
type
:
Number
,
default
:
2
},
memoryLimit
:
{
type
:
String
,
default
:
'
1M
'
}
});
...
...
@@ -51,11 +63,11 @@ const Compiler = mongoose.connection.model('Compiler', CompilerSchema);
module
.
exports
.
model
=
Compiler
;
module
.
exports
.
getAll
=
()
=>
{
return
Compiler
.
find
({});
return
Compiler
.
find
({})
.
sort
({
index
:
1
})
;
};
module
.
exports
.
getMany
=
ids
=>
{
return
Compiler
.
find
One
({
_id
:
{
$in
:
ids
}});
return
Compiler
.
find
({
_id
:
{
$in
:
ids
}});
};
module
.
exports
.
getShotForNames
=
names
=>
{
...
...
@@ -63,7 +75,7 @@ module.exports.getShotForNames = names => {
};
module
.
exports
.
get
=
id
=>
{
return
Compiler
.
findOne
({
_id
:
id
})
return
Compiler
.
findOne
({
_id
:
id
})
;
};
module
.
exports
.
add
=
(
name
,
displayedName
,
isProject
,
compileCommands
,
detectCommand
,
detectOutput
,
runCommand
,
forcedCompileOutputExtension
)
=>
{
...
...
task.js
View file @
db872a57
...
...
@@ -84,6 +84,10 @@ const TaskSchema = new mongoose.Schema({
type
:
Array
,
default
:
[]
},
useLimits
:
{
type
:
Boolean
,
default
:
false
},
cpuTimeLimit
:
{
type
:
Number
,
default
:
2
...
...
@@ -479,10 +483,11 @@ module.exports.setCompilers = (id, addCompilers, removeCompilers) => {
module
.
exports
.
setCompilerConfig
=
(
id
,
compiler
,
config
)
=>
{
return
Task
.
findOneAndUpdate
({
_id
:
id
},
{
[
`testerConfig.compilers.
${
compiler
}
.cpuTimeLimit`
]
:
config
.
cpuTimeLimit
||
-
1
,
[
`testerConfig.compilers.
${
compiler
}
.memoryLimit`
]:
config
.
memoryLimit
||
-
1
,
[
`testerConfig.compilers.
${
compiler
}
.arguments`
]
:
config
.
arguments
||
''
,
[
`testerConfig.compilers.
${
compiler
}
.compileProjectFileName`
]
:
config
.
compileProjectFileName
||
''
[
`testerConfig.compilers.
${
compiler
}
.useLimits`
]
:
config
.
useLimits
,
[
`testerConfig.compilers.
${
compiler
}
.cpuTimeLimit`
]
:
config
.
cpuTimeLimit
,
[
`testerConfig.compilers.
${
compiler
}
.memoryLimit`
]:
config
.
memoryLimit
,
[
`testerConfig.compilers.
${
compiler
}
.arguments`
]
:
config
.
arguments
,
[
`testerConfig.compilers.
${
compiler
}
.compileProjectFileName`
]
:
config
.
compileProjectFileName
});
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment