aglinxinyuan commented on code in PR #9519:
URL: https://github.com/apache/texera/pull/9519#discussion_r4649911321


##########
amber/src/main/scala/org/apache/texera/amber/engine/architecture/coordinator/CoordinatorTimerService.scala:
##########
@@ -65,10 +65,9 @@ class CoordinatorTimerService(
   private def disableTimer(handleOpt: Option[Cancellable]): 
Option[Cancellable] = {
     if (handleOpt.nonEmpty) {
       handleOpt.get.cancel()
-      Option.empty
-    } else {
-      handleOpt
+      ()
     }
+    None

Review Comment:
   Done in 5c890204d5 — `disableTimer` is now `handleOpt.foreach(_.cancel())` 
followed by `None`.
   



##########
common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/result/iceberg/IcebergDocument.scala:
##########
@@ -78,19 +78,19 @@ private[storage] class IcebergDocument[T >: Null <: AnyRef](
   // (not a lazy val) also means a replaced/rebuilt catalog is picked up 
immediately.
   def catalog: Catalog = IcebergCatalogInstance.getInstance(warehouse)
 
+  private def requireTable(): Table =
+    IcebergUtil
+      .loadTableMetadata(catalog, tableNamespace, tableName)
+      .getOrElse(
+        throw new NoSuchTableException(f"table ${tableNamespace}.${tableName} 
doesn't exist")
+      )

Review Comment:
   Done in 5c890204d5 — `requireTable` is now a `protected def` on `OnIceberg`, 
and `expireSnapshots` starts from `requireTable()`; `OnIcebergSpec` still pins 
the missing-table message.
   



##########
common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/result/iceberg/IcebergDocument.scala:
##########
@@ -191,10 +191,10 @@ private[storage] class IcebergDocument[T >: Null <: 
AnyRef](
         private var lastSnapshotId: Option[Long] = None
 
         // Counter for how many records have been skipped
-        private var numOfSkippedRecords = 0
+        private var numOfSkippedRecords: Int = _
 
         // Counter for how many records have been returned
-        private var numOfReturnedRecords = 0
+        private var numOfReturnedRecords: Int = _

Review Comment:
   Done in 5c890204d5 — back to `= 0` for `numOfSkippedRecords`, 
`numOfReturnedRecords` and `filenameIdx`.
   



##########
common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/result/iceberg/IcebergDocument.scala:
##########
@@ -576,12 +557,12 @@ private[storage] class IcebergDocument[T >: Null <: 
AnyRef](
     * @return An InputStream that streams the contents of the Iceberg table as 
a ZIP archive.
     */
   override def asInputStream(): InputStream = {
-    val fileScanTasks: Seq[FileScanTask] = {
-      val table = 
this.catalog.loadTable(TableIdentifier.of(this.tableNamespace, this.tableName))
-      table.refresh()
-      Using.resource(table.newScan().planFiles()) { tasks =>
-        tasks.iterator().asScala.toSeq
-      }
+    val planningCatalog = catalog
+    val identifier = TableIdentifier.of(tableNamespace, tableName)
+    val table = planningCatalog.loadTable(identifier)

Review Comment:
   Done in 5c890204d5 — `planningCatalog` is inlined and the entry name is 
`f"part-$i%05d.parquet"` (6139b06bc0 pins `part-00000.parquet`). The per-part 
`loadTable` is deliberate — a table held across the export could outlive its 
catalog in the bounded cache (#7290) — so it now carries that comment, and the 
description no longer says the export reuses one load.
   



##########
computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/ComputingUnitManagingResource.scala:
##########
@@ -727,22 +725,32 @@ class ComputingUnitManagingResource(
         case _ => "{}"
       }
 
+      val creationTime = new Timestamp(System.currentTimeMillis())
+      val uri =
+        if (cuType == WorkflowComputingUnitTypeEnum.local) param.uri.get
+        else "" // placeholder for kubernetes
+      val cuid = ctx
+        .insertInto(WORKFLOW_COMPUTING_UNIT)
+        .set(WORKFLOW_COMPUTING_UNIT.UID, user.getUid)
+        .set(WORKFLOW_COMPUTING_UNIT.NAME, param.name)
+        .set(WORKFLOW_COMPUTING_UNIT.CREATION_TIME, creationTime)
+        .set(WORKFLOW_COMPUTING_UNIT.TYPE, cuType)
+        .set(WORKFLOW_COMPUTING_UNIT.RESOURCE, resourceJson)
+        .set(WORKFLOW_COMPUTING_UNIT.URI, uri)
+        .returningResult(WORKFLOW_COMPUTING_UNIT.CUID)
+        .fetchOne()
+        .value1()
+        .intValue()
+
       val computingUnit = new WorkflowComputingUnit()
       val userToken = JwtAuth.jwtToken(jwtClaims(user.user))
+      computingUnit.setCuid(cuid)
       computingUnit.setUid(user.getUid)
       computingUnit.setName(param.name)
-      computingUnit.setCreationTime(new Timestamp(System.currentTimeMillis()))
-      
computingUnit.setType(WorkflowComputingUnitTypeEnum.lookupLiteral(param.unitType))
+      computingUnit.setCreationTime(creationTime)
+      computingUnit.setType(cuType)
       computingUnit.setResource(resourceJson)
-
-      // Set URI during initial insert for local only
-      if (cuType == WorkflowComputingUnitTypeEnum.local) {
-        computingUnit.setUri(param.uri.get)
-      } else {
-        computingUnit.setUri("") // placeholder for kubernetes
-      }
-
-      wcDao.insert(computingUnit)
+      computingUnit.setUri(uri)

Review Comment:
   Done in 5c890204d5 — one `WorkflowComputingUnit` now drives the row and the 
response: `wcDao.insert` fills in the `cuid` and `wcDao.update` writes the pod 
URI and resource, still without `lastID()` or the re-fetch. The identity 
rethrow after `createPod` is gone too.
   



##########
computing-unit-managing-service/src/main/scala/org/apache/texera/service/resource/CuratedImageResource.scala:
##########
@@ -199,18 +200,25 @@ object CuratedImageResource extends LazyLogging {
     else if (status != Status.Ready) None
     else pinnedRefOf(sourceRef, sourceDigest)
 
-  def readyImageFor(iid: Int): Option[String] = {
+  def readyImageFor(iid: Int): Option[String] =
+    readyImageWithNameFor(iid).map(_._2)
+
+  def readyImageWithNameFor(iid: Int): Option[(Option[String], String)] = {

Review Comment:
   Done in 5c890204d5 — `readyImageFor` now returns `Option[ReadyImage]`, so 
the caller reads `.ref` and `.name`, and `nameOf` is gone.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to