diff --git a/gradient/api_sdk/clients/notebook_client.py b/gradient/api_sdk/clients/notebook_client.py index 5365c9e2..b5adbd59 100644 --- a/gradient/api_sdk/clients/notebook_client.py +++ b/gradient/api_sdk/clients/notebook_client.py @@ -15,7 +15,7 @@ def create( name=None, registry_username=None, registry_password=None, - default_entrypoint=None, + command=None, container_user=None, shutdown_timeout=None, is_preemptible=None, @@ -32,7 +32,7 @@ def create( :param str name: :param str registry_username: :param str registry_password: - :param str default_entrypoint: + :param str command: :param str container_user: :param int shutdown_timeout: :param bool is_preemptible: @@ -50,7 +50,7 @@ def create( name=name, registry_username=registry_username, registry_password=registry_password, - default_entrypoint=default_entrypoint, + command=command, container_user=container_user, shutdown_timeout=shutdown_timeout, is_preemptible=is_preemptible, diff --git a/gradient/api_sdk/models/notebook.py b/gradient/api_sdk/models/notebook.py index a5522d81..17f23cb8 100644 --- a/gradient/api_sdk/models/notebook.py +++ b/gradient/api_sdk/models/notebook.py @@ -17,6 +17,7 @@ class Notebook(object): cluster_id = attr.ib(type=str, default=None) registry_username = attr.ib(type=str, default=None) registry_password = attr.ib(type=str, default=None) + command = attr.ib(type=str, default=None) default_entrypoint = attr.ib(type=str, default=None) container_user = attr.ib(type=str, default=None) shutdown_timeout = attr.ib(type=int, default=None) diff --git a/gradient/api_sdk/serializers/notebook.py b/gradient/api_sdk/serializers/notebook.py index 285f4820..428c0ff7 100644 --- a/gradient/api_sdk/serializers/notebook.py +++ b/gradient/api_sdk/serializers/notebook.py @@ -17,6 +17,7 @@ class NotebookSchema(BaseSchema): cluster_id = marshmallow.fields.Str(load_from="clusterId", dump_to="clusterId") registry_username = marshmallow.fields.Str(load_from="registryUsername", dump_to="registryUsername") registry_password = marshmallow.fields.Str(load_from="registryPassword", dump_to="registryPassword") + command = marshmallow.fields.Str(load_from="command", dump_to="command") default_entrypoint = marshmallow.fields.Str(load_from="defaultEntrypoint", dump_to="defaultEntrypoint") container_user = marshmallow.fields.Str(load_from="containerUser", dump_to="containerUser") shutdown_timeout = marshmallow.fields.Int(load_from="shutdownTimeout", dump_to="shutdownTimeout") @@ -52,7 +53,7 @@ class NotebookSchema(BaseSchema): def preprocess(self, data, **kwargs): data = copy.copy(data) - utils.base64_encode_attribute(data, "default_entrypoint") + utils.base64_encode_attribute(data, "command") return data diff --git a/gradient/cli/notebooks.py b/gradient/cli/notebooks.py index dc8448c2..56d436d4 100644 --- a/gradient/cli/notebooks.py +++ b/gradient/cli/notebooks.py @@ -77,7 +77,7 @@ def notebook_metrics(): ) @click.option( "--command", - "default_entrypoint", + "command", type=str, help="Command (executed as `/bin/sh -c 'YOUR COMMAND'`)", cls=common.GradientOption, diff --git a/tests/config_files/notebooks_create.yaml b/tests/config_files/notebooks_create.yaml index 43a12dd3..49c9f781 100644 --- a/tests/config_files/notebooks_create.yaml +++ b/tests/config_files/notebooks_create.yaml @@ -1,9 +1,8 @@ apiKey: some_key clusterId: 321 container: "jupyter/notebook" -command: "some_entrypoint" +command: some_entrypoint containerUser: some_container_user -defaultEntrypoint: some_entrypoint isPreemptible: true name: some_notebook_name registryPassword: some_password diff --git a/tests/functional/test_notebooks.py b/tests/functional/test_notebooks.py index 3607edf4..db44fc11 100644 --- a/tests/functional/test_notebooks.py +++ b/tests/functional/test_notebooks.py @@ -103,7 +103,7 @@ class TestNotebooksCreate(object): "name": "some_notebook_name", "registryUsername": "some_username", "registryPassword": "some_password", - "defaultEntrypoint": "c29tZV9lbnRyeXBvaW50", + "command": "c29tZV9lbnRyeXBvaW50", "containerUser": "some_container_user", "shutdownTimeout": 8, "isPreemptible": True,