Services are used to launch Tensorboards, Notebooks, JupyterHub apps, Streamlit/Voila/Bokeh apps, internal tools, and dashboards based on your models and data analysis.
Since Polyaxon 2.19.0, a short Polyaxonfile with a root service section and other shortcuts defines a service. The full form declares the component and its kind: service runtime, and also works on older versions:
name: notebook
service:
ports: [8888]
container:
image: jupyter/tensorflow-notebook
command: ["jupyter", "lab"]
args: [
"--no-browser",
"--ip=0.0.0.0",
"--port={{globals.ports[0]}}",
"--allow-root",
"--NotebookApp.allow_origin=*",
"--NotebookApp.trust_xheaders=True",
"--NotebookApp.token=",
"--NotebookApp.base_url={{globals.base_url}}",
"--LabApp.base_url={{globals.base_url}}"
]kind: component
version: 1.1
name: notebook
run:
kind: service
ports: [8888]
container:
image: jupyter/tensorflow-notebook
command: ["jupyter", "lab"]
args: [
"--no-browser",
"--ip=0.0.0.0",
"--port={{globals.ports[0]}}",
"--allow-root",
"--NotebookApp.allow_origin=*",
"--NotebookApp.trust_xheaders=True",
"--NotebookApp.token=",
"--NotebookApp.base_url={{globals.base_url}}",
"--LabApp.base_url={{globals.base_url}}"
]The same example in Python:
from polyaxon.schemas import V1Component, V1Service
from polyaxon import k8s
service = V1Service(
ports=[8888],
container=k8s.V1Container(
image="jupyter/tensorflow-notebook",
command=["jupyter", "lab"],
args=[
"--no-browser",
"--ip=0.0.0.0",
"--port={{globals.ports[0]}}",
"--allow-root",
"--NotebookApp.allow_origin=*",
"--NotebookApp.trust_xheaders=True",
"--NotebookApp.token=",
"--NotebookApp.base_url={{globals.base_url}}",
"--LabApp.base_url={{globals.base_url}}"
]
),
)
component = V1Component(name="notebook", run=service)Specification
Please check the service specification guide to learn about all details for running services in Polyaxon.
For live development workflows, see interactive access for shell persistence, sandbox execution, and SSH access.