Any guidance would be appreciated - thanks!
# ask-the-community
s
Any guidance would be appreciated - thanks!
s
@seunggs, you’re sending a string but the type is set to integer. How about you remove quotes and try again?
s
Ohhh - ok I’ll try that. Thank you!
@Samhita Alla I don’t think this is the issue - I tried integer value instead and it still fails with the same error.
FYI, after many tries and combinations, this worked:
Copy code
{
  "literals": {
    "_wf_args": {
      "scalar": {
        "generic": {
          "fields": {
            "n_samples": 1000,
            "n_features": 20,
            "n_informative": 15,
            "n_classes": 2,
            "test_size": 0.2,
            "n_estimator": 100
          }
        }
      }
    }
  }
}
But it still looks a bit different from what flyte ui seems to be doing
In the inputs, flyte ui execution shows:
Copy code
{
  "hp": {
    "n_samples": 1000,
    "n_features": 20,
    "n_informative": 15,
    "n_classes": 2,
    "test_size": 0.2,
    "n_estimator": 100
  }
}
Whereas execution run via rest api shows:
Copy code
{
  "hp": {
    "fields": {
      "n_samples": 1000,
      "n_features": 20,
      "n_informative": 15,
      "n_classes": 2,
      "test_size": 0.2,
      "n_estimator": 100
    }
  }
}
Not sure if it matters or how to fix it
s
@Yee, would you be able to answer why there’s a mismatch between the two formats?
y
hey sorry what’s the issue again?
trying to figure out input form values for the UI?
s
I’m just trying to trigger the workflow execution from the rest api and the input values I see in Flyte ui are different. I’m wondering what’s causing the disparity
Maybe I’m not supposed to use “generic” field for creating inputs (my workflow arguments are of dataclass type)
y
what’s the signature of the workflow?
s
It’s a single dataclass
_wf_args
with a bunch of integers and floats inside
So I’m using this to send in as the value for
inputs
argument in POST
executions
endpoint:
Copy code
{
  "literals": {
    "_wf_args": {
      "scalar": {
        "generic": {
          "fields": {
            "n_samples": 1000,
            "n_features": 20,
            "n_informative": 15,
            "n_classes": 2,
            "test_size": 0.2,
            "n_estimator": 100
          }
        }
      }
    }
  }
}
@Yee
y
from the python side we just send a json string, and flytekit converts it to a dataclass instance and sends it via grpc.
so for https://github.com/flyteorg/flytesnacks/blob/sd-examples/cookbook/core/dcjson.py for example, you’d call
Copy code
pyflyte run --remote core/dcjson.py printer_wf --dc_example '{"max_depth": 5, "learning_rate": 0.25, "objective": "hello world"}'
s
Yes so I’m using rest version of the api and triggering it from js with the inputs I showed above and just wondering why flyte ui shows different “inputs”
When I use generics.fields in rest api, it seems to wrap the dataclass inner variables with “field” property - not a big deal I guess since it doesn’t seem to affect functionality but just wondering if I’m sending the inputs wrong. that’s all
y
i would try json string if that doesn’t work.
my copy as curl from the chrome debugger is producing
Copy code
--data-raw $'\n\u000bflytesnacks\u0012\u000bdevelopment"Ä\u0001\nN\u0008\u0003\u0012\u000bflytesnacks\u001a\u000bdevelopment"\u0016core.dcjson.printer_wf*\u0018eZyobAxEL4vMbBg3amVaTw==\u0012[\nY\n\ndc_example\u0012K\nI:G\n\u0011\n\u0009objective\u0012\u0004\u001a\u0002hi\n\u001a\n\rlearning_rate\u0012\u0009\u0011o\u0012\u0083ÀÊ\u0021\u0009@\n\u0016\n\u0009max_depth\u0012\u0009\u0011\u0000\u0000\u0000\u0000\u0000\u0000E@\u001a\u000e\u0012\u000cflyteconsole:\u0000B\u0000\u0090\u0001\u0000'
which doesn’t help
s
OK let me try that - thanks!
152 Views