diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2024-03-05 13:23:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-05 13:23:57 +0100 |
| commit | 5864cbcbfe2eb8c36ca05c3a39c7e5916aeecaec (patch) | |
| tree | 5b2773b8dc21c2e1b526fb70f829c376dd80532a /opendc-trace/opendc-trace-wfformat/src | |
| parent | d28002a3c151d198298574312f32f1cb43f3a660 (diff) | |
Updated package versions, updated web server tests. (#207)
* Updated all package versions including kotlin. Updated all web-server tests to run.
* Changed the java version of the tests. OpenDC now only supports java 19.
* small update
* test update
* new update
* updated docker version to 19
* updated docker version to 19
Diffstat (limited to 'opendc-trace/opendc-trace-wfformat/src')
4 files changed, 203 insertions, 165 deletions
diff --git a/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReader.kt b/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReader.kt index e0cbd305..8f84e51f 100644 --- a/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReader.kt +++ b/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReader.kt @@ -81,13 +81,14 @@ internal class WfFormatTaskTableReader(private val parser: JsonParser) : TableRe } ParserLevel.WORKFLOW -> { // Seek for the jobs object in the file - level = if (!seekJobs()) { - ParserLevel.TRACE - } else if (!parser.isExpectedStartArrayToken) { - throw JsonParseException(parser, "Expected array", parser.currentLocation) - } else { - ParserLevel.JOB - } + level = + if (!seekJobs()) { + ParserLevel.TRACE + } else if (!parser.isExpectedStartArrayToken) { + throw JsonParseException(parser, "Expected array", parser.currentLocation) + } else { + ParserLevel.JOB + } } ParserLevel.JOB -> { when (parser.nextToken()) { @@ -108,18 +109,18 @@ internal class WfFormatTaskTableReader(private val parser: JsonParser) : TableRe override fun resolve(name: String): Int { return when (name) { - TASK_ID -> COL_ID - TASK_WORKFLOW_ID -> COL_WORKFLOW_ID - TASK_RUNTIME -> COL_RUNTIME - TASK_REQ_NCPUS -> COL_NPROC - TASK_PARENTS -> COL_PARENTS - TASK_CHILDREN -> COL_CHILDREN + TASK_ID -> colID + TASK_WORKFLOW_ID -> colWorkflowID + TASK_RUNTIME -> colRuntime + TASK_REQ_NCPUS -> colNproc + TASK_PARENTS -> colParents + TASK_CHILDREN -> colChildren else -> -1 } } override fun isNull(index: Int): Boolean { - require(index in 0..COL_CHILDREN) { "Invalid column value" } + require(index in 0..colChildren) { "Invalid column value" } return false } @@ -130,7 +131,7 @@ internal class WfFormatTaskTableReader(private val parser: JsonParser) : TableRe override fun getInt(index: Int): Int { checkActive() return when (index) { - COL_NPROC -> cores + colNproc -> cores else -> throw IllegalArgumentException("Invalid column") } } @@ -150,8 +151,8 @@ internal class WfFormatTaskTableReader(private val parser: JsonParser) : TableRe override fun getString(index: Int): String? { checkActive() return when (index) { - COL_ID -> id - COL_WORKFLOW_ID -> workflowId + colID -> id + colWorkflowID -> workflowId else -> throw IllegalArgumentException("Invalid column") } } @@ -167,25 +168,35 @@ internal class WfFormatTaskTableReader(private val parser: JsonParser) : TableRe override fun getDuration(index: Int): Duration? { checkActive() return when (index) { - COL_RUNTIME -> runtime + colRuntime -> runtime else -> throw IllegalArgumentException("Invalid column") } } - override fun <T> getList(index: Int, elementType: Class<T>): List<T>? { + override fun <T> getList( + index: Int, + elementType: Class<T>, + ): List<T>? { throw IllegalArgumentException("Invalid column") } - override fun <T> getSet(index: Int, elementType: Class<T>): Set<T>? { + override fun <T> getSet( + index: Int, + elementType: Class<T>, + ): Set<T>? { checkActive() return when (index) { - COL_PARENTS -> TYPE_PARENTS.convertTo(parents, elementType) - COL_CHILDREN -> TYPE_CHILDREN.convertTo(children, elementType) + colParents -> typeParents.convertTo(parents, elementType) + colChildren -> typeChildren.convertTo(children, elementType) else -> throw IllegalArgumentException("Invalid column") } } - override fun <K, V> getMap(index: Int, keyType: Class<K>, valueType: Class<V>): Map<K, V>? { + override fun <K, V> getMap( + index: Int, + keyType: Class<K>, + valueType: Class<V>, + ): Map<K, V>? { throw IllegalArgumentException("Invalid column") } @@ -267,7 +278,10 @@ internal class WfFormatTaskTableReader(private val parser: JsonParser) : TableRe } private enum class ParserLevel { - TOP, TRACE, WORKFLOW, JOB + TOP, + TRACE, + WORKFLOW, + JOB, } /** @@ -288,13 +302,13 @@ internal class WfFormatTaskTableReader(private val parser: JsonParser) : TableRe cores = -1 } - private val COL_ID = 0 - private val COL_WORKFLOW_ID = 1 - private val COL_RUNTIME = 3 - private val COL_NPROC = 4 - private val COL_PARENTS = 5 - private val COL_CHILDREN = 6 + private val colID = 0 + private val colWorkflowID = 1 + private val colRuntime = 3 + private val colNproc = 4 + private val colParents = 5 + private val colChildren = 6 - private val TYPE_PARENTS = TableColumnType.Set(TableColumnType.String) - private val TYPE_CHILDREN = TableColumnType.Set(TableColumnType.String) + private val typeParents = TableColumnType.Set(TableColumnType.String) + private val typeChildren = TableColumnType.Set(TableColumnType.String) } diff --git a/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormat.kt b/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormat.kt index 35fb883a..2178fac6 100644 --- a/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormat.kt +++ b/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormat.kt @@ -55,30 +55,41 @@ public class WfFormatTraceFormat : TraceFormat { override fun getTables(path: Path): List<String> = listOf(TABLE_TASKS) - override fun getDetails(path: Path, table: String): TableDetails { + override fun getDetails( + path: Path, + table: String, + ): TableDetails { return when (table) { - TABLE_TASKS -> TableDetails( - listOf( - TableColumn(TASK_ID, TableColumnType.String), - TableColumn(TASK_WORKFLOW_ID, TableColumnType.String), - TableColumn(TASK_RUNTIME, TableColumnType.Duration), - TableColumn(TASK_REQ_NCPUS, TableColumnType.Int), - TableColumn(TASK_PARENTS, TableColumnType.Set(TableColumnType.String)), - TableColumn(TASK_CHILDREN, TableColumnType.Set(TableColumnType.String)) + TABLE_TASKS -> + TableDetails( + listOf( + TableColumn(TASK_ID, TableColumnType.String), + TableColumn(TASK_WORKFLOW_ID, TableColumnType.String), + TableColumn(TASK_RUNTIME, TableColumnType.Duration), + TableColumn(TASK_REQ_NCPUS, TableColumnType.Int), + TableColumn(TASK_PARENTS, TableColumnType.Set(TableColumnType.String)), + TableColumn(TASK_CHILDREN, TableColumnType.Set(TableColumnType.String)), + ), ) - ) else -> throw IllegalArgumentException("Table $table not supported") } } - override fun newReader(path: Path, table: String, projection: List<String>?): TableReader { + override fun newReader( + path: Path, + table: String, + projection: List<String>?, + ): TableReader { return when (table) { TABLE_TASKS -> WfFormatTaskTableReader(factory.createParser(path.toFile())) else -> throw IllegalArgumentException("Table $table not supported") } } - override fun newWriter(path: Path, table: String): TableWriter { + override fun newWriter( + path: Path, + table: String, + ): TableWriter { throw UnsupportedOperationException("Writing not supported for this format") } } diff --git a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt index 0560d642..618cdf7d 100644 --- a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt +++ b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt @@ -69,11 +69,12 @@ internal class WfFormatTaskTableReaderTest { @Test fun testNoWorkflow() { - val content = """ - { - "name": "eager-nextflow-chameleon" - } - """.trimIndent() + val content = + """ + { + "name": "eager-nextflow-chameleon" + } + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -88,12 +89,13 @@ internal class WfFormatTaskTableReaderTest { @Test fun testWorkflowArrayType() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": [] - } - """.trimIndent() + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": [] + } + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -108,12 +110,13 @@ internal class WfFormatTaskTableReaderTest { @Test fun testWorkflowNullType() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": null - } - """.trimIndent() + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": null + } + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -128,14 +131,15 @@ internal class WfFormatTaskTableReaderTest { @Test fun testNoJobs() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": { + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": { + } } - } - """.trimIndent() + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -146,12 +150,13 @@ internal class WfFormatTaskTableReaderTest { @Test fun testJobsObjectType() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": { "jobs": {} } - } - """.trimIndent() + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": { "jobs": {} } + } + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -162,12 +167,13 @@ internal class WfFormatTaskTableReaderTest { @Test fun testJobsNullType() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": { "jobs": null } - } - """.trimIndent() + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": { "jobs": null } + } + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -178,14 +184,15 @@ internal class WfFormatTaskTableReaderTest { @Test fun testJobsInvalidChildType() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": { - "jobs": [1] + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": { + "jobs": [1] + } } - } - """.trimIndent() + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -196,18 +203,19 @@ internal class WfFormatTaskTableReaderTest { @Test fun testJobsValidChildType() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": { - "jobs": [ - { - "name": "test" - } - ] + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": { + "jobs": [ + { + "name": "test" + } + ] + } } - } - """.trimIndent() + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -220,19 +228,20 @@ internal class WfFormatTaskTableReaderTest { @Test fun testJobsInvalidParents() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": { - "jobs": [ - { - "name": "test", - "parents": 1, - } - ] + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": { + "jobs": [ + { + "name": "test", + "parents": 1, + } + ] + } } - } - """.trimIndent() + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -243,19 +252,20 @@ internal class WfFormatTaskTableReaderTest { @Test fun testJobsInvalidParentsItem() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": { - "jobs": [ - { - "name": "test", - "parents": [1], - } - ] + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": { + "jobs": [ + { + "name": "test", + "parents": [1], + } + ] + } } - } - """.trimIndent() + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -266,19 +276,20 @@ internal class WfFormatTaskTableReaderTest { @Test fun testJobsValidParents() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": { - "jobs": [ - { - "name": "test", - "parents": ["1"] - } - ] + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": { + "jobs": [ + { + "name": "test", + "parents": ["1"] + } + ] + } } - } - """.trimIndent() + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -291,19 +302,20 @@ internal class WfFormatTaskTableReaderTest { @Test fun testJobsInvalidSecondEntry() { - val content = """ - { - "workflow": { - "jobs": [ - { - "name": "test", - "parents": ["1"] - }, - "test" - ] + val content = + """ + { + "workflow": { + "jobs": [ + { + "name": "test", + "parents": ["1"] + }, + "test" + ] + } } - } - """.trimIndent() + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) @@ -315,25 +327,26 @@ internal class WfFormatTaskTableReaderTest { @Test fun testDuplicateJobsArray() { - val content = """ - { - "name": "eager-nextflow-chameleon", - "workflow": { - "jobs": [ - { - "name": "test", - "parents": ["1"] - } - ], - "jobs": [ - { - "name": "test2", - "parents": ["test"] - } - ] + val content = + """ + { + "name": "eager-nextflow-chameleon", + "workflow": { + "jobs": [ + { + "name": "test", + "parents": ["1"] + } + ], + "jobs": [ + { + "name": "test2", + "parents": ["test"] + } + ] + } } - } - """.trimIndent() + """.trimIndent() val parser = factory.createParser(content) val reader = WfFormatTaskTableReader(parser) diff --git a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt index 75f4b413..80a9d80e 100644 --- a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt @@ -81,7 +81,7 @@ class WfFormatTraceFormatTest { { assertEquals("makebwaindex_mammoth_mt_krause.fasta", reader.getString(TASK_ID)) }, { assertEquals("eager-nextflow-chameleon", reader.getString(TASK_WORKFLOW_ID)) }, { assertEquals(172000, reader.getDuration(TASK_RUNTIME)?.toMillis()) }, - { assertEquals(emptySet<String>(), reader.getSet(TASK_PARENTS, String::class.java)) } + { assertEquals(emptySet<String>(), reader.getSet(TASK_PARENTS, String::class.java)) }, ) assertAll( @@ -89,7 +89,7 @@ class WfFormatTraceFormatTest { { assertEquals("makeseqdict_mammoth_mt_krause.fasta", reader.getString(TASK_ID)) }, { assertEquals("eager-nextflow-chameleon", reader.getString(TASK_WORKFLOW_ID)) }, { assertEquals(175000, reader.getDuration(TASK_RUNTIME)?.toMillis()) }, - { assertEquals(setOf("makebwaindex_mammoth_mt_krause.fasta"), reader.getSet(TASK_PARENTS, String::class.java)) } + { assertEquals(setOf("makebwaindex_mammoth_mt_krause.fasta"), reader.getSet(TASK_PARENTS, String::class.java)) }, ) reader.close() |
