tysonnorris commented on a change in pull request #2689: first stage of support 
for dynamic invoker id assignment
URL: 
https://github.com/apache/incubator-openwhisk/pull/2689#discussion_r141490703
 
 

 ##########
 File path: core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
 ##########
 @@ -85,6 +86,41 @@ object Invoker {
       abort()
     }
 
+    val proposedInvokerId: Option[Int] = args.headOption.map(_.toInt)
+    val assignedInvokerId = proposedInvokerId
+      .map { id =>
+        logger.info(this, s"invokerReg: using proposedInvokerId ${id}")
+        id
+      }
+      .getOrElse {
+        val invokerName = config.invokerName
 
 Review comment:
   Can invokerName come from an separate environment variable or arg? I think 
it would be possible from typesafe config, but don't think so with whisk 
Config. In our case, since the ID is an arg we can generate it with a script, 
but it cannot be the IP address directly since it is not an Int, or easily 
translated to an Int that is "small".  It would be better to use the 
invokerName, and leverage your approach, but we cannot do that with 
`config.invokerName` afaik without designating a name unique to each instance. 
   
   This may be more of a problem of using IndexedSeq[Int] in the controller 
with padding where a large value for proposedInvokerId will cause havoc due to 
padding of invoker registration for each id lower than the proposed. 
   
   It would be great to document this treatment of instanceid (I couldn't find 
any) to let devs know that using "any Int" is not acceptable; or else it would 
be good to have a workaround, I may be doing it wrong - we hoped to use an int 
derived from IP number, but the result is that, for example, the 
controller/invokers endpoint displays as massive quantity of invokers, all of 
which are offline, due to the padding. I'm not sure if it would be possible to 
change this type from Int to String in controllers invoker registration logic, 
but that would be one way to solve it, if using a referenced env var (e.g. 
`INVOKER_NAME=${SOME_VAR}`)  for invoker name is not possible.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to