Data type Issue RRS feed

  • Question

  • I have the following issue with data types on MLServer 9.3

    I'm trying to deploy a web service that receives some imputs as numeric types and then do some operations with it.

    In order to simplify this post, i'm going to show a dummie example that shows the issue i'm having.

    My web service imputs are defined as:

    multiply <- function(n1,n2){
      n1 = number1
      n2 = number2
      print(paste("Class  N1:",class(n1)))
      print(paste("Class N2:",class(n2)))

    Print statements are included to evaluate the console output after service execution


    ###Deploy Web Service
      api <- publishService(
          code = multiply,
          inputs = list(number1 = "numeric",number2 = "numeric")
          outputs = list(answer = "numeric"),
          v = "v1",
          alias = "consumeService"
    ###Consume Web Service
    api <- getService("multiply2numbers")
    result <- api$consumeService(
      number1 = 4,
      number2 = 8

    ###Checking results
    print(paste("Console Output:",result$consoleOutput))

    This print statements give the following messages:

    [1] "Output: 32"
    [1] "Console Output: [1] \"Class N1: integer\"\r\n[1] \"Class N2: integer\"\r\n"

    Now, n1 and n2 are "integer", but they were defined as "numeric".

    If i run locally
    class(8) -----> "numeric"

    What's happen behind web service execution that original data class is changed to a "integer" class?

    Monday, May 21, 2018 12:51 PM