浏览代码

Add runId in the results

Gaël Métais 4 年之前
父节点
当前提交
4e8cb19f55
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      bin/lambda.js

+ 8 - 1
bin/lambda.js

@@ -5,11 +5,18 @@ const ylt = require('..');
 // noinspection JSUnusedLocalSymbols
 async function runner({id, url, options = {}}, context) {
     console.log(`Processing run #${id} on ${url}`);
+    
     const bucket = process.env.RESULT_BUCKET_NAME;
     const keyPrefix = `results/${id}`;
+
     const saveFile = async (path, content) => s3.putObject({Bucket: bucket, Key: `${keyPrefix}/${path}`, Body: content})
         .promise();
-    await saveFile('results.json', JSON.stringify(await ylt(url, {...options, saveFile})));
+    
+    const results = JSON.stringify(await ylt(url, {...options, saveFile}));
+    results.runId = id;
+    
+    await saveFile('results.json', results);
+    
     return {status: 'processed', id, bucket, keyPrefix};
 }