caicloud / ciao

Kernel for Kubeflow in Jupyter Notebook
Apache License 2.0
67 stars 18 forks source link

support resource-limit #67

Closed yeya24 closed 5 years ago

yeya24 commented 5 years ago

What this PR does / why we need it:

Add support for resource-limit. Currently only support cpu and memory.

There are two ways to set resource of one jobs.

For the first way, we can set config file like this.

kubeconfig: {path to your kubeconfig}
namespace: test
s2i:
  provider: s2i
worker:
  cpu: {default-worker-cpu}
  memory: {default-worker-memory}
ps:
  cpu: {default-ps-cpu}
  memory: {default-ps-memory}
master:
  cpu: {default-master-cpu}
  memory: {default-master-memory}      

For the second way, add two magic commands %cpu, %memory. Here is an example. By this config we can start a ps of 0.5 core and 0.5G, and a worker of 1c and 1G.

%framework=tensorflow
%ps=1;%cpu=500m;%memory=500Mi
%worker=1;%cpu=1000m;%memory=1Gi

I dont know if it is a right way for this, I' d appreciate if you give me some advice. :smile:

Which issue(s) this PR is related to (optional, link to 3rd issue(s)):

Fixes #51

Special notes for your reviewer:

/cc @gaocegege

Release note:

Add support for resource-limit
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 52


Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/backend/kubeflow/pytorchjob.go 0 5 0.0%
pkg/backend/kubeflow/tfjob.go 0 5 0.0%
pkg/backend/kubeflow/generator/cm.go 24 32 75.0%
pkg/backend/kubeflow/generator/native.go 24 32 75.0%
pkg/resource/resource.go 33 45 73.33%
<!-- Total: 118 156 75.64% -->
Totals Coverage Status
Change from base Build 48: 3.9%
Covered Lines: 450
Relevant Lines: 816

💛 - Coveralls
yeya24 commented 5 years ago

@gaocegege PTAL.

caicloud-bot commented 5 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gaocegege

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/caicloud/ciao/blob/master/OWNERS)~~ [gaocegege] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment