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

[FEA]: TAO API Client Wrapper #651

Open
2 tasks done
bsuryadevara opened this issue Jan 30, 2023 · 0 comments · May be fixed by #613
Open
2 tasks done

[FEA]: TAO API Client Wrapper #651

bsuryadevara opened this issue Jan 30, 2023 · 0 comments · May be fixed by #613
Assignees
Labels
feature request New feature or request

Comments

@bsuryadevara
Copy link
Contributor

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Medium

Please provide a clear description of problem this feature solves

Create a TAO REST API client wrapper to communicate with TAO API toolkit server below list of endpoints.

  • List datasets for user
  • Create a new dataset
  • Delete a dataset
  • Retrieve a dataset
  • Update dataset metadata
  • Retrieve default action specs
  • Retrieve dataset action specs
  • Update dataset action specs
  • Run dataset actions
  • Cancel dataset actions
  • List models for user
  • Create a new model
  • Delete a model
  • Retrieve a model
  • Update model metadata
  • Retrieve default action specs
  • Retrieve model action specs
  • Update current model specs
  • Run model actions
  • Early stop / Cancel model actions
  • Pause training
  • Resume training

Describe your ideal solution

Here is an example function to wrap the endpoint.

@validate_kind
def list_resources(self, kind: _KIND, **kwargs) -> typing.Dict:
    """
    List available resources by kind.

    Parameters
    ----------
    kind : _KIND
        Endpoint type that is specific to a model or a dataset.
    **kwargs :
        Additional arguments.
    Returns
    -------
    json_resp : typing.Dict
        JSON response.
    """

    endpoint = f"{self.user_uri}/{kind}"
    logger.debug("Constructed endpoint with provided input: {}".format(endpoint))

    resp = self.session.get(endpoint, **kwargs)
    if not resp.status_code == 200:
        raise Exception("Unable to list the resources: {}".format(resp.content))

    json_resp = resp.json()
    logger.debug("Response: {}".format(json_resp))

    return json_resp

Describe any alternatives you have considered

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I have searched the open feature requests and have found no duplicates for this feature request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
Status: Blocked
Development

Successfully merging a pull request may close this issue.

3 participants