Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Python SDK and CLI End-Jun release plan #2808

Closed
12 tasks done
mydmdm opened this issue May 22, 2019 · 1 comment
Closed
12 tasks done

Python SDK and CLI End-Jun release plan #2808

mydmdm opened this issue May 22, 2019 · 1 comment
Assignees
Labels

Comments

@mydmdm
Copy link
Contributor

mydmdm commented May 22, 2019

Add the PR of #3018

For the preview release, we will provide a basic functions of the command line tools and python SDK for below scenarios

1. Command line

  • User can specify which cluster to interact with
opai cluster add -a <cluster-alias> --pai-uri http://x.x.x.x --user myuser  && opai cluster select <cluster-alias> 
opai cluster list
opai cluster select <cluster-alias>
opai delete
  • User can submit and query jobs
opai job list -a <cluster-alias> <job-name> [config/ssh/stdout/stderr]
opai job submit -a <cluster-alias> <job-config-file> (json or yaml)
  • ? how to get stdout / stderr by rest api or a link?
  • when submit, user could change key-value from config file
opai job submit --update defaults:virtualCluster=test <job-config-file> 
  • User can submit a simple job with shortcut
opai job sub -i <docker-image> -j <job-name> [--gpu 1] python a/b/c.py arg1 arg2 …
  • User can access storage (only support hdfs for this release)
opai storage upload local_path remote_path
opai storage download remote_path local_path
opai storage list/status/delete remote_path
  • User can leverage the jupyter notebook by command line
opai job notebook -i <docker-image> -w <workspace> -a <cluster-alias> <notebook>

this command will

  • upload the <notebook> to the storage in <cluster> and submit a job
  • execute it in the job container by jupyter nbconvert --execute and upload result (html) back
  • wait job completed, and download html file

User may also add --interactive model to start and interact the server remotely

  • parse ip address and states information from logging streams
  • open browser automatically

2. python binding (SDK)

2.1 cluster management

  • User can describe a cluster with openpaisdk.core.ClusterList class to describe multiple clusters
clusters = ClusterList().load() # defaultly loaded from "~/.openpai/clusters.json"

User add, delete methods to update clusters, select and get_client methods to select one from multiple clusters

  • the Cluster class has methods to query and submit jobs
client = clusters.get_client(alias)
client.jobs(name)
client.rest_api_submit(job_config)
  • the Cluster class has methods to access storage (through WebHDFS only for this version)
Cluster(...).storage.upload/download(...)

2.2 Job management

  • User can describe a job with openpaisdk.core.Job class, which is compatible with the v2 protocol
job = Job(name)
job.submit(cluster_alias) # submit current job to a cluster
  • provide some quick template of simple jobs
job.one_liner(...) # generate job config from a command
job.from_notebook(...) # turn notebook to job, automatically get current notebook name
@scarlett2018 scarlett2018 added this to the End June Release milestone May 28, 2019
@mydmdm mydmdm changed the title Python SDK and CLI first release plan Python SDK and CLI End-Jun release plan May 29, 2019
@debuggy debuggy mentioned this issue Jun 6, 2019
13 tasks
@mydmdm
Copy link
Contributor Author

mydmdm commented Jun 27, 2019

#3018

@Binyang2014 Binyang2014 removed their assignment Jul 3, 2019
@debuggy debuggy closed this as completed Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants