Skip to content

Commit f30ecba

Browse files
committed
Fix numDocs being 0 for a job
1 parent 0117792 commit f30ecba

6 files changed

Lines changed: 7 additions & 10 deletions

File tree

client/src/views/annotate/subviews/CorporaView.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<script setup lang='ts'>
6363
// Libraries & stores
6464
import { ref, onMounted } from 'vue'
65-
import stores, { CorporaStore, JobsStore } from '@/stores'
65+
import stores, { CorporaStore } from '@/stores'
6666
// Types & API
6767
import { CorpusMetadata } from '@/types/corpora'
6868
import { TableCorporaType } from '@/types/table'
@@ -75,7 +75,6 @@ import BenchmarkSetsHelp from "@/components/help/BenchmarkSetsHelp.vue"
7575
7676
// Stores
7777
const corporaStore = stores.useCorpora() as CorporaStore
78-
const jobsStore = stores.useJobs() as JobsStore
7978
8079
// Fields
8180
const showNewCorpusModal = ref(false)
@@ -92,10 +91,8 @@ const editMode = (corpus: CorpusMetadata) => {
9291
/**
9392
* Although CorporaView lives in AnnotateView, which reloads corpora,
9493
* the number of jobs could change when navigating between jobs and corpora, requiring a reload.
95-
* We also need the jobs store to poll for job status updates.
9694
*/
9795
onMounted(() => {
9896
corporaStore.reload()
99-
jobsStore.reload()
10097
})
10198
</script>

server/src/main/kotlin/org/ivdnt/galahad/documents/Document.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class Document(
5454
fun create(dir: File, file: File, corpus: Corpus): Document {
5555
// Create a document to access the paths
5656
val doc = Document(dir)
57-
5857
// uploaded file
5958
ThreadPoolUtil.pool.execute {
6059
file.copyTo(doc.uploadedFile, overwrite = true)
@@ -66,7 +65,6 @@ class Document(
6665
corpus.jobs.createOrThrow(SOURCE_LAYER_NAME).setLayer(doc.name, sourceLayer)
6766
// metadata; needs to be serialized as well
6867
DiskValue<DocumentMetadata>(doc.metadataFile).write(DocumentMetadata.create(internalFile))
69-
7068
// The same document object is now valid: it's folder data has been filled.
7169
return doc
7270
}

server/src/main/kotlin/org/ivdnt/galahad/jobs/Jobs.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ class Jobs(
4949

5050
fun readAllMetadata(): List<JobMetadata> {
5151
// Create a map of all taggers with empty metadata
52+
val numDocs = corpus.immutableMetadata.numDocs
5253
val allJobs = Tagger.taggers.mapValues {
53-
JobMetadata(it.value, Progress(), LayerPreview(emptyList()), LayerSummary(0), 0)
54+
JobMetadata(it.value, Progress(numDocs), LayerPreview.EMPTY, LayerSummary(0), 0)
5455
}
5556
// replace the entries for which a job exists
5657
val jobs = readAll().map { it.metadata }.associateBy { it.tagger.id }
58+
// Replacement is simply plus
5759
return (allJobs + jobs).values.toList()
5860
}
5961
}

server/src/main/kotlin/org/ivdnt/galahad/web/controller/TaggersController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TaggersController(
2929
)
3030
@CrossOrigin
3131
@GetMapping(TAGGERS_URL)
32-
fun getTaggers(): Set<Tagger> = taggersService.readAll()
32+
fun getTaggers(): Iterable<Tagger> = taggersService.readAll()
3333

3434
@Operation(
3535
summary = "Get single tagger",

server/src/main/kotlin/org/ivdnt/galahad/web/controller/TagsetsController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TagsetsController : Logging {
2424
)
2525
@CrossOrigin
2626
@GetMapping(TAGSETS_URL)
27-
fun getTagsets(): Set<Tagset> = Tagset.tagsets.values.toSet()
27+
fun getTagsets(): Iterable<Tagset> = Tagset.tagsets.values
2828

2929
@Operation(
3030
summary = "Get single tagset",

server/src/main/kotlin/org/ivdnt/galahad/web/service/TaggersService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import java.net.http.HttpResponse
1818
@Service
1919
class TaggersService : Logging {
2020

21-
fun readAll(): Set<Tagger> = Tagger.taggers.values.toSet()
21+
fun readAll(): Iterable<Tagger> = Tagger.taggers.values
2222
fun read(tagger: String): Tagger? = Tagger.readOrThrow(tagger)
2323
fun taggerHealth(tagger: String): TaggerHealth {
2424
// If there are multiple replicas for the same service, we only get health check response from one replica.

0 commit comments

Comments
 (0)