You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "turboFei (via GitHub)" <gi...@apache.org> on 2025/06/01 06:19:41 UTC

Re: [PR] [CELEBORN-2014] updateInterruptionNotice REST API [celeborn]

turboFei commented on code in PR #3285:
URL: https://github.com/apache/celeborn/pull/3285#discussion_r2117952916


##########
cli/src/main/scala/org/apache/celeborn/cli/master/MasterSubcommandImpl.scala:
##########
@@ -263,4 +269,36 @@ class MasterSubcommandImpl extends Runnable with MasterSubcommand {
     val request = new DeleteAppsRequest().apps(appIds)
     applicationApi.deleteApps(request, commonOptions.getAuthHeader)
   }
+
+  override private[master] def updateInterruptionNotices: HandleResponse = {
+    val workerInterruptionNotices = masterOptions.updateInterruptionNotices
+      .split(",")
+      .toList
+      .map { pair =>
+        val parts = pair.split("=", 2)
+        if (parts.length != 2) {
+          throw new ParameterException(
+            spec.commandLine(),
+            s"Invalid format for interruption notice: '$pair'. Expected format: workerId=timestamp")
+        }
+        val workerIdStr = parts(0)
+        val timestampStr = parts(1)
+        val timestamp =
+          try {
+            timestampStr.toLong
+          } catch {
+            case _: NumberFormatException =>
+              throw new ParameterException(
+                spec.commandLine(),
+                s"Invalid timestamp for worker '$workerIdStr': '$timestampStr' is not a valid long")
+          }
+        new WorkerInterruptionNotice()
+          .workerId(toWorkerId(workerIdStr))
+          .interruptionTimestamp(timestamp)
+      }
+
+    val request = new UpdateInterruptionNoticeRequest().workers(workerInterruptionNotices.asJava)
+    workerApi.updateInterruptionNotice(request)

Review Comment:
   authHeader



-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org