ultravisor-beacon 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultravisor-beacon",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Ultravisor Beacon: lightweight beacon client and Fable service for remote task execution",
5
5
  "main": "source/Ultravisor-Beacon-Service.cjs",
6
6
  "scripts": {
@@ -516,6 +516,35 @@ class UltravisorBeaconClient
516
516
  console.log(`[Beacon] Work item [${pWorkItem.WorkItemHash}] completed successfully.`);
517
517
  }
518
518
 
519
+ // Upload output file if one was produced (Result is a local path)
520
+ let tmpResultPath = tmpOutputs.Result;
521
+ let tmpSettings = pWorkItem.Settings || {};
522
+ let tmpOutputFilename = tmpSettings.OutputFile || tmpSettings.OutputFilename || '';
523
+ if (tmpResultPath && tmpOutputFilename && this._UseWebSocket
524
+ && this._WebSocket && this._WebSocket.readyState === libWebSocket.OPEN)
525
+ {
526
+ let tmpFS = require('fs');
527
+ if (tmpFS.existsSync(tmpResultPath))
528
+ {
529
+ try
530
+ {
531
+ let tmpBuffer = tmpFS.readFileSync(tmpResultPath);
532
+ console.log(`[Beacon] Uploading result file ${tmpOutputFilename} (${tmpBuffer.length} bytes) for [${pWorkItem.WorkItemHash}]`);
533
+ this._wsSend({
534
+ Action: 'WorkResultUpload',
535
+ WorkItemHash: pWorkItem.WorkItemHash,
536
+ OutputFilename: tmpOutputFilename,
537
+ OutputSize: tmpBuffer.length
538
+ });
539
+ this._WebSocket.send(tmpBuffer);
540
+ }
541
+ catch (pUploadError)
542
+ {
543
+ console.error(`[Beacon] Failed to upload result file: ${pUploadError.message}`);
544
+ }
545
+ }
546
+ }
547
+
519
548
  if (this._UseWebSocket)
520
549
  {
521
550
  this._wsReportComplete(pWorkItem.WorkItemHash, tmpOutputs, pResult.Log || []);