Skip to content

Commit

Permalink
Fix metric spec schema bug (#3812)
Browse files Browse the repository at this point in the history
* updated __init__.py to include missing encoders
* fixed typo and metric schema for experiment
* Fixed typos in experimentDescriptionSchema.json
* Added WARNING message when permutations runner job fails
* Added nupic-site.xml to .gitignore
  • Loading branch information
JonnoFTW authored and rhyolight committed Mar 7, 2018
1 parent 40e2169 commit 33052e1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ nupic.egg-info/
nupic/*py_region.*
temp/
docs/_build_html
/src/nupic/support/nupic-site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"integer",
"null"
],
"description": "Maximum number of models to evaluate. This replaces the older location of this specification from the job params. "
"description": "Maximum number of models to evaluate. This replaces the older location of this specification from the job params."
},
"spPermuteDecrement": {
"default": true,
Expand Down Expand Up @@ -113,7 +113,7 @@
"description": "inferenceArgs -- arguments for the type of inference you want to use"
},
"prediction": {
"description": " [DEPRECATED] Prediction optimization options; at least one MUST be enabled. NOTE: at this time, non-temporal and temporalpredictions are mutually-exclusive (RunPermutations cannot yetoptimize for both). This is deprecated. Used inferenceType instead",
"description": " [DEPRECATED] Prediction optimization options; at least one MUST be enabled. NOTE: at this time, non-temporal and temporal predictions are mutually-exclusive (RunPermutations cannot yet optimize for both). This is deprecated. Used inferenceType instead",
"default": {
"temporal": {
"optimize": true
Expand Down Expand Up @@ -177,7 +177,7 @@
"customErrorMetric": {
"required": false,
"type": "object",
"description": "Custom User definied Error metric that will be computed"
"description": "Custom User defined Error metric that will be computed"
},
"spCoincInputPoolPct": {
"default": 0.8,
Expand Down Expand Up @@ -216,7 +216,7 @@
"description": "Flag to run baseline error metrics with the job for comparison"
},
"metrics": {
"description": "Additional metrics to be generated, along with thedefault ones for the given inferenceType. Note: The specified metric should be compatible withe the giveninference",
"description": "Additional metrics to be generated, along with the default ones for the given inferenceType. Note: The specified metric should be compatible withe the given inference",
"default": [],
"items": {
"required": true,
Expand Down Expand Up @@ -267,7 +267,7 @@
"minLength": 1,
"required": false,
"type": "string",
"description": "[DEPRECATED] Name of field we're trying to predict. This is deprected. Used inferenceArgs.predictedField instead"
"description": "[DEPRECATED] Name of field we're trying to predict. This is deprecated. Used inferenceArgs.predictedField instead"
},
"streamDef": {
"minLength": 1,
Expand Down Expand Up @@ -380,7 +380,7 @@
"space": {
"required": false,
"type": "string",
"description": "A way to customize which spaces (absolute, delta) are evaluted when runDelta is True. "
"description": "A way to customize which spaces (absolute, delta) are evaluated when runDelta is True."
},
"maxValue": {
"required": false,
Expand Down Expand Up @@ -410,7 +410,7 @@
"encoderType": {
"required": false,
"type": "string",
"description": "Encoder type, for example 'ScalarEncoder, AdaptiveScalarEncoder, etc. "
"description": "Encoder type, for example 'ScalarEncoder, AdaptiveScalarEncoder, etc."
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/nupic/swarming/exp_generator/experiment_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,7 @@ def _generateMetricSpecs(options):

def _generateExtraMetricSpecs(options):
"""Generates the non-default metrics specified by the expGenerator params """
global _metricSpecSchema
_metricSpecSchema = {'properties': {}}

results = []
for metric in options['metrics']:
Expand Down
10 changes: 7 additions & 3 deletions src/nupic/swarming/permutations_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,12 @@ def _launchWorkers(self, cmdLine, numWorkers):

self._workers = []
for i in range(numWorkers):
stdout = tempfile.TemporaryFile()
stderr = tempfile.TemporaryFile()
stdout = tempfile.NamedTemporaryFile(delete=False)
stderr = tempfile.NamedTemporaryFile(delete=False)
p = subprocess.Popen(cmdLine, bufsize=1, env=os.environ, shell=True,
stdin=None, stdout=stdout, stderr=stderr)
p._stderr_file = stderr
p._stdout_file = stdout
self._workers.append(p)


Expand Down Expand Up @@ -1456,7 +1458,9 @@ def __init__(self, nupicJobID, workers):
status = cjdao.ClientJobsDAO.STATUS_RUNNING
else:
status = cjdao.ClientJobsDAO.STATUS_COMPLETED

if retCode != 0:
with open(worker._stderr_file.name, 'r') as err:
_emit(Verbosity.WARNING, "Job %d failed with error: %s" % (jobInfo.jobId, err.read()))
jobInfo = jobInfo._replace(status=status)

_emit(Verbosity.DEBUG, "JobStatus: \n%s" % pprint.pformat(jobInfo,
Expand Down

0 comments on commit 33052e1

Please sign in to comment.