From bd43050dc2556223d39c12a3f161caee3ad285c4 Mon Sep 17 00:00:00 2001 From: Brian Broll Date: Thu, 21 Mar 2019 18:19:32 -0700 Subject: [PATCH 1/2] Return result types content (not only hash). Fixes #1214 --- src/plugins/ExecuteJob/ExecuteJob.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/plugins/ExecuteJob/ExecuteJob.js b/src/plugins/ExecuteJob/ExecuteJob.js index ce1ddc3dd..837528d87 100644 --- a/src/plugins/ExecuteJob/ExecuteJob.js +++ b/src/plugins/ExecuteJob/ExecuteJob.js @@ -662,22 +662,20 @@ define([ .catch(err => this.logger.error(`Could not get op info for ${JSON.stringify(opId)}: ${err}`)); }; - ExecuteJob.prototype.onDistOperationComplete = function (node, result) { + ExecuteJob.prototype.onDistOperationComplete = async function (node, result) { const opName = this.getAttribute(node, 'name'); + const resultTypes = await this.getResultTypes(result); let nodeId = this.core.getPath(node), outputMap = {}, - resultTypes, outputs; + // Match the output names to the actual nodes // Create an array of [name, node] // For now, just match by type. Later we may use ports for input/outputs // Store the results in the outgoing ports - return this.getResultTypes(result) - .then(types => { - resultTypes = types; - return this.getOutputs(node); - }) + + return this.getOutputs(node) .then(outputPorts => { outputs = outputPorts.map(tuple => [tuple[0], tuple[2]]); outputs.forEach(output => outputMap[output[0]] = output[1]); @@ -716,8 +714,9 @@ define([ }; ExecuteJob.prototype.getResultTypes = async function (result) { - const artifactHash = result.resultHashes['result-types']; - return await this.getContentHashSafe(artifactHash, 'result-types.json', ERROR.NO_TYPES_FILE); + const mdHash = result.resultHashes['result-types']; + const hash = await this.getContentHashSafe(mdHash, 'result-types.json', ERROR.NO_TYPES_FILE); + return await this.blobClient.getObjectAsString(hash); }; ExecuteJob.prototype.getContentHashSafe = async function (artifactHash, fileName, msg) { From 965dac7e089037ec0b66cad6704c9a0b3809d5b8 Mon Sep 17 00:00:00 2001 From: Brian Broll Date: Thu, 21 Mar 2019 18:29:13 -0700 Subject: [PATCH 2/2] WIP return result types as JSON --- src/plugins/ExecuteJob/ExecuteJob.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/ExecuteJob/ExecuteJob.js b/src/plugins/ExecuteJob/ExecuteJob.js index 837528d87..7048ef4a6 100644 --- a/src/plugins/ExecuteJob/ExecuteJob.js +++ b/src/plugins/ExecuteJob/ExecuteJob.js @@ -716,7 +716,7 @@ define([ ExecuteJob.prototype.getResultTypes = async function (result) { const mdHash = result.resultHashes['result-types']; const hash = await this.getContentHashSafe(mdHash, 'result-types.json', ERROR.NO_TYPES_FILE); - return await this.blobClient.getObjectAsString(hash); + return await this.blobClient.getObjectAsJSON(hash); }; ExecuteJob.prototype.getContentHashSafe = async function (artifactHash, fileName, msg) {