You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/11/20 05:53:57 UTC

[GitHub] [openwhisk] bdoyle0182 commented on a change in pull request #5030: [New Scheduler] Implement FCPSchedulerServer

bdoyle0182 commented on a change in pull request #5030:
URL: https://github.com/apache/openwhisk/pull/5030#discussion_r527432964



##########
File path: core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/FPCSchedulerServer.scala
##########
@@ -41,10 +43,28 @@ class SchedulerServer(scheduler: SchedulerCore, systemUsername: String, systemPa
   override def routes(implicit transid: TransactionId): Route = {
     super.routes ~ extractCredentials {
       case Some(BasicHttpCredentials(username, password)) if username == systemUsername && password == systemPassword =>
-        (path("disable") & post) {
+        (path("state") & get) {
+          complete {
+            scheduler.getState.map {
+              case (list, creationCount) =>
+                (list
+                  .map(scheduler => scheduler._1.asString -> scheduler._2.toString)
+                  .toMap
+                  ++ Map("creationCount" -> creationCount.toString)).toJson.asJsObject
+            }
+          }
+        } ~ (path("disable") & post) {
           logger.warn(this, "Scheduler is disabled")
           scheduler.disable()
           complete("scheduler disabled")
+        } ~ (path("queue" / "total") & get) {

Review comment:
       let's put `queue` in a constant as it will likely be reused as new api's are added




----------------------------------------------------------------
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.

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