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

tf-serving support model on NFS #688

Merged
merged 6 commits into from May 2, 2018
Merged

Conversation

Jyonn
Copy link
Contributor

@Jyonn Jyonn commented Apr 19, 2018

As for now, tf-serving can only support model located on cloud. I changed tf-serving.libsonnet file, add 2 more params: modelStorageType and nfsPVC. For now, modelStorageType can only detect if it's nfs. If so, container will mount a persistentVolumeClaim(PVC) specified by nfcPVC. We can support more choices in the future.
A guideline for running nfs-based model is put on components/k8s-model-server folder.
As a new param is added, I changed user_guide.md, Serve a model using Tensorflow Serving section, and add ks param set ${MODEL_COMPONENT} modelLocate ${MODEL_STORAGE_TYPE}. Also give a quick guideline of Create a component for your model located on nfs following Create a component for your model located on cloud.


This change is Reviewable

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@Jyonn
Copy link
Contributor Author

Jyonn commented Apr 19, 2018

/assign @jlewi

@jlewi
Copy link
Contributor

jlewi commented Apr 20, 2018

/unassign jlewi
/assign @lluunn

@k8s-ci-robot k8s-ci-robot assigned lluunn and unassigned jlewi Apr 20, 2018
$ NFS_PVC_NAME=nfs
$ ks generate tf-serving ${MODEL_COMPONENT} --name=${MODEL_NAME}
$ ks param set ${MODEL_COMPONENT} modelPath ${MODEL_PATH}
$ ks param set ${MODEL_COMPONENT} modelLocate ${MODEL_LOCATE}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modelLocate may make more sense as modelStorageType

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've changed modelLocate to modelStorageType

@lluunn
Copy link
Contributor

lluunn commented Apr 23, 2018

CLA not working now.
/ok-to-test

user_guide.md Outdated

```
MODEL_COMPONENT=serveInception
MODEL_NAME=inception
MODEL_PATH=gs://kubeflow-models/inception
MODEL_STORAGE_TYPE=cloud
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not required right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, now i delete this line and detect if 'modelStorageType' is an attribute of $.params, so that when model is in gs, the user don't need to specify MODEL_STORAGE_TYPE=cloud

@Jyonn
Copy link
Contributor Author

Jyonn commented Apr 24, 2018

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@@ -147,6 +147,13 @@
runAsUser: 1000,
fsGroup: 1000,
},
volumeMounts+: if 'modelStorageType' om $.params then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the om here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! thanks for telling!

@@ -147,6 +147,13 @@
runAsUser: 1000,
fsGroup: 1000,
},
volumeMounts+: if 'modelStorageType' in $.params then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need this "if 'modelStorageType' in $.params then"? It seems redundant?
I think you can add modelStorageType into param and default to cloud or empty string.

@@ -217,6 +224,16 @@
if $.util.toBool($.params.deployHttpProxy) then
$.parts.httpProxyContainer,
],
volumes+: if 'modelStorageType' in $.params then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable. Yesterday I tried to make modelStorageType as a param for ks generate tf-serving but failed (so far). So I add storageType into params. When I use modelStorageType as a param, it shows some error (maybe meets some conflicts).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking just use a param, modelStorageType = cloud by default.
What's the error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If using modelStorageType like this:

  params:: {
  ...
  ...(other params)
  modelName: $.params.name,
  modelPath: null,
  modelStorageType: if "modelStorageType" in $.params then
      $.params.modelStorageType
    else
      "cloud",

It will shows an error:

ERROR generate objects for namespace : unable to read /home/ciscoai/my-kubeflow/environments/default/main.jsonnet: RUNTIME ERROR: Max stack frames exceeded.
-------------------------------------------------
	/home/ciscoai/my-kubeflow/components/serveInception.jsonnet:(15:12)-(17:4)	object <anonymous>

  params+: updatedParams {
    name: name,
  },

-------------------------------------------------
	<builtin>	builtin function <operator+>

-------------------------------------------------
	<std>:966:25-26	thunk from <function <anonymous>>

        std.objectHasEx(o, f, true),

-------------------------------------------------
	<builtin>	builtin function <objectHasEx>

-------------------------------------------------
		

-------------------------------------------------
	/home/ciscoai/my-kubeflow/vendor/kubeflow/tf-serving/tf-serving.libsonnet:14:7-32	object <anonymous>

      $.params.modelStorageType

-------------------------------------------------
	/home/ciscoai/my-kubeflow/vendor/kubeflow/tf-serving/tf-serving.libsonnet:14:7-32	object <anonymous>

      $.params.modelStorageType

-------------------------------------------------
	/home/ciscoai/my-kubeflow/vendor/kubeflow/tf-serving/tf-serving.libsonnet:14:7-32	object <anonymous>

      $.params.modelStorageType

-------------------------------------------------
	/home/ciscoai/my-kubeflow/vendor/kubeflow/tf-serving/tf-serving.libsonnet:14:7-32	object <anonymous>

      $.params.modelStorageType

-------------------------------------------------
	/home/ciscoai/my-kubeflow/vendor/kubeflow/tf-serving/tf-serving.libsonnet:14:7-32	object <anonymous>

      $.params.modelStorageType

-------------------------------------------------
	... (skipped 481 frames)
-------------------------------------------------
	<std>:971:33-35	thunk from <function <anonymous>>

        if !std.primitiveEquals(ta, tb) then

-------------------------------------------------
	<builtin>	builtin function <primitiveEquals>

-------------------------------------------------
	<std>:971:12-40	function <anonymous>

        if !std.primitiveEquals(ta, tb) then

-------------------------------------------------
		

-------------------------------------------------
	<std>:1025:45-71	function <anonymous>

            for x in std.objectFields(a) if isContent(std.prune(a[x]))

-------------------------------------------------
	<builtin>	builtin function <flatMap>

-------------------------------------------------
	<builtin>	builtin function <$objectFlatMerge>

-------------------------------------------------
	/home/ciscoai/my-kubeflow/components/serveInception.jsonnet:20:1-52	$

std.prune(k.core.v1.list.new(tfServing.components))

-------------------------------------------------
	<extvar:__ksonnet/components>:2:19-86	object <anonymous>

  serveInception: import "/home/ciscoai/my-kubeflow/components/serveInception.jsonnet",

-------------------------------------------------
	During manifestation

When I replace modelStorageType to storageType(or other identifier):

    storageType: if "modelStorageType" in $.params then
      $.params.modelStorageType
    else
      "cloud",

It runs well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, just doing

params:: {
modelStorageType: "cloud",
}

It will get overridden if you pass the param modelStorageType

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok! thanks for telling!

@lluunn
Copy link
Contributor

lluunn commented Apr 27, 2018

Thanks
/lgtm

@pdmack
Copy link
Member

pdmack commented May 2, 2018

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pdmack

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 3920d14 into kubeflow:master May 2, 2018
saffaalvi pushed a commit to StatCan/kubeflow that referenced this pull request Feb 11, 2021
* tf-serving support model on NFS

* modelLocate -> modelStorageType

* make default modelStorageType 'cloud'

* mistake om -> in

* remove redundant if clause

* make 'cloud' as default value of modelStorageType
yanniszark pushed a commit to arrikto/kubeflow that referenced this pull request Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants