@semiont/jobs 0.3.4 → 0.3.5
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/index.d.ts +3 -7
- package/dist/index.js +17 -29
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Readable } from 'stream';
|
|
2
2
|
import { ResourceId, JobId, UserId, EntityType, AnnotationId, components, GatheredContext, Logger, EventBus } from '@semiont/core';
|
|
3
|
+
import { SemiontProject } from '@semiont/core/node';
|
|
3
4
|
import { InferenceClient } from '@semiont/inference';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -277,9 +278,6 @@ interface JobQueryFilters {
|
|
|
277
278
|
* Jobs are stored in directories by status for easy polling.
|
|
278
279
|
*/
|
|
279
280
|
|
|
280
|
-
interface JobQueueConfig {
|
|
281
|
-
dataDir: string;
|
|
282
|
-
}
|
|
283
281
|
declare class JobQueue {
|
|
284
282
|
private eventBus?;
|
|
285
283
|
private jobsDir;
|
|
@@ -287,7 +285,7 @@ declare class JobQueue {
|
|
|
287
285
|
private pendingQueue;
|
|
288
286
|
private watcher;
|
|
289
287
|
private loadDebounceTimer;
|
|
290
|
-
constructor(
|
|
288
|
+
constructor(project: SemiontProject, logger: Logger, eventBus?: EventBus | undefined);
|
|
291
289
|
/**
|
|
292
290
|
* Initialize job queue directories, load pending jobs, and start fs.watch
|
|
293
291
|
*/
|
|
@@ -348,8 +346,6 @@ declare class JobQueue {
|
|
|
348
346
|
cancelled: number;
|
|
349
347
|
}>;
|
|
350
348
|
}
|
|
351
|
-
declare function getJobQueue(): JobQueue;
|
|
352
|
-
declare function initializeJobQueue(config: JobQueueConfig, logger: Logger, eventBus?: EventBus): Promise<JobQueue>;
|
|
353
349
|
|
|
354
350
|
/**
|
|
355
351
|
* Job Worker Base Class
|
|
@@ -722,4 +718,4 @@ declare function generateResourceFromTopic(topic: string, entityTypes: string[],
|
|
|
722
718
|
content: string;
|
|
723
719
|
}>;
|
|
724
720
|
|
|
725
|
-
export { AnnotationDetection, type AnyJob, AssessmentAnnotationWorker, type AssessmentDetectionJob, type AssessmentDetectionParams, type AssessmentDetectionProgress, type AssessmentDetectionResult, type CancelledJob, CommentAnnotationWorker, type CommentDetectionJob, type CommentDetectionParams, type CommentDetectionProgress, type CommentDetectionResult, type CompleteJob, type ContentFetcher, type DetectionJob, type DetectionParams, type DetectionProgress, type DetectionResult, type FailedJob, type GenerationJob, type GenerationParams, type GenerationResult, GenerationWorker, HighlightAnnotationWorker, type HighlightDetectionJob, type HighlightDetectionParams, type HighlightDetectionProgress, type HighlightDetectionResult, type JobMetadata, type JobQueryFilters, JobQueue, type
|
|
721
|
+
export { AnnotationDetection, type AnyJob, AssessmentAnnotationWorker, type AssessmentDetectionJob, type AssessmentDetectionParams, type AssessmentDetectionProgress, type AssessmentDetectionResult, type CancelledJob, CommentAnnotationWorker, type CommentDetectionJob, type CommentDetectionParams, type CommentDetectionProgress, type CommentDetectionResult, type CompleteJob, type ContentFetcher, type DetectionJob, type DetectionParams, type DetectionProgress, type DetectionResult, type FailedJob, type GenerationJob, type GenerationParams, type GenerationResult, GenerationWorker, HighlightAnnotationWorker, type HighlightDetectionJob, type HighlightDetectionParams, type HighlightDetectionProgress, type HighlightDetectionResult, type JobMetadata, type JobQueryFilters, JobQueue, type JobStatus, type JobType, JobWorker, type PendingJob, ReferenceAnnotationWorker, type RunningJob, TagAnnotationWorker, type TagDetectionJob, type TagDetectionParams, type TagDetectionProgress, type TagDetectionResult, type YieldProgress, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob };
|
package/dist/index.js
CHANGED
|
@@ -9712,9 +9712,9 @@ var require_operators = __commonJS({
|
|
|
9712
9712
|
}
|
|
9713
9713
|
});
|
|
9714
9714
|
var JobQueue = class {
|
|
9715
|
-
constructor(
|
|
9715
|
+
constructor(project, logger, eventBus) {
|
|
9716
9716
|
this.eventBus = eventBus;
|
|
9717
|
-
this.jobsDir =
|
|
9717
|
+
this.jobsDir = project.jobsDir;
|
|
9718
9718
|
this.logger = logger;
|
|
9719
9719
|
}
|
|
9720
9720
|
jobsDir;
|
|
@@ -9975,18 +9975,6 @@ var JobQueue = class {
|
|
|
9975
9975
|
return stats;
|
|
9976
9976
|
}
|
|
9977
9977
|
};
|
|
9978
|
-
var jobQueue = null;
|
|
9979
|
-
function getJobQueue() {
|
|
9980
|
-
if (!jobQueue) {
|
|
9981
|
-
throw new Error("JobQueue not initialized. Call initializeJobQueue() first.");
|
|
9982
|
-
}
|
|
9983
|
-
return jobQueue;
|
|
9984
|
-
}
|
|
9985
|
-
async function initializeJobQueue(config, logger, eventBus) {
|
|
9986
|
-
jobQueue = new JobQueue(config, logger, eventBus);
|
|
9987
|
-
await jobQueue.initialize();
|
|
9988
|
-
return jobQueue;
|
|
9989
|
-
}
|
|
9990
9978
|
|
|
9991
9979
|
// src/job-worker.ts
|
|
9992
9980
|
var JobWorker = class {
|
|
@@ -9996,8 +9984,8 @@ var JobWorker = class {
|
|
|
9996
9984
|
errorBackoffMs;
|
|
9997
9985
|
jobQueue;
|
|
9998
9986
|
logger;
|
|
9999
|
-
constructor(
|
|
10000
|
-
this.jobQueue =
|
|
9987
|
+
constructor(jobQueue, pollIntervalMs = 1e3, errorBackoffMs = 5e3, logger) {
|
|
9988
|
+
this.jobQueue = jobQueue;
|
|
10001
9989
|
this.pollIntervalMs = pollIntervalMs;
|
|
10002
9990
|
this.errorBackoffMs = errorBackoffMs;
|
|
10003
9991
|
this.logger = logger;
|
|
@@ -11083,8 +11071,8 @@ Example output:
|
|
|
11083
11071
|
|
|
11084
11072
|
// src/workers/reference-annotation-worker.ts
|
|
11085
11073
|
var ReferenceAnnotationWorker = class extends JobWorker {
|
|
11086
|
-
constructor(
|
|
11087
|
-
super(
|
|
11074
|
+
constructor(jobQueue, inferenceClient, eventBus, contentFetcher, logger) {
|
|
11075
|
+
super(jobQueue, void 0, void 0, logger);
|
|
11088
11076
|
this.inferenceClient = inferenceClient;
|
|
11089
11077
|
this.eventBus = eventBus;
|
|
11090
11078
|
this.contentFetcher = contentFetcher;
|
|
@@ -11495,8 +11483,8 @@ Requirements:
|
|
|
11495
11483
|
var import_rxjs = __toESM(require_cjs());
|
|
11496
11484
|
var import_operators = __toESM(require_operators());
|
|
11497
11485
|
var GenerationWorker = class extends JobWorker {
|
|
11498
|
-
constructor(
|
|
11499
|
-
super(
|
|
11486
|
+
constructor(jobQueue, inferenceClient, eventBus, logger) {
|
|
11487
|
+
super(jobQueue, void 0, void 0, logger);
|
|
11500
11488
|
this.inferenceClient = inferenceClient;
|
|
11501
11489
|
this.eventBus = eventBus;
|
|
11502
11490
|
}
|
|
@@ -11721,8 +11709,8 @@ var GenerationWorker = class extends JobWorker {
|
|
|
11721
11709
|
}
|
|
11722
11710
|
};
|
|
11723
11711
|
var HighlightAnnotationWorker = class extends JobWorker {
|
|
11724
|
-
constructor(
|
|
11725
|
-
super(
|
|
11712
|
+
constructor(jobQueue, inferenceClient, eventBus, contentFetcher, logger) {
|
|
11713
|
+
super(jobQueue, void 0, void 0, logger);
|
|
11726
11714
|
this.inferenceClient = inferenceClient;
|
|
11727
11715
|
this.eventBus = eventBus;
|
|
11728
11716
|
this.contentFetcher = contentFetcher;
|
|
@@ -11912,8 +11900,8 @@ var HighlightAnnotationWorker = class extends JobWorker {
|
|
|
11912
11900
|
}
|
|
11913
11901
|
};
|
|
11914
11902
|
var AssessmentAnnotationWorker = class extends JobWorker {
|
|
11915
|
-
constructor(
|
|
11916
|
-
super(
|
|
11903
|
+
constructor(jobQueue, inferenceClient, eventBus, contentFetcher, logger) {
|
|
11904
|
+
super(jobQueue, void 0, void 0, logger);
|
|
11917
11905
|
this.inferenceClient = inferenceClient;
|
|
11918
11906
|
this.eventBus = eventBus;
|
|
11919
11907
|
this.contentFetcher = contentFetcher;
|
|
@@ -12107,8 +12095,8 @@ var AssessmentAnnotationWorker = class extends JobWorker {
|
|
|
12107
12095
|
}
|
|
12108
12096
|
};
|
|
12109
12097
|
var CommentAnnotationWorker = class extends JobWorker {
|
|
12110
|
-
constructor(
|
|
12111
|
-
super(
|
|
12098
|
+
constructor(jobQueue, inferenceClient, eventBus, contentFetcher, logger) {
|
|
12099
|
+
super(jobQueue, void 0, void 0, logger);
|
|
12112
12100
|
this.inferenceClient = inferenceClient;
|
|
12113
12101
|
this.eventBus = eventBus;
|
|
12114
12102
|
this.contentFetcher = contentFetcher;
|
|
@@ -12310,8 +12298,8 @@ var CommentAnnotationWorker = class extends JobWorker {
|
|
|
12310
12298
|
}
|
|
12311
12299
|
};
|
|
12312
12300
|
var TagAnnotationWorker = class extends JobWorker {
|
|
12313
|
-
constructor(
|
|
12314
|
-
super(
|
|
12301
|
+
constructor(jobQueue, inferenceClient, eventBus, contentFetcher, logger) {
|
|
12302
|
+
super(jobQueue, void 0, void 0, logger);
|
|
12315
12303
|
this.inferenceClient = inferenceClient;
|
|
12316
12304
|
this.eventBus = eventBus;
|
|
12317
12305
|
this.contentFetcher = contentFetcher;
|
|
@@ -12552,6 +12540,6 @@ var TagAnnotationWorker = class extends JobWorker {
|
|
|
12552
12540
|
}
|
|
12553
12541
|
};
|
|
12554
12542
|
|
|
12555
|
-
export { AnnotationDetection, AssessmentAnnotationWorker, CommentAnnotationWorker, GenerationWorker, HighlightAnnotationWorker, JobQueue, JobWorker, ReferenceAnnotationWorker, TagAnnotationWorker, generateResourceFromTopic,
|
|
12543
|
+
export { AnnotationDetection, AssessmentAnnotationWorker, CommentAnnotationWorker, GenerationWorker, HighlightAnnotationWorker, JobQueue, JobWorker, ReferenceAnnotationWorker, TagAnnotationWorker, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob };
|
|
12556
12544
|
//# sourceMappingURL=index.js.map
|
|
12557
12545
|
//# sourceMappingURL=index.js.map
|