veryfront 0.1.563 → 0.1.565
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/esm/cli/commands/worker/command-help.js +2 -2
- package/esm/cli/commands/worker/command.d.ts +1 -1
- package/esm/cli/commands/worker/command.js +5 -5
- package/esm/deno.js +1 -1
- package/esm/src/chat/conversation.d.ts.map +1 -1
- package/esm/src/chat/conversation.js +22 -0
- package/esm/src/chat/types.d.ts +1 -1
- package/esm/src/chat/types.d.ts.map +1 -1
- package/esm/src/integrations/_data.js +1 -1
- package/esm/src/jobs/index.d.ts +5 -1
- package/esm/src/jobs/index.d.ts.map +1 -1
- package/esm/src/jobs/index.js +4 -0
- package/esm/src/jobs/jobs-client.d.ts +14 -6
- package/esm/src/jobs/jobs-client.d.ts.map +1 -1
- package/esm/src/jobs/jobs-client.js +11 -4
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/backends/memory.d.ts +3 -3
- package/esm/src/workflow/backends/memory.d.ts.map +1 -1
- package/esm/src/workflow/backends/redis/index.d.ts +3 -3
- package/esm/src/workflow/backends/redis/index.d.ts.map +1 -1
- package/esm/src/workflow/backends/shared/requeue-run.d.ts +2 -2
- package/esm/src/workflow/backends/shared/requeue-run.d.ts.map +1 -1
- package/esm/src/workflow/backends/types.d.ts +3 -3
- package/esm/src/workflow/backends/types.d.ts.map +1 -1
- package/esm/src/workflow/schemas/index.d.ts +1 -1
- package/esm/src/workflow/schemas/index.d.ts.map +1 -1
- package/esm/src/workflow/schemas/index.js +1 -1
- package/esm/src/workflow/schemas/workflow.schema.d.ts +4 -4
- package/esm/src/workflow/schemas/workflow.schema.d.ts.map +1 -1
- package/esm/src/workflow/schemas/workflow.schema.js +3 -3
- package/esm/src/workflow/types.d.ts +1 -1
- package/esm/src/workflow/types.d.ts.map +1 -1
- package/esm/src/workflow/worker/dynamic-job-entrypoint.d.ts +14 -14
- package/esm/src/workflow/worker/dynamic-job-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/dynamic-job-entrypoint.js +10 -10
- package/esm/src/workflow/worker/executors/index.d.ts +3 -2
- package/esm/src/workflow/worker/executors/index.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/index.js +3 -2
- package/esm/src/workflow/worker/executors/k8s.d.ts +2 -2
- package/esm/src/workflow/worker/executors/k8s.js +2 -2
- package/esm/src/workflow/worker/executors/process.d.ts +5 -5
- package/esm/src/workflow/worker/executors/process.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/process.js +6 -6
- package/esm/src/workflow/worker/executors/types.d.ts +5 -4
- package/esm/src/workflow/worker/executors/types.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/types.js +3 -2
- package/esm/src/workflow/worker/index.d.ts +10 -7
- package/esm/src/workflow/worker/index.d.ts.map +1 -1
- package/esm/src/workflow/worker/index.js +13 -10
- package/esm/src/workflow/worker/job-entrypoint.d.ts +17 -17
- package/esm/src/workflow/worker/job-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/job-entrypoint.js +12 -12
- package/esm/src/workflow/worker/job-manager.d.ts +11 -11
- package/esm/src/workflow/worker/job-manager.js +16 -16
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Workflow
|
|
2
|
+
* Workflow run entrypoint
|
|
3
3
|
*
|
|
4
4
|
* Runs inside an ephemeral K8s Job container.
|
|
5
5
|
* Executes a single workflow run in complete isolation.
|
|
@@ -23,9 +23,9 @@ import type { WorkflowBackend } from "../backends/types.js";
|
|
|
23
23
|
import type { WorkflowExecutor } from "../executor/workflow-executor.js";
|
|
24
24
|
import type { WorkflowDefinition } from "../types.js";
|
|
25
25
|
/**
|
|
26
|
-
* Configuration for the
|
|
26
|
+
* Configuration for the workflow run entrypoint.
|
|
27
27
|
*/
|
|
28
|
-
export interface
|
|
28
|
+
export interface WorkflowRunEntrypointConfig {
|
|
29
29
|
/** Backend for workflow persistence */
|
|
30
30
|
backend: WorkflowBackend;
|
|
31
31
|
/** Workflow executor */
|
|
@@ -34,7 +34,7 @@ export interface JobEntrypointConfig {
|
|
|
34
34
|
debug?: boolean;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* Exit codes for the
|
|
37
|
+
* Exit codes for the workflow run entrypoint.
|
|
38
38
|
*/
|
|
39
39
|
export declare const EXIT_CODES: {
|
|
40
40
|
readonly SUCCESS: 0;
|
|
@@ -43,17 +43,17 @@ export declare const EXIT_CODES: {
|
|
|
43
43
|
readonly NOT_FOUND: 3;
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
46
|
-
* Run the workflow
|
|
46
|
+
* Run the workflow run entrypoint
|
|
47
47
|
*
|
|
48
48
|
* This function is the main entrypoint for workflow execution in a K8s Job.
|
|
49
49
|
* It should be called from your container's main script.
|
|
50
50
|
*
|
|
51
51
|
* @example
|
|
52
52
|
* ```typescript
|
|
53
|
-
* //
|
|
53
|
+
* // workflow-runner.ts - Container entrypoint
|
|
54
54
|
* import { RedisBackend } from "veryfront/workflow";
|
|
55
55
|
* import { WorkflowExecutor } from "veryfront/workflow";
|
|
56
|
-
* import {
|
|
56
|
+
* import { runWorkflowRun } from "veryfront/workflow/worker";
|
|
57
57
|
* import { workflows } from "./workflows.ts";
|
|
58
58
|
*
|
|
59
59
|
* const backend = new RedisBackend({ url: Deno.env.get("REDIS_URL")! });
|
|
@@ -64,25 +64,25 @@ export declare const EXIT_CODES: {
|
|
|
64
64
|
* executor.register(wf);
|
|
65
65
|
* }
|
|
66
66
|
*
|
|
67
|
-
* // Run the
|
|
68
|
-
* const exitCode = await
|
|
67
|
+
* // Run the workflow run
|
|
68
|
+
* const exitCode = await runWorkflowRun({ backend, executor });
|
|
69
69
|
* Deno.exit(exitCode);
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
|
-
export declare function
|
|
72
|
+
export declare function runWorkflowRun(config: WorkflowRunEntrypointConfig): Promise<number>;
|
|
73
73
|
/**
|
|
74
|
-
* Create a simple
|
|
74
|
+
* Create a simple workflow run entrypoint script.
|
|
75
75
|
*
|
|
76
76
|
* This is a convenience function that creates the entire entrypoint
|
|
77
77
|
* with Redis backend and executor setup.
|
|
78
78
|
*
|
|
79
79
|
* @example
|
|
80
80
|
* ```typescript
|
|
81
|
-
* //
|
|
82
|
-
* import {
|
|
81
|
+
* // workflow-runner.ts
|
|
82
|
+
* import { createWorkflowRunEntrypoint } from "veryfront/workflow/worker";
|
|
83
83
|
* import { workflows } from "./workflows.ts";
|
|
84
84
|
*
|
|
85
|
-
* const run =
|
|
85
|
+
* const run = createWorkflowRunEntrypoint({
|
|
86
86
|
* redisUrl: Deno.env.get("REDIS_URL")!,
|
|
87
87
|
* workflows,
|
|
88
88
|
* });
|
|
@@ -91,7 +91,7 @@ export declare function runWorkflowJob(config: JobEntrypointConfig): Promise<num
|
|
|
91
91
|
* Deno.exit(exitCode);
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
|
-
export interface
|
|
94
|
+
export interface CreateWorkflowRunEntrypointOptions {
|
|
95
95
|
/** Redis URL for backend */
|
|
96
96
|
redisUrl: string;
|
|
97
97
|
/** Workflows to register */
|
|
@@ -101,6 +101,6 @@ export interface CreateJobEntrypointOptions {
|
|
|
101
101
|
/** Enable debug logging */
|
|
102
102
|
debug?: boolean;
|
|
103
103
|
}
|
|
104
|
-
/** Create
|
|
105
|
-
export declare function
|
|
104
|
+
/** Create a workflow run entrypoint. */
|
|
105
|
+
export declare function createWorkflowRunEntrypoint(options: CreateWorkflowRunEntrypointOptions): Promise<() => Promise<number>>;
|
|
106
106
|
//# sourceMappingURL=job-entrypoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-entrypoint.d.ts","sourceRoot":"","sources":["../../../../src/src/workflow/worker/job-entrypoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWtD;;GAEG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"job-entrypoint.d.ts","sourceRoot":"","sources":["../../../../src/src/workflow/worker/job-entrypoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWtD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,uCAAuC;IACvC,OAAO,EAAE,eAAe,CAAC;IAEzB,wBAAwB;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAE3B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,CAgEzF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,kCAAkC;IACjD,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IAEjB,4BAA4B;IAC5B,SAAS,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;IAErD,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wCAAwC;AACxC,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,CA0BhC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Workflow
|
|
2
|
+
* Workflow run entrypoint
|
|
3
3
|
*
|
|
4
4
|
* Runs inside an ephemeral K8s Job container.
|
|
5
5
|
* Executes a single workflow run in complete isolation.
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
import { logger as baseLogger } from "../../utils/index.js";
|
|
23
23
|
import { getEnv } from "../../platform/compat/process.js";
|
|
24
24
|
import { failRunExecution, getFinalRunExitCode, getTenantFromEnv, hydrateRunContextEnv, runWithTenantContext, } from "./shared.js";
|
|
25
|
-
const logger = baseLogger.component("workflow-
|
|
25
|
+
const logger = baseLogger.component("workflow-run-entrypoint");
|
|
26
26
|
/**
|
|
27
|
-
* Exit codes for the
|
|
27
|
+
* Exit codes for the workflow run entrypoint.
|
|
28
28
|
*/
|
|
29
29
|
export const EXIT_CODES = {
|
|
30
30
|
SUCCESS: 0,
|
|
@@ -33,17 +33,17 @@ export const EXIT_CODES = {
|
|
|
33
33
|
NOT_FOUND: 3,
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
|
-
* Run the workflow
|
|
36
|
+
* Run the workflow run entrypoint
|
|
37
37
|
*
|
|
38
38
|
* This function is the main entrypoint for workflow execution in a K8s Job.
|
|
39
39
|
* It should be called from your container's main script.
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* ```typescript
|
|
43
|
-
* //
|
|
43
|
+
* // workflow-runner.ts - Container entrypoint
|
|
44
44
|
* import { RedisBackend } from "veryfront/workflow";
|
|
45
45
|
* import { WorkflowExecutor } from "veryfront/workflow";
|
|
46
|
-
* import {
|
|
46
|
+
* import { runWorkflowRun } from "veryfront/workflow/worker";
|
|
47
47
|
* import { workflows } from "./workflows.ts";
|
|
48
48
|
*
|
|
49
49
|
* const backend = new RedisBackend({ url: Deno.env.get("REDIS_URL")! });
|
|
@@ -54,12 +54,12 @@ export const EXIT_CODES = {
|
|
|
54
54
|
* executor.register(wf);
|
|
55
55
|
* }
|
|
56
56
|
*
|
|
57
|
-
* // Run the
|
|
58
|
-
* const exitCode = await
|
|
57
|
+
* // Run the workflow run
|
|
58
|
+
* const exitCode = await runWorkflowRun({ backend, executor });
|
|
59
59
|
* Deno.exit(exitCode);
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
export async function
|
|
62
|
+
export async function runWorkflowRun(config) {
|
|
63
63
|
const { backend, executor, debug = false } = config;
|
|
64
64
|
// Get workflow run ID from environment
|
|
65
65
|
const runId = getEnv("WORKFLOW_RUN_ID");
|
|
@@ -109,8 +109,8 @@ export async function runWorkflowJob(config) {
|
|
|
109
109
|
return EXIT_CODES.WORKFLOW_FAILED;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
/** Create
|
|
113
|
-
export async function
|
|
112
|
+
/** Create a workflow run entrypoint. */
|
|
113
|
+
export async function createWorkflowRunEntrypoint(options) {
|
|
114
114
|
// Dynamic imports to avoid loading Redis if not needed
|
|
115
115
|
const { RedisBackend } = await import("../backends/redis.js");
|
|
116
116
|
const { WorkflowExecutor } = await import("../executor/workflow-executor.js");
|
|
@@ -126,7 +126,7 @@ export async function createJobEntrypoint(options) {
|
|
|
126
126
|
for (const wf of options.workflows) {
|
|
127
127
|
executor.register(wf.definition);
|
|
128
128
|
}
|
|
129
|
-
return () =>
|
|
129
|
+
return () => runWorkflowRun({
|
|
130
130
|
backend,
|
|
131
131
|
executor,
|
|
132
132
|
debug: options.debug,
|
|
@@ -2,9 +2,9 @@ import { type WorkflowBackend } from "../backends/types.js";
|
|
|
2
2
|
import type { JobExecutor, JobStatus } from "./executors/types.js";
|
|
3
3
|
export type { JobExecutor, JobInfo, JobStatus } from "./executors/types.js";
|
|
4
4
|
/**
|
|
5
|
-
* Configuration for the
|
|
5
|
+
* Configuration for the workflow run manager backed by job executors.
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface WorkflowRunManagerConfig {
|
|
8
8
|
/** Backend for workflow persistence */
|
|
9
9
|
backend: WorkflowBackend;
|
|
10
10
|
/** Job executor (K8s, Docker, Process, etc.) */
|
|
@@ -52,7 +52,7 @@ interface TrackedJob {
|
|
|
52
52
|
createdAt: Date;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Workflow
|
|
55
|
+
* Workflow run manager
|
|
56
56
|
*
|
|
57
57
|
* Orchestrates workflow execution via pluggable job executors.
|
|
58
58
|
* Each workflow runs in complete isolation.
|
|
@@ -64,7 +64,7 @@ interface TrackedJob {
|
|
|
64
64
|
* namespace: "workflows",
|
|
65
65
|
* }, k8sClient);
|
|
66
66
|
*
|
|
67
|
-
* const manager = new
|
|
67
|
+
* const manager = new WorkflowRunManager({
|
|
68
68
|
* backend: redisBackend,
|
|
69
69
|
* executor,
|
|
70
70
|
* });
|
|
@@ -78,7 +78,7 @@ interface TrackedJob {
|
|
|
78
78
|
* entrypointPath: "./job-entrypoint.ts",
|
|
79
79
|
* });
|
|
80
80
|
*
|
|
81
|
-
* const manager = new
|
|
81
|
+
* const manager = new WorkflowRunManager({
|
|
82
82
|
* backend: redisBackend,
|
|
83
83
|
* executor,
|
|
84
84
|
* });
|
|
@@ -86,20 +86,20 @@ interface TrackedJob {
|
|
|
86
86
|
* manager.start();
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
|
-
export declare class
|
|
89
|
+
export declare class WorkflowRunManager {
|
|
90
90
|
private config;
|
|
91
91
|
private status;
|
|
92
92
|
private pollTimeout?;
|
|
93
93
|
private activeJobs;
|
|
94
94
|
private stats;
|
|
95
95
|
private managerId;
|
|
96
|
-
constructor(config:
|
|
96
|
+
constructor(config: WorkflowRunManagerConfig);
|
|
97
97
|
/**
|
|
98
|
-
* Start the
|
|
98
|
+
* Start the workflow run manager.
|
|
99
99
|
*/
|
|
100
100
|
start(): Promise<void>;
|
|
101
101
|
/**
|
|
102
|
-
* Stop the
|
|
102
|
+
* Stop the workflow run manager gracefully.
|
|
103
103
|
*/
|
|
104
104
|
stop(): Promise<void>;
|
|
105
105
|
/**
|
|
@@ -136,7 +136,7 @@ export declare class WorkflowJobManager {
|
|
|
136
136
|
private recordError;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* Create a workflow job
|
|
139
|
+
* Create a workflow run manager backed by job executors.
|
|
140
140
|
*/
|
|
141
|
-
export declare function
|
|
141
|
+
export declare function createWorkflowRunManager(config: WorkflowRunManagerConfig): WorkflowRunManager;
|
|
142
142
|
//# sourceMappingURL=job-manager.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Workflow
|
|
2
|
+
* Workflow run manager
|
|
3
3
|
*
|
|
4
|
-
* Orchestrates workflow execution via isolated jobs.
|
|
4
|
+
* Orchestrates workflow run execution via isolated jobs.
|
|
5
5
|
* Uses pluggable JobExecutor interface for runtime flexibility.
|
|
6
6
|
*
|
|
7
7
|
* Supported runtimes:
|
|
@@ -19,7 +19,7 @@ import { logger as baseLogger } from "../../utils/index.js";
|
|
|
19
19
|
import { hasLockSupport, hasWorkerSupport } from "../backends/types.js";
|
|
20
20
|
import { generateId } from "../types.js";
|
|
21
21
|
import { ORCHESTRATION_ERROR } from "../../errors/index.js";
|
|
22
|
-
const logger = baseLogger.component("workflow-
|
|
22
|
+
const logger = baseLogger.component("workflow-run-manager");
|
|
23
23
|
/** Default interval between poll cycles */
|
|
24
24
|
const DEFAULT_POLL_INTERVAL_MS = 5_000;
|
|
25
25
|
/** Default timeout for a single job (30 minutes) */
|
|
@@ -27,7 +27,7 @@ const DEFAULT_JOB_TIMEOUT_MS = 30 * 60 * 1_000;
|
|
|
27
27
|
/** Default threshold after which a run is considered stalled */
|
|
28
28
|
const DEFAULT_STALLED_THRESHOLD_MS = 60_000;
|
|
29
29
|
/**
|
|
30
|
-
* Workflow
|
|
30
|
+
* Workflow run manager
|
|
31
31
|
*
|
|
32
32
|
* Orchestrates workflow execution via pluggable job executors.
|
|
33
33
|
* Each workflow runs in complete isolation.
|
|
@@ -39,7 +39,7 @@ const DEFAULT_STALLED_THRESHOLD_MS = 60_000;
|
|
|
39
39
|
* namespace: "workflows",
|
|
40
40
|
* }, k8sClient);
|
|
41
41
|
*
|
|
42
|
-
* const manager = new
|
|
42
|
+
* const manager = new WorkflowRunManager({
|
|
43
43
|
* backend: redisBackend,
|
|
44
44
|
* executor,
|
|
45
45
|
* });
|
|
@@ -53,7 +53,7 @@ const DEFAULT_STALLED_THRESHOLD_MS = 60_000;
|
|
|
53
53
|
* entrypointPath: "./job-entrypoint.ts",
|
|
54
54
|
* });
|
|
55
55
|
*
|
|
56
|
-
* const manager = new
|
|
56
|
+
* const manager = new WorkflowRunManager({
|
|
57
57
|
* backend: redisBackend,
|
|
58
58
|
* executor,
|
|
59
59
|
* });
|
|
@@ -61,7 +61,7 @@ const DEFAULT_STALLED_THRESHOLD_MS = 60_000;
|
|
|
61
61
|
* manager.start();
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
|
-
export class
|
|
64
|
+
export class WorkflowRunManager {
|
|
65
65
|
config;
|
|
66
66
|
status = "idle";
|
|
67
67
|
pollTimeout;
|
|
@@ -89,11 +89,11 @@ export class WorkflowJobManager {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
* Start the
|
|
92
|
+
* Start the workflow run manager.
|
|
93
93
|
*/
|
|
94
94
|
async start() {
|
|
95
95
|
if (this.status === "running") {
|
|
96
|
-
throw ORCHESTRATION_ERROR.create({ detail: "
|
|
96
|
+
throw ORCHESTRATION_ERROR.create({ detail: "Workflow run manager is already running" });
|
|
97
97
|
}
|
|
98
98
|
// Initialize executor if needed
|
|
99
99
|
if (this.config.executor.initialize) {
|
|
@@ -109,7 +109,7 @@ export class WorkflowJobManager {
|
|
|
109
109
|
this.scheduleNextPoll();
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
|
-
* Stop the
|
|
112
|
+
* Stop the workflow run manager gracefully.
|
|
113
113
|
*/
|
|
114
114
|
async stop() {
|
|
115
115
|
if (this.status !== "running") {
|
|
@@ -192,7 +192,7 @@ export class WorkflowJobManager {
|
|
|
192
192
|
if (hasWorkerSupport(this.config.backend)) {
|
|
193
193
|
stalledRuns = await this.config.backend.findStalledRuns(this.config.stalledThreshold);
|
|
194
194
|
if (stalledRuns.length > 0 && this.config.debug) {
|
|
195
|
-
logger.info(`[
|
|
195
|
+
logger.info(`[WorkflowRunManager] Found ${stalledRuns.length} stalled runs to recover`);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
// Combine pending and stalled runs
|
|
@@ -238,7 +238,7 @@ export class WorkflowJobManager {
|
|
|
238
238
|
await this.config.backend.releaseLock?.(run.id);
|
|
239
239
|
}
|
|
240
240
|
catch (error) {
|
|
241
|
-
logger.warn(`[
|
|
241
|
+
logger.warn(`[WorkflowRunManager] Failed to release pending lock for ${run.id}:`, error);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
}
|
|
@@ -275,7 +275,7 @@ export class WorkflowJobManager {
|
|
|
275
275
|
}
|
|
276
276
|
else {
|
|
277
277
|
this.stats.jobsFailed++;
|
|
278
|
-
logger.error(`[
|
|
278
|
+
logger.error(`[WorkflowRunManager] Job failed: ${jobInfo.jobId}`, jobInfo.error);
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
}
|
|
@@ -339,8 +339,8 @@ export class WorkflowJobManager {
|
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
342
|
-
* Create a workflow job
|
|
342
|
+
* Create a workflow run manager backed by job executors.
|
|
343
343
|
*/
|
|
344
|
-
export function
|
|
345
|
-
return new
|
|
344
|
+
export function createWorkflowRunManager(config) {
|
|
345
|
+
return new WorkflowRunManager(config);
|
|
346
346
|
}
|