Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Plugin]New plugin to invoke a simple REST WebAPI sync #1762

Open
2 tasks done
kumare3 opened this issue Oct 29, 2021 · 6 comments
Open
2 tasks done

[Plugin]New plugin to invoke a simple REST WebAPI sync #1762

kumare3 opened this issue Oct 29, 2021 · 6 comments
Labels
enhancement New feature or request plugins Plugins related labels (backend or frontend)

Comments

@kumare3
Copy link
Contributor

kumare3 commented Oct 29, 2021

Motivation: Why do you think this is important?

FlytePlugins provides a simple way to invoke a WebAPI synchronously. Adding a simple plugin that can invoke a REST WebAPI (without auth) may open up a lot of new use-cases. Also the API should have a corresponding Python API of the form

@dataclass
class Outputs():
   ...


t1 = SyncRestAPI(
            url="https://mydomain/xyz?params={{.inputs.x}}&params={{.inputs.y}}",
            inputs=kwargs(x=int,y=int),
            outputs=Outputs,
            timeout=30s,
            retries=3,
           caching....,
)

@workflow
def foo():
    t1(x=...)

the backend plugin can be a simple HTTP Rest call invoker, that passes a json input and receives a json input. this plugin can implement the following API
https://github.com/flyteorg/flyteplugins/blob/master/go/tasks/pluginmachinery/webapi/plugin.go#L148-L154
It is important to handle timeouts, retries, http error codes etc.

Outputs can be either a complex JSON or maybe a single item or map etc

Goal: What should the final outcome look like, ideally?

Explained above

Describe alternatives you've considered

using python to invoke and write an API called. This is very expensive owing to the fact of starting a pod.

Propose: Link/Inline OR Additional context

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@kumare3 kumare3 added enhancement New feature or request plugins Plugins related labels (backend or frontend) labels Oct 29, 2021
@kumare3 kumare3 added this to the 0.19.0 - Eagle milestone Oct 29, 2021
@kumare3
Copy link
Contributor Author

kumare3 commented Nov 25, 2021

Further improving on the API calling spec

property type description
uri String URI for the service. (we could eventually support service discovery)
method String HTTP method. One of the GET, PUT, POST, DELETE, OPTIONS, HEAD
accept String Accept header as required by server. Defaults to application/json
contentType String Content Type - supported types are text/plain, text/html, and application/json (Default)
headers Map[String, Any] A map of additional http headers to be sent along with the request.
connectionTimeOut Integer Connection Time Out in milliseconds. If set to 0, equivalent to infinity. Default: 100.
readTimeOut Integer Read Time Out in milliseconds. If set to 0, equivalent to infinity. Default: 150.

Also add
oauth2.0 related client secrets? maybe just the client id? and use the secrets structure to fetch the secrets

We can also support body as a possible input arg, if the method type is post. This body should be a dataclass / struct only? so a forced parmeter called body.

@kumare3
Copy link
Contributor Author

kumare3 commented Nov 25, 2021

Eventually we should also support async calls and like a lua script that allows parsing response for completion?

@kumare3 kumare3 modified the milestones: 0.19.3 - Feb 2021, 1.0.1 Mar 17, 2022
@wild-endeavor wild-endeavor removed this from the 1.0.1 milestone Jul 22, 2022
@github-actions
Copy link

Hello 👋, This issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will close the issue if we detect no activity in the next 7 days. Thank you for your contribution and understanding! 🙏

@github-actions github-actions bot added the stale label Aug 27, 2023
@hamersaw
Copy link
Contributor

Commenting to keep open.

@github-actions github-actions bot removed the stale label Aug 31, 2023
Copy link

Hello 👋, this issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will engage on it to decide if it is still applicable.
Thank you for your contribution and understanding! 🙏

@github-actions github-actions bot added the stale label May 28, 2024
@kumare3
Copy link
Contributor Author

kumare3 commented May 30, 2024

This should be a simple agent that we should build and make it available as default

@github-actions github-actions bot removed the stale label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugins Plugins related labels (backend or frontend)
Projects
None yet
Development

No branches or pull requests

4 participants