I'm struggling to use the gRTC or HTTP endpoints t...
# ask-the-community
h
I'm struggling to use the gRTC or HTTP endpoints to CreateExecution when one of the inputs is a more complex struct. However, I can get it to work with regular literals, such as strings & booleans. Is there any available documentation about how to format these requests for structs or objects?
Here's a small example:
Copy code
from flytekit import workflow, task
from dataclasses import dataclass
from dataclasses_json import dataclass_json

@dataclass_json
@dataclass
class ExampleInput:
    name: str
    age: int
    is_cool: bool


@task
def is_cool_task(input: ExampleInput) -> bool:
    return input.is_cool

@workflow
def my_workflow(input: ExampleInput) -> bool:
    return is_cool_task(input=input)
From this documentation it seems that Struct is a Scalar type field, so here's one of the many incantations I've tried:
Copy code
{
  "domain": "development",
  "inputs": {
    "scalar": [
      {
        "input": [
          {
            "name": "test"
          },
          {
            "age": 5
          },
          {
            "is_cool": true
          }
        ]
      }
    ]
  },
  "name": "flyte.my_project.raw.my_workflow",
  "project": "my-project"
}
r
@Heidi Hurst In my case, when trying to trigger task my send msg to endpoint, The docs is still not update yet and the response of request is too hard to trace the format of msg. But you can try to use Flyte remote. Here is example code I use for it.
Copy code
# from flytekit.core.context_manager import FileAccessProvider
from flytekit.configuration import Config, DataConfig, S3Config
from flytekit.remote import FlyteRemote
import json

MyConfig = Config.for_endpoint(
        endpoint="0.0.0.0:30080",
        insecure=True,
        data_config=DataConfig(
                    s3=S3Config(endpoint="<http://localhost:30002>", access_key_id="minio", secret_access_key="miniostorage")
        )
    )

remote = FlyteRemote(
    # Fetch workflow
        config=MyConfig,
        default_project="flytesnacks",
        default_domain="development",
    )

remote.execute("flytesnacks", "development", "hello_world", inputs={"name": "world"})
h
Thanks for the suggestion @Ryuu! I've been able to trigger things using flyte remote from python, but I'd like to use a separate (non-python) service, which is where I'm hitting hiccups.
r
yah, i understand that, now the docs about it is only http://localhost:30080/api/v1/openapi. If you can trace the format of the msg which send to endpoint, feel free to say to me too 🤗.