Add extra options to verifier.
This commit is contained in:
parent
6eef19e488
commit
bdfa6d435a
4 changed files with 24 additions and 7 deletions
app
styles/editor/verifier
templates/editor/verifier
views/editor/verifier
|
@ -19,3 +19,6 @@
|
||||||
|
|
||||||
.test-failed
|
.test-failed
|
||||||
color: red
|
color: red
|
||||||
|
|
||||||
|
.lineUnder
|
||||||
|
border-bottom: 1px solid #ccc
|
|
@ -16,9 +16,18 @@ block content
|
||||||
p.alert.alert-info
|
p.alert.alert-info
|
||||||
| To Run: #{view.testCount - view.passed - view.problem - view.failed}
|
| To Run: #{view.testCount - view.passed - view.problem - view.failed}
|
||||||
|
|
||||||
|
.form.form-inline
|
||||||
|
.row.lineUnder
|
||||||
|
.form-group.campaign-mix
|
||||||
|
input(id="careAboutFrames", type="checkbox", checked=!!view.careAboutFrames, disabled=!!view.tests)
|
||||||
|
label(for="careAboutFrames") Check frame counts
|
||||||
|
.form-group.campaign-mix
|
||||||
|
label(for="cores") Threads:
|
||||||
|
input(id="cores", type="number", min="1", max="16", value=view.cores, disabled=!!view.tests)
|
||||||
|
|
||||||
if view.levelsByCampaign
|
if view.levelsByCampaign
|
||||||
.form.form-inline
|
.form.form-inline
|
||||||
.row
|
.row.lineUnder
|
||||||
each campaignInfo, campaign in view.levelsByCampaign
|
each campaignInfo, campaign in view.levelsByCampaign
|
||||||
.form-group.campaign-mix
|
.form-group.campaign-mix
|
||||||
- var campaignID = "campaign-" + campaign + "-checkbox";
|
- var campaignID = "campaign-" + campaign + "-checkbox";
|
||||||
|
|
|
@ -7,7 +7,7 @@ LevelLoader = require 'lib/LevelLoader'
|
||||||
utils = require 'core/utils'
|
utils = require 'core/utils'
|
||||||
|
|
||||||
module.exports = class VerifierTest extends CocoClass
|
module.exports = class VerifierTest extends CocoClass
|
||||||
constructor: (@levelID, @updateCallback, @supermodel, @language) ->
|
constructor: (@levelID, @updateCallback, @supermodel, @language, @options) ->
|
||||||
super()
|
super()
|
||||||
# TODO: turn this into a Subview
|
# TODO: turn this into a Subview
|
||||||
# TODO: listen to the progress report from Angel to show a simulation progress bar (maybe even out of the number of frames we actually know it'll take)
|
# TODO: listen to the progress report from Angel to show a simulation progress bar (maybe even out of the number of frames we actually know it'll take)
|
||||||
|
@ -91,7 +91,7 @@ module.exports = class VerifierTest extends CocoClass
|
||||||
|
|
||||||
isSuccessful: () ->
|
isSuccessful: () ->
|
||||||
return false unless @solution?
|
return false unless @solution?
|
||||||
return false unless @frames == @solution.frameCount
|
return false unless @frames == @solution.frameCount or @options.dontCareAboutFrames
|
||||||
if @goals and @solution.goals
|
if @goals and @solution.goals
|
||||||
for k of @goals
|
for k of @goals
|
||||||
continue if not @solution.goals[k]
|
continue if not @solution.goals[k]
|
||||||
|
|
|
@ -23,6 +23,10 @@ module.exports = class VerifierView extends RootView
|
||||||
@problem = 0
|
@problem = 0
|
||||||
@testCount = 0
|
@testCount = 0
|
||||||
|
|
||||||
|
defaultCores = 2
|
||||||
|
@cores = Math.max(window.navigator.hardwareConcurrency, defaultCores)
|
||||||
|
@careAboutFrames = true
|
||||||
|
|
||||||
if @levelID
|
if @levelID
|
||||||
@levelIDs = [@levelID]
|
@levelIDs = [@levelID]
|
||||||
@testLanguages = ['python', 'javascript', 'java', 'lua', 'coffeescript']
|
@testLanguages = ['python', 'javascript', 'java', 'lua', 'coffeescript']
|
||||||
|
@ -56,6 +60,8 @@ module.exports = class VerifierView extends RootView
|
||||||
onClickGoButton: (e) ->
|
onClickGoButton: (e) ->
|
||||||
@filterCampaigns()
|
@filterCampaigns()
|
||||||
@levelIDs = []
|
@levelIDs = []
|
||||||
|
@careAboutFrames = @$("#careAboutFrames").is(':checked')
|
||||||
|
@cores = @$("#cores").val()|0
|
||||||
for campaign, campaignInfo of @levelsByCampaign
|
for campaign, campaignInfo of @levelsByCampaign
|
||||||
if @$("#campaign-#{campaign}-checkbox").is(':checked')
|
if @$("#campaign-#{campaign}-checkbox").is(':checked')
|
||||||
for level in campaignInfo.levels
|
for level in campaignInfo.levels
|
||||||
|
@ -87,8 +93,6 @@ module.exports = class VerifierView extends RootView
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
onTestLevelsLoaded: ->
|
onTestLevelsLoaded: ->
|
||||||
defaultCores = 2
|
|
||||||
cores = Math.max(window.navigator.hardwareConcurrency, defaultCores)
|
|
||||||
|
|
||||||
@linksQueryString = window.location.search
|
@linksQueryString = window.location.search
|
||||||
#supermodel = if @levelID then @supermodel else undefined
|
#supermodel = if @levelID then @supermodel else undefined
|
||||||
|
@ -102,7 +106,8 @@ module.exports = class VerifierView extends RootView
|
||||||
@tasksList.push level: levelID, language: codeLanguage
|
@tasksList.push level: levelID, language: codeLanguage
|
||||||
|
|
||||||
@testCount = @tasksList.length
|
@testCount = @tasksList.length
|
||||||
chunks = _.groupBy @tasksList, (v,i) -> i%cores
|
console.log("Starting in", @cores, "cores...")
|
||||||
|
chunks = _.groupBy @tasksList, (v,i) => i%@cores
|
||||||
supermodels = [@supermodel]
|
supermodels = [@supermodel]
|
||||||
|
|
||||||
_.forEach chunks, (chunk, i) =>
|
_.forEach chunks, (chunk, i) =>
|
||||||
|
@ -128,7 +133,7 @@ module.exports = class VerifierView extends RootView
|
||||||
++@problem
|
++@problem
|
||||||
|
|
||||||
next()
|
next()
|
||||||
, chunkSupermodel, task.language
|
, chunkSupermodel, task.language, {dontCareAboutFrames: not @careAboutFrames}
|
||||||
@tests.unshift test
|
@tests.unshift test
|
||||||
@render()
|
@render()
|
||||||
, => @render()
|
, => @render()
|
||||||
|
|
Reference in a new issue