From 9b2ce4f71030ce2199e91e56d03c0d3288962f47 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Wed, 20 Nov 2024 10:32:07 +0100 Subject: [PATCH] more resilient fetching of archived executions --- ccp/js/executionhistorycontroller.js | 66 +++++++++++++++------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/ccp/js/executionhistorycontroller.js b/ccp/js/executionhistorycontroller.js index 7ce2b03..59c5aff 100644 --- a/ccp/js/executionhistorycontroller.js +++ b/ccp/js/executionhistorycontroller.js @@ -695,38 +695,42 @@ class CCPExecutionHistory extends HTMLElement { //parse all metada content that is useful to build up an entry const metadata = await this.#ws.download(metadatafolder[0].id, null, true) const zip = new JSZip() - const req = JSON.parse(await (zip.loadAsync(metadata).then(z=>z.file("metadata/request.json").async("string")))) - const status = JSON.parse(await (zip.loadAsync(metadata).then(z=>z.file("metadata/jobStatus.json").async("string")))) - const meth = JSON.parse(await (zip.loadAsync(metadata).then(z=>z.file("metadata/method.json").async("string")))) - const infra = JSON.parse(await (zip.loadAsync(metadata).then(z=>z.file("metadata/infrastructure.json").async("string")))) - const parser = new DOMParser() - // Fasted way to get context is from prov-o. If it doesn't match the context in boot skip this execution - const provo = parser.parseFromString(await zip.loadAsync(metadata).then(z=>z.file("metadata/prov-o.xml").async("string")), "text/xml") - const context = provo.querySelector("entity[*|id='d4s:VRE']>value").textContent - if(context !== this.#boot.context && context.replaceAll("/", "%2F") !== this.#boot.context) continue; - //build entry from downloaded data - const entry = { - id : req.id, - status : status.status, - created : status.created, - started : status.started, - updated : status.updated, - message : status.message, - method : meth.title, - methodversion : meth.version, - infrastructure: infra.name, - infrastructuretype : infra.type, - ccpnote : req.inputs.ccpnote ? req.inputs.ccpnote : "", - runtime : req.inputs.ccpimage, - replicas : req.inputs.ccpreplicas ? req.inputs.ccpreplicas : 1, - href : `items/${executionfolders[j].id}/download`, - wsid : executionfolders[j].id, - fullrequest : req, - fullmethod : meth, - fullinfrastructure : infra + try{ + const req = JSON.parse(await (zip.loadAsync(metadata).then(z=>z.file("metadata/request.json").async("string")))) + const status = JSON.parse(await (zip.loadAsync(metadata).then(z=>z.file("metadata/jobStatus.json").async("string")))) + const meth = JSON.parse(await (zip.loadAsync(metadata).then(z=>z.file("metadata/method.json").async("string")))) + const infra = JSON.parse(await (zip.loadAsync(metadata).then(z=>z.file("metadata/infrastructure.json").async("string")))) + const parser = new DOMParser() + // Fasted way to get context is from prov-o. If it doesn't match the context in boot skip this execution + const provo = parser.parseFromString(await zip.loadAsync(metadata).then(z=>z.file("metadata/prov-o.xml").async("string")), "text/xml") + const context = provo.querySelector("entity[*|id='d4s:VRE']>value").textContent + if(context !== this.#boot.context && context.replaceAll("/", "%2F") !== this.#boot.context) continue; + //build entry from downloaded data + const entry = { + id : req.id, + status : status.status, + created : status.created, + started : status.started, + updated : status.updated, + message : status.message, + method : meth.title, + methodversion : meth.version, + infrastructure: infra.name, + infrastructuretype : infra.type, + ccpnote : req.inputs.ccpnote ? req.inputs.ccpnote : "", + runtime : req.inputs.ccpimage, + replicas : req.inputs.ccpreplicas ? req.inputs.ccpreplicas : 1, + href : `items/${executionfolders[j].id}/download`, + wsid : executionfolders[j].id, + fullrequest : req, + fullmethod : meth, + fullinfrastructure : infra + } + if(this.#archived[entry.method]) this.#archived[entry.method].push(entry); + else this.#archived[entry.method] = [entry] + } catch (err){ + console.warn(`Skipping entry ${metadatafolder[0].id} because of ${err}`) } - if(this.#archived[entry.method]) this.#archived[entry.method].push(entry); - else this.#archived[entry.method] = [entry] } } }