@blaxel/core 0.2.4-dev.68 → 0.2.4-dev.70
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/dist/jobs/start.js +7 -3
- package/package.json +1 -1
package/dist/jobs/start.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.blStartJob = void 0;
|
|
4
|
+
const autoload_js_1 = require("../common/autoload.js");
|
|
4
5
|
const env_js_1 = require("../common/env.js");
|
|
5
6
|
const telemetry_js_1 = require("../telemetry/telemetry.js");
|
|
6
7
|
class BlJobWrapper {
|
|
@@ -42,6 +43,7 @@ class BlJobWrapper {
|
|
|
42
43
|
Run a job defined in a function, it's run in the current process
|
|
43
44
|
*/
|
|
44
45
|
async start(func) {
|
|
46
|
+
await (0, autoload_js_1.authenticate)();
|
|
45
47
|
let span = (0, telemetry_js_1.startSpan)(`blStartJob-${func.name}`, {
|
|
46
48
|
attributes: {
|
|
47
49
|
'job.name': func.name,
|
|
@@ -59,14 +61,16 @@ class BlJobWrapper {
|
|
|
59
61
|
catch (error) {
|
|
60
62
|
span.recordException(error);
|
|
61
63
|
span.setStatus('error', 'Job execution failed');
|
|
62
|
-
console.error('Job execution failed:', error);
|
|
63
64
|
span.end();
|
|
64
|
-
|
|
65
|
+
throw error;
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
const blStartJob = (func) => {
|
|
69
70
|
const job = new BlJobWrapper();
|
|
70
|
-
job.start(func)
|
|
71
|
+
job.start(func).catch((error) => {
|
|
72
|
+
console.error('Job execution failed:', error);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
});
|
|
71
75
|
};
|
|
72
76
|
exports.blStartJob = blStartJob;
|