File tree Expand file tree Collapse file tree
client/src/components/modals/jobs
server/src/main/kotlin/org/ivdnt/galahad Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 <template v-else >
3131 <p class =" centerText" v-if =" job.progress.untagged > 0" >
3232 <template v-if =" jobIndication != null " >
33- GaLAHaD is currently processing <b >{{ jobIndication }}</b > {{ jobIndication == 1 ? 'document ' :
34- 'documents ' }}
33+ GaLAHaD is currently processing <b >{{ jobIndication }}</b > {{ jobIndication == 1 ? 'job ' :
34+ 'jobs ' }}
3535 </template >
3636 <template v-else >
3737 Calculating current server load...
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import kotlin.io.path.createTempFile
2424object JobController {
2525 private val queue: ArrayDeque <Job > = ArrayDeque <Job >()
2626 private var task: Task ? = null
27+ val queueSize: Int get() = queue.size
2728
2829 fun queue (job : Job ) {
2930 if (job.name == SOURCE_LAYER_NAME ) throw SourceLayerNotATaggerException ()
@@ -48,6 +49,7 @@ object JobController {
4849 queue - = task!! .job
4950 }
5051 // next document, or next job if all documents are tagged
52+ task = null
5153 start()
5254 }
5355
Original file line number Diff line number Diff line change @@ -11,8 +11,10 @@ import jakarta.servlet.http.HttpServletResponse
1111import org.ivdnt.galahad.annotations.Layer
1212import org.ivdnt.galahad.app.JOBS_URL
1313import org.ivdnt.galahad.app.JOB_URL
14+ import org.ivdnt.galahad.app.TAGGERS_URL
1415import org.ivdnt.galahad.app.User
1516import org.ivdnt.galahad.exceptions.ErrorResponse
17+ import org.ivdnt.galahad.jobs.JobController
1618import org.ivdnt.galahad.jobs.JobMetadata
1719import org.ivdnt.galahad.jobs.Jobs
1820import org.ivdnt.galahad.jobs.Progress
@@ -185,4 +187,12 @@ class JobsController(
185187 @PathVariable @Parameter(description = " Corpus UUID" ) corpus : UUID ,
186188 @PathVariable @Parameter(description = " Tagger name" ) job : String ,
187189 ): Progress = corpus.readJobs().readOrThrow(job).progress
190+
191+ @Operation(
192+ summary = " Number of active tagger jobs" ,
193+ description = " Get the number of active jobs. Indicates server load."
194+ )
195+ @CrossOrigin
196+ @GetMapping(" $TAGGERS_URL /active" )
197+ fun activeJobs (): Int = JobController .queueSize
188198}
Original file line number Diff line number Diff line change @@ -66,12 +66,4 @@ class TaggersController(
6666 @GetMapping(TAGGER_HEALTH_URL )
6767 fun getTaggerHealth (@PathVariable @Parameter(description = " Tagger name" ) tagger : String ): TaggerHealth =
6868 taggersService.taggerHealth(tagger)
69-
70- @Operation(
71- summary = " Number of active document jobs" ,
72- description = " Get the number of documents actively being tagged, cumulative over all taggers. Indicates server load."
73- )
74- @CrossOrigin
75- @GetMapping(" $TAGGERS_URL /active" )
76- fun getActiveDocsAtTaggers (): Int = taggersService.numActiveDocuments()
7769}
You can’t perform that action at this time.
0 commit comments