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-gwf/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-gwf/src')
3 files changed, 79 insertions, 56 deletions
diff --git a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTaskTableReader.kt b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTaskTableReader.kt index 78ce6ad4..8a2a99cb 100644 --- a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTaskTableReader.kt +++ b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTaskTableReader.kt @@ -88,19 +88,19 @@ internal class GwfTaskTableReader(private val parser: CsvParser) : TableReader { override fun resolve(name: String): Int { return when (name) { - TASK_ID -> COL_JOB_ID - TASK_WORKFLOW_ID -> COL_WORKFLOW_ID - TASK_SUBMIT_TIME -> COL_SUBMIT_TIME - TASK_RUNTIME -> COL_RUNTIME - TASK_ALLOC_NCPUS -> COL_NPROC - TASK_REQ_NCPUS -> COL_REQ_NPROC - TASK_PARENTS -> COL_DEPS + TASK_ID -> colJobID + TASK_WORKFLOW_ID -> colWorkflowID + TASK_SUBMIT_TIME -> colSubmitTime + TASK_RUNTIME -> colRuntime + TASK_ALLOC_NCPUS -> colNproc + TASK_REQ_NCPUS -> colReqNproc + TASK_PARENTS -> colDeps else -> -1 } } override fun isNull(index: Int): Boolean { - require(index in 0..COL_DEPS) { "Invalid column" } + require(index in 0..colDeps) { "Invalid column" } return false } @@ -111,8 +111,8 @@ internal class GwfTaskTableReader(private val parser: CsvParser) : TableReader { override fun getInt(index: Int): Int { checkActive() return when (index) { - COL_REQ_NPROC -> reqNProcs - COL_NPROC -> nProcs + colReqNproc -> reqNProcs + colNproc -> nProcs else -> throw IllegalArgumentException("Invalid column") } } @@ -132,8 +132,8 @@ internal class GwfTaskTableReader(private val parser: CsvParser) : TableReader { override fun getString(index: Int): String? { checkActive() return when (index) { - COL_JOB_ID -> jobId - COL_WORKFLOW_ID -> workflowId + colJobID -> jobId + colWorkflowID -> workflowId else -> throw IllegalArgumentException("Invalid column") } } @@ -145,7 +145,7 @@ internal class GwfTaskTableReader(private val parser: CsvParser) : TableReader { override fun getInstant(index: Int): Instant? { checkActive() return when (index) { - COL_SUBMIT_TIME -> submitTime + colSubmitTime -> submitTime else -> throw IllegalArgumentException("Invalid column") } } @@ -153,23 +153,33 @@ internal class GwfTaskTableReader(private val parser: CsvParser) : TableReader { 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 <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") } - 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_DEPS -> TYPE_DEPS.convertTo(dependencies, elementType) + colDeps -> typeDeps.convertTo(dependencies, elementType) else -> throw IllegalArgumentException("Invalid column") } } @@ -245,31 +255,32 @@ internal class GwfTaskTableReader(private val parser: CsvParser) : TableReader { dependencies = emptySet() } - private val COL_WORKFLOW_ID = 0 - private val COL_JOB_ID = 1 - private val COL_SUBMIT_TIME = 2 - private val COL_RUNTIME = 3 - private val COL_NPROC = 4 - private val COL_REQ_NPROC = 5 - private val COL_DEPS = 6 + private val colWorkflowID = 0 + private val colJobID = 1 + private val colSubmitTime = 2 + private val colRuntime = 3 + private val colNproc = 4 + private val colReqNproc = 5 + private val colDeps = 6 - private val TYPE_DEPS = TableColumnType.Set(TableColumnType.String) + private val typeDeps = TableColumnType.Set(TableColumnType.String) companion object { /** * The [CsvSchema] that is used to parse the trace. */ - private val schema = CsvSchema.builder() - .addColumn("WorkflowID", CsvSchema.ColumnType.NUMBER) - .addColumn("JobID", CsvSchema.ColumnType.NUMBER) - .addColumn("SubmitTime", CsvSchema.ColumnType.NUMBER) - .addColumn("RunTime", CsvSchema.ColumnType.NUMBER) - .addColumn("NProcs", CsvSchema.ColumnType.NUMBER) - .addColumn("ReqNProcs", CsvSchema.ColumnType.NUMBER) - .addColumn("Dependencies", CsvSchema.ColumnType.STRING) - .setAllowComments(true) - .setUseHeader(true) - .setColumnSeparator(',') - .build() + private val schema = + CsvSchema.builder() + .addColumn("WorkflowID", CsvSchema.ColumnType.NUMBER) + .addColumn("JobID", CsvSchema.ColumnType.NUMBER) + .addColumn("SubmitTime", CsvSchema.ColumnType.NUMBER) + .addColumn("RunTime", CsvSchema.ColumnType.NUMBER) + .addColumn("NProcs", CsvSchema.ColumnType.NUMBER) + .addColumn("ReqNProcs", CsvSchema.ColumnType.NUMBER) + .addColumn("Dependencies", CsvSchema.ColumnType.STRING) + .setAllowComments(true) + .setUseHeader(true) + .setColumnSeparator(',') + .build() } } diff --git a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt index d2ded0ee..097c5593 100644 --- a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt +++ b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt @@ -52,9 +52,10 @@ public class GwfTraceFormat : TraceFormat { /** * The [CsvFactory] used to create the parser. */ - private val factory = CsvFactory() - .enable(CsvParser.Feature.ALLOW_COMMENTS) - .enable(CsvParser.Feature.TRIM_SPACES) + private val factory = + CsvFactory() + .enable(CsvParser.Feature.ALLOW_COMMENTS) + .enable(CsvParser.Feature.TRIM_SPACES) override fun create(path: Path) { throw UnsupportedOperationException("Writing not supported for this format") @@ -62,31 +63,42 @@ public class GwfTraceFormat : 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_WORKFLOW_ID, TableColumnType.String), - TableColumn(TASK_ID, TableColumnType.String), - TableColumn(TASK_SUBMIT_TIME, TableColumnType.Instant), - TableColumn(TASK_RUNTIME, TableColumnType.Duration), - TableColumn(TASK_REQ_NCPUS, TableColumnType.Int), - TableColumn(TASK_ALLOC_NCPUS, TableColumnType.Int), - TableColumn(TASK_PARENTS, TableColumnType.Set(TableColumnType.String)) + TABLE_TASKS -> + TableDetails( + listOf( + TableColumn(TASK_WORKFLOW_ID, TableColumnType.String), + TableColumn(TASK_ID, TableColumnType.String), + TableColumn(TASK_SUBMIT_TIME, TableColumnType.Instant), + TableColumn(TASK_RUNTIME, TableColumnType.Duration), + TableColumn(TASK_REQ_NCPUS, TableColumnType.Int), + TableColumn(TASK_ALLOC_NCPUS, TableColumnType.Int), + TableColumn(TASK_PARENTS, 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 -> GwfTaskTableReader(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-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt b/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt index c75e86df..9c97547a 100644 --- a/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt @@ -82,7 +82,7 @@ internal class GwfTraceFormatTest { { assertEquals("1", reader.getString(TASK_ID)) }, { assertEquals(Instant.ofEpochSecond(16), reader.getInstant(TASK_SUBMIT_TIME)) }, { assertEquals(Duration.ofSeconds(11), reader.getDuration(TASK_RUNTIME)) }, - { assertEquals(emptySet<String>(), reader.getSet(TASK_PARENTS, String::class.java)) } + { assertEquals(emptySet<String>(), reader.getSet(TASK_PARENTS, String::class.java)) }, ) } @@ -101,7 +101,7 @@ internal class GwfTraceFormatTest { { assertEquals("7", reader.getString(TASK_ID)) }, { assertEquals(Instant.ofEpochSecond(87), reader.getInstant(TASK_SUBMIT_TIME)) }, { assertEquals(Duration.ofSeconds(11), reader.getDuration(TASK_RUNTIME)) }, - { assertEquals(setOf("4", "5", "6"), reader.getSet(TASK_PARENTS, String::class.java)) } + { assertEquals(setOf("4", "5", "6"), reader.getSet(TASK_PARENTS, String::class.java)) }, ) } |
