diff --git a/.gitignore b/.gitignore index 3e41b2b726a..96bb0a05a78 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,4 @@ $RECYCLE.BIN/ ## Vendor dir vendor +venv \ No newline at end of file diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000000..9cc29402d9e --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,17 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +sphinx: + configuration: docs/sdkdocs/source/conf.py + +python: + install: + - requirements: docs/sdkdocs/requirements.txt + +formats: + - pdf + - epub \ No newline at end of file diff --git a/docs/sdkdocs/Makefile b/docs/sdkdocs/Makefile new file mode 100644 index 00000000000..d0c3cbf1020 --- /dev/null +++ b/docs/sdkdocs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/sdkdocs/make.bat b/docs/sdkdocs/make.bat new file mode 100644 index 00000000000..747ffb7b303 --- /dev/null +++ b/docs/sdkdocs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/sdkdocs/requirements.txt b/docs/sdkdocs/requirements.txt new file mode 100644 index 00000000000..b157d312d22 --- /dev/null +++ b/docs/sdkdocs/requirements.txt @@ -0,0 +1,18 @@ +autodocsumm==0.2.13 +grpcio +grpcio-tools +kubeflow-katib +kubernetes==30.1.0 +m2r2==0.3.3.post2 +Sphinx==7.4.7 +sphinx-click==6.0.0 +sphinx-rtd-theme==2.0.0 +sphinx-toggleprompt==0.5.2 +sphinx_immaterial==0.12.2 +sphinxcontrib-applehelp==2.0.0 +sphinxcontrib-devhelp==2.0.0 +sphinxcontrib-htmlhelp==2.1.0 +sphinxcontrib-jquery==4.1 +sphinxcontrib-jsmath==1.0.1 +sphinxcontrib-qthelp==2.0.0 +sphinxcontrib-serializinghtml==2.0.0 \ No newline at end of file diff --git a/docs/sdkdocs/source/_static/custom.css b/docs/sdkdocs/source/_static/custom.css new file mode 100644 index 00000000000..2333e002ad4 --- /dev/null +++ b/docs/sdkdocs/source/_static/custom.css @@ -0,0 +1 @@ +[data-md-color-primary=katibblue]{--md-primary-fg-color:#4279f4;--md-primary-fg-color--light:##4279f4;--md-primary-fg-color--dark:##4279f4;--md-primary-bg-color:#fff;--md-primary-bg-color--light:hsla(0,0%,100%,.7)} diff --git a/docs/sdkdocs/source/_static/favicon.ico b/docs/sdkdocs/source/_static/favicon.ico new file mode 100644 index 00000000000..2ddef9f22c0 Binary files /dev/null and b/docs/sdkdocs/source/_static/favicon.ico differ diff --git a/docs/sdkdocs/source/_static/kubeflow.png b/docs/sdkdocs/source/_static/kubeflow.png new file mode 100644 index 00000000000..bdf9fc8d356 Binary files /dev/null and b/docs/sdkdocs/source/_static/kubeflow.png differ diff --git a/docs/sdkdocs/source/conf.py b/docs/sdkdocs/source/conf.py new file mode 100644 index 00000000000..4b28f1cb6d0 --- /dev/null +++ b/docs/sdkdocs/source/conf.py @@ -0,0 +1,157 @@ +# Configuration file for the Sphinx documentation builder. + +import os +import sys +sys.path.insert(0, os.path.abspath('../../../sdk/python/v1beta1/kubeflow/katib')) + +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'Katib SDK APIs Reference' +copyright = '2024, Kubflow Author' +author = 'Kubflow Author' + +# The short X.Y version +version = '' +# The full version, including alpha/beta/rc tags +release = '' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +# Extensions +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.viewcode', + 'sphinx.ext.napoleon', + 'sphinx_click', + 'm2r2', + 'sphinx_immaterial', + 'autodocsumm', + 'sphinx_toggleprompt', +] + +# Autodoc settings +autodoc_member_order = 'bysource' +autodoc_default_options = { + 'members': True, + 'imported-members': True, + 'undoc-members': True, + 'show-inheritance': False, + 'autosummary': True, +} + + +# Paths +templates_path = ['_templates'] +html_static_path = ['_static'] +html_logo = '_static/kubeflow.png' +html_favicon = '_static/favicon.ico' + +# The master toctree document. +master_doc = 'index' + +# You can specify multiple suffix as a list of string: +source_suffix = ['.rst', '.md'] + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +htmlhelp_basename = 'Kubeflowkatibsdoc' + +# Theme settings +html_theme = 'sphinx_immaterial' +html_theme_options = { + # Repository information + 'repo_url': 'https://github.com/kubeflow/katib', + 'repo_name': 'katib', + 'edit_uri': 'blob/master/docs', + + # Navigation and layout features + 'features': [ + 'navigation.expand', + 'navigation.sections', + 'navigation.top', + 'search.highlight', + 'search.share', + 'toc.follow', + 'toc.sticky', + ], + + # Color schemes + 'palette': [ + { + 'media': '(prefers-color-scheme: light)', + 'scheme': 'default', + 'primary': 'katibblue', + 'accent': 'light-blue', + 'toggle': { + 'icon': 'material/weather-night', + 'name': 'Switch to dark mode', + } + }, + { + 'media': '(prefers-color-scheme: dark)', + 'scheme': 'slate', + 'primary': 'katibblue', + 'accent': 'light-blue', + 'toggle': { + 'icon': 'material/weather-sunny', + 'name': 'Switch to light mode', + } + } + ], + + # Font settings + 'font': { + 'text': 'Open Sans', + 'code': 'Roboto Mono', + }, + + # Icon settings + 'icon': { + 'repo': 'fontawesome/brands/github', + }, + + # Version dropdown + 'version_dropdown': True, + 'version_info': [ + {'version': 'latest', 'title': 'latest', 'aliases': []}, + # Add more versions as needed + ], +} + +# Version dropdown JSON file +html_context = { + "version_json": "https://raw.githubusercontent.com/kubeflow/katib/master/docs/versions.json", +} +# Exclude patterns +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_init_with_doc = False +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True +napoleon_preprocess_types = False +napoleon_type_aliases = None +napoleon_attr_annotations = True + +# -- Options for autodoc ------------------------------------------------- +autodoc_default_options = { + 'members': True, + 'member-order': 'bysource', + 'special-members': '__init__', + 'undoc-members': True, + 'exclude-members': '__weakref__' +} \ No newline at end of file diff --git a/docs/sdkdocs/source/index.rst b/docs/sdkdocs/source/index.rst new file mode 100644 index 00000000000..7c0ff8266d1 --- /dev/null +++ b/docs/sdkdocs/source/index.rst @@ -0,0 +1,20 @@ +.. Kubeflow Katib SDK APIs Reference documentation master file, created by + sphinx-quickstart on Sat Aug 10 02:27:22 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Kubeflow Katib SDK APIs Documentation! +============================================================= + +.. mdinclude:: ../../../sdk/python/v1beta1/README.md + +.. toctree:: + :hidden: + + Home + src/katib + src/models/model + Usage Docs (kubeflow.org) + Source Code + + diff --git a/docs/sdkdocs/source/src/katib.rst b/docs/sdkdocs/source/src/katib.rst new file mode 100644 index 00000000000..d57bb7d500a --- /dev/null +++ b/docs/sdkdocs/source/src/katib.rst @@ -0,0 +1,11 @@ +Katib SDK APIs Reference +======================== + +.. autoclass:: api.katib_client.KatibClient + :members: + :undoc-members: + :show-inheritance: + :inherited-members: + + .. automethod:: __init__ + :no-index: diff --git a/docs/sdkdocs/source/src/models/model.rst b/docs/sdkdocs/source/src/models/model.rst new file mode 100644 index 00000000000..fdee022e618 --- /dev/null +++ b/docs/sdkdocs/source/src/models/model.rst @@ -0,0 +1,50 @@ +Model Reference index +---------------------- + +.. _rst-modules: + +.. toctree:: + :maxdepth: 1 + :caption: Rst Modules: + + v1beta1_algorithm_setting + v1beta1_algorithm_spec + v1beta1_collector_spec + v1beta1_config_map_source + v1beta1_early_stopping_rule + v1beta1_early_stopping_setting + v1beta1_early_stopping_spec + v1beta1_experiment_condition + v1beta1_experiment_list + v1beta1_experiment + v1beta1_experiment_spec + v1beta1_experiment_status + v1beta1_feasible_space + v1beta1_file_system_path + v1beta1_filter_spec + v1beta1_graph_config + v1beta1_metric + v1beta1_metric_strategy + v1beta1_metrics_collector_spec + v1beta1_nas_config + v1beta1_objective_spec + v1beta1_observation + v1beta1_operation + v1beta1_optimal_trial + v1beta1_parameter_assignment + v1beta1_parameter_spec + v1beta1_source_spec + v1beta1_suggestion_condition + v1beta1_suggestion_list + v1beta1_suggestion + v1beta1_suggestion_spec + v1beta1_suggestion_status + v1beta1_trial_assignment + v1beta1_trial_condition + v1beta1_trial_list + v1beta1_trial + v1beta1_trial_parameter_spec + v1beta1_trial_source + v1beta1_trial_spec + v1beta1_trial_status + v1beta1_trial_template diff --git a/docs/sdkdocs/source/src/models/v1beta1_algorithm_setting.rst b/docs/sdkdocs/source/src/models/v1beta1_algorithm_setting.rst new file mode 100644 index 00000000000..0f4552eef45 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_algorithm_setting.rst @@ -0,0 +1,8 @@ +V1beta1AlgorithmSetting +======================= + +.. automodule:: models.v1beta1_algorithm_setting + :members: + :undoc-members: + :show-inheritance: + :no-index: diff --git a/docs/sdkdocs/source/src/models/v1beta1_algorithm_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_algorithm_spec.rst new file mode 100644 index 00000000000..90db4f766bc --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_algorithm_spec.rst @@ -0,0 +1,8 @@ +V1beta1AlgorithmSpec +==================== + +.. automodule:: models.v1beta1_algorithm_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: diff --git a/docs/sdkdocs/source/src/models/v1beta1_collector_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_collector_spec.rst new file mode 100644 index 00000000000..e2b0dd0d4a7 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_collector_spec.rst @@ -0,0 +1,8 @@ +V1beta1CollectorSpec +==================== + +.. automodule:: models.v1beta1_collector_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: diff --git a/docs/sdkdocs/source/src/models/v1beta1_config_map_source.rst b/docs/sdkdocs/source/src/models/v1beta1_config_map_source.rst new file mode 100644 index 00000000000..fd9bbf8b297 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_config_map_source.rst @@ -0,0 +1,8 @@ +V1beta1ConfigMapSource +====================== + +.. automodule:: models.v1beta1_config_map_source + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_early_stopping_rule.rst b/docs/sdkdocs/source/src/models/v1beta1_early_stopping_rule.rst new file mode 100644 index 00000000000..c0fe2cd874a --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_early_stopping_rule.rst @@ -0,0 +1,8 @@ +V1beta1EarlyStoppingRule +======================== + +.. automodule:: models.v1beta1_early_stopping_rule + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_early_stopping_setting.rst b/docs/sdkdocs/source/src/models/v1beta1_early_stopping_setting.rst new file mode 100644 index 00000000000..929ec4540bc --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_early_stopping_setting.rst @@ -0,0 +1,8 @@ +V1beta1EarlyStoppingSetting +=========================== + +.. automodule:: models.v1beta1_early_stopping_setting + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_early_stopping_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_early_stopping_spec.rst new file mode 100644 index 00000000000..f3b6ac24081 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_early_stopping_spec.rst @@ -0,0 +1,8 @@ +V1beta1EarlyStoppingSpec +======================== + +.. automodule:: models.v1beta1_early_stopping_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_experiment.rst b/docs/sdkdocs/source/src/models/v1beta1_experiment.rst new file mode 100644 index 00000000000..a07bf3c77bb --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_experiment.rst @@ -0,0 +1,8 @@ +V1beta1Experiment +================= + +.. automodule:: models.v1beta1_experiment + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_experiment_condition.rst b/docs/sdkdocs/source/src/models/v1beta1_experiment_condition.rst new file mode 100644 index 00000000000..20862b9cf42 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_experiment_condition.rst @@ -0,0 +1,8 @@ +V1beta1ExperimentCondition +========================== + +.. automodule:: models.v1beta1_experiment_condition + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_experiment_list.rst b/docs/sdkdocs/source/src/models/v1beta1_experiment_list.rst new file mode 100644 index 00000000000..e0ad5fa01bd --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_experiment_list.rst @@ -0,0 +1,7 @@ +V1beta1ExperimentList +===================== + +.. automodule:: models.v1beta1_experiment_list + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_experiment_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_experiment_spec.rst new file mode 100644 index 00000000000..3ae22a0bacc --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_experiment_spec.rst @@ -0,0 +1,8 @@ +V1beta1ExperimentSpec +===================== + +.. automodule:: models.v1beta1_experiment_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_experiment_status.rst b/docs/sdkdocs/source/src/models/v1beta1_experiment_status.rst new file mode 100644 index 00000000000..260d68088ea --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_experiment_status.rst @@ -0,0 +1,8 @@ +V1beta1ExperimentStatus +======================= + +.. automodule:: models.v1beta1_experiment_status + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_feasible_space.rst b/docs/sdkdocs/source/src/models/v1beta1_feasible_space.rst new file mode 100644 index 00000000000..4e8e3cdf5f0 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_feasible_space.rst @@ -0,0 +1,8 @@ +V1beta1FeasibleSpace +==================== + +.. automodule:: models.v1beta1_feasible_space + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_file_system_path.rst b/docs/sdkdocs/source/src/models/v1beta1_file_system_path.rst new file mode 100644 index 00000000000..1775d4d3262 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_file_system_path.rst @@ -0,0 +1,8 @@ +V1beta1FileSystemPath +===================== + +.. automodule:: models.v1beta1_file_system_path + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_filter_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_filter_spec.rst new file mode 100644 index 00000000000..d85a73c37c8 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_filter_spec.rst @@ -0,0 +1,8 @@ +V1beta1FilterSpec +================= + +.. automodule:: models.v1beta1_filter_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_graph_config.rst b/docs/sdkdocs/source/src/models/v1beta1_graph_config.rst new file mode 100644 index 00000000000..ce7ac1a7dba --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_graph_config.rst @@ -0,0 +1,8 @@ +V1beta1GraphConfig +================== + +.. automodule:: models.v1beta1_graph_config + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_metric.rst b/docs/sdkdocs/source/src/models/v1beta1_metric.rst new file mode 100644 index 00000000000..301a641b968 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_metric.rst @@ -0,0 +1,8 @@ +V1beta1Metric +============= + +.. automodule:: models.v1beta1_metric + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_metric_strategy.rst b/docs/sdkdocs/source/src/models/v1beta1_metric_strategy.rst new file mode 100644 index 00000000000..e50c15dd54b --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_metric_strategy.rst @@ -0,0 +1,8 @@ +V1beta1MetricStrategy +===================== + +.. automodule:: models.v1beta1_metric_strategy + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_metrics_collector_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_metrics_collector_spec.rst new file mode 100644 index 00000000000..e5705ba98f3 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_metrics_collector_spec.rst @@ -0,0 +1,8 @@ +V1beta1MetricsCollectorSpec +=========================== + +.. automodule:: models.v1beta1_metrics_collector_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_nas_config.rst b/docs/sdkdocs/source/src/models/v1beta1_nas_config.rst new file mode 100644 index 00000000000..90b3b487c92 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_nas_config.rst @@ -0,0 +1,8 @@ +V1beta1NasConfig +================ + +.. automodule:: models.v1beta1_nas_config + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_objective_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_objective_spec.rst new file mode 100644 index 00000000000..2449e1beef7 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_objective_spec.rst @@ -0,0 +1,8 @@ +V1beta1ObjectiveSpec +==================== + +.. automodule:: models.v1beta1_objective_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_observation.rst b/docs/sdkdocs/source/src/models/v1beta1_observation.rst new file mode 100644 index 00000000000..20c3334c8d5 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_observation.rst @@ -0,0 +1,8 @@ +V1beta1Observation +================== + +.. automodule:: models.v1beta1_observation + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_operation.rst b/docs/sdkdocs/source/src/models/v1beta1_operation.rst new file mode 100644 index 00000000000..7006172c268 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_operation.rst @@ -0,0 +1,8 @@ +V1beta1Operation +================ + +.. automodule:: models.v1beta1_operation + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_optimal_trial.rst b/docs/sdkdocs/source/src/models/v1beta1_optimal_trial.rst new file mode 100644 index 00000000000..c1984a51b4a --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_optimal_trial.rst @@ -0,0 +1,8 @@ +V1beta1OptimalTrial +=================== + +.. automodule:: models.v1beta1_optimal_trial + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_parameter_assignment.rst b/docs/sdkdocs/source/src/models/v1beta1_parameter_assignment.rst new file mode 100644 index 00000000000..2bcd4fdc5c6 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_parameter_assignment.rst @@ -0,0 +1,8 @@ +V1beta1ParameterAssignment +========================== + +.. automodule:: models.v1beta1_parameter_assignment + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_parameter_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_parameter_spec.rst new file mode 100644 index 00000000000..ed3f00ddcd9 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_parameter_spec.rst @@ -0,0 +1,8 @@ +V1beta1ParameterSpec +==================== + +.. automodule:: models.v1beta1_parameter_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_source_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_source_spec.rst new file mode 100644 index 00000000000..d728a7b7078 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_source_spec.rst @@ -0,0 +1,8 @@ +V1beta1SourceSpec +================= + +.. automodule:: models.v1beta1_source_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_suggestion.rst b/docs/sdkdocs/source/src/models/v1beta1_suggestion.rst new file mode 100644 index 00000000000..97b60ba796c --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_suggestion.rst @@ -0,0 +1,8 @@ +V1beta1Suggestion +================= + +.. automodule:: models.v1beta1_suggestion + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_suggestion_condition.rst b/docs/sdkdocs/source/src/models/v1beta1_suggestion_condition.rst new file mode 100644 index 00000000000..ae34bfbc303 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_suggestion_condition.rst @@ -0,0 +1,8 @@ +V1beta1SuggestionCondition +========================== + +.. automodule:: models.v1beta1_suggestion_condition + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_suggestion_list.rst b/docs/sdkdocs/source/src/models/v1beta1_suggestion_list.rst new file mode 100644 index 00000000000..7001c6c71ce --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_suggestion_list.rst @@ -0,0 +1,8 @@ +V1beta1SuggestionList +===================== + +.. automodule:: models.v1beta1_suggestion_list + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_suggestion_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_suggestion_spec.rst new file mode 100644 index 00000000000..1df447782c4 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_suggestion_spec.rst @@ -0,0 +1,8 @@ +V1beta1SuggestionSpec +===================== + +.. automodule:: models.v1beta1_suggestion_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_suggestion_status.rst b/docs/sdkdocs/source/src/models/v1beta1_suggestion_status.rst new file mode 100644 index 00000000000..8b55e9d4876 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_suggestion_status.rst @@ -0,0 +1,8 @@ +V1beta1SuggestionStatus +======================= + +.. automodule:: models.v1beta1_suggestion_status + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_trial.rst b/docs/sdkdocs/source/src/models/v1beta1_trial.rst new file mode 100644 index 00000000000..00051324700 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_trial.rst @@ -0,0 +1,8 @@ +V1beta1Trial +============ + +.. automodule:: models.v1beta1_trial + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_trial_assignment.rst b/docs/sdkdocs/source/src/models/v1beta1_trial_assignment.rst new file mode 100644 index 00000000000..3fbee8625f5 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_trial_assignment.rst @@ -0,0 +1,8 @@ +V1beta1TrialAssignment +====================== + +.. automodule:: models.v1beta1_trial_assignment + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_trial_condition.rst b/docs/sdkdocs/source/src/models/v1beta1_trial_condition.rst new file mode 100644 index 00000000000..7f161dccb98 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_trial_condition.rst @@ -0,0 +1,8 @@ +V1beta1TrialCondition +===================== + +.. automodule:: models.v1beta1_trial_condition + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_trial_list.rst b/docs/sdkdocs/source/src/models/v1beta1_trial_list.rst new file mode 100644 index 00000000000..a5bc411dd89 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_trial_list.rst @@ -0,0 +1,8 @@ +V1beta1TrialList +================ + +.. automodule:: models.v1beta1_trial_list + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_trial_parameter_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_trial_parameter_spec.rst new file mode 100644 index 00000000000..95379572440 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_trial_parameter_spec.rst @@ -0,0 +1,8 @@ +V1beta1TrialParameterSpec +========================= + +.. automodule:: models.v1beta1_trial_parameter_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_trial_source.rst b/docs/sdkdocs/source/src/models/v1beta1_trial_source.rst new file mode 100644 index 00000000000..18710cf7296 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_trial_source.rst @@ -0,0 +1,8 @@ +V1beta1TrialSource +================== + +.. automodule:: models.v1beta1_trial_source + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_trial_spec.rst b/docs/sdkdocs/source/src/models/v1beta1_trial_spec.rst new file mode 100644 index 00000000000..456489abd96 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_trial_spec.rst @@ -0,0 +1,8 @@ +V1beta1TrialSpec +================ + +.. automodule:: models.v1beta1_trial_spec + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_trial_status.rst b/docs/sdkdocs/source/src/models/v1beta1_trial_status.rst new file mode 100644 index 00000000000..1f754ae19a4 --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_trial_status.rst @@ -0,0 +1,8 @@ +V1beta1TrialStatus +================== + +.. automodule:: models.v1beta1_trial_status + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/src/models/v1beta1_trial_template.rst b/docs/sdkdocs/source/src/models/v1beta1_trial_template.rst new file mode 100644 index 00000000000..a62933e020b --- /dev/null +++ b/docs/sdkdocs/source/src/models/v1beta1_trial_template.rst @@ -0,0 +1,8 @@ +V1beta1TrialTemplate +==================== + +.. automodule:: models.v1beta1_trial_template + :members: + :undoc-members: + :show-inheritance: + :no-index: \ No newline at end of file diff --git a/docs/sdkdocs/source/versions.json b/docs/sdkdocs/source/versions.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/hack/gen-python-sdk/post_gen.py b/hack/gen-python-sdk/post_gen.py index 70eab3a2595..f1e9dd7be24 100644 --- a/hack/gen-python-sdk/post_gen.py +++ b/hack/gen-python-sdk/post_gen.py @@ -15,6 +15,7 @@ import os import shutil import sys +import subprocess IGNORE_LINES = [ "from kubeflow.katib.models.v1_unstructured_unstructured import V1UnstructuredUnstructured", @@ -183,6 +184,29 @@ def update_python_sdk(src, dest, versions=("v1beta1")): # Clear working dictionary shutil.rmtree(src) +def upgate_python_sdk_docs(): + + # Set the path to the Sphinx project + sdkdocs_path = os.path.abspath(os.path.join( + os.path.dirname(__file__), '..', '..', 'docs', 'sdkdocs' + )) + + os.chdir(sdkdocs_path) + subprocess.run(['make', 'clean'], check=True) + print("Removing exist sdk documentation") + + #Executing make html + try: + subprocess.run(['make', 'html'], check=True) + print("Sphinx documentation built successfully.") + except subprocess.CalledProcessError as e: + print(f"Error building Sphinx documentation: {e}") + except FileNotFoundError: + print("Error: 'make' command not found. Please ensure you have Sphinx installed.") + if __name__ == "__main__": update_python_sdk(src=sys.argv[1], dest=sys.argv[2]) + + # SDK docs update + upgate_python_sdk_docs() diff --git a/sdk/python/v1beta1/README.md b/sdk/python/v1beta1/README.md index 5f2dbde2c87..e34ff4ac84f 100644 --- a/sdk/python/v1beta1/README.md +++ b/sdk/python/v1beta1/README.md @@ -1,125 +1,53 @@ -# Kubeflow Katib SDK +Katib is a Kubernetes-native project designed for automated machine learning. It focuses on hyperparameter tuning, neural architecture search (NAS), and early stopping of machine learning experiments. Katib supports various machine learning frameworks and languages, making it versatile for different applications. -Python SDK for Kubeflow Katib +## Requirements +**Python**: >= 3.8 -## Requirements. +The Katib Python SDK follows the [Python release cycle](https://devguide.python.org/versions/#python-release-cycle) for supported Python versions. -Python >= 3.8 +## Installation +You can install the Katib Python SDK using either pip or setuptools. -Katib Python SDK follows [Python release cycle](https://devguide.python.org/versions/#python-release-cycle) -for supported Python versions. - -## Installation & Usage - -### pip install +### Using pip +To install the SDK via pip, run: ```sh pip install kubeflow-katib ``` -Then import package: +After installation, you can import the package in your Python code: ```python from kubeflow import katib ``` -### Setuptools +### Using Setuptools +To install via Setuptools, clone the repository and run: Install via [Setuptools](http://pypi.python.org/pypi/setuptools). ```sh python setup.py install --user ``` +Alternatively, use sudo to install the package for all users: -(or `sudo python setup.py install` to install the package for all users) +```sh +sudo python setup.py install +``` ### Publish new SDK version to PyPi -Our SDK is located in [`kubeflow-katib` PyPi package](https://pypi.org/project/kubeflow-katib/). -Katib Python SDK is published as part of the Katib patch releases. -You can check the release process [here](../../../scripts/v1beta1/release.sh). -For each Katib patch release, we upload a new SDK version to the PyPi. -The SDK version is equal to the Katib version. +The Katib Python SDK is released as part of Katib's patch releases. For each patch release, a new version of the SDK is uploaded to PyPi. The SDK version corresponds directly to the Katib version. + +You can find the Katib Python SDK in the [`kubeflow-katib` package on PyPi](https://pypi.org/project/kubeflow-katib/). + +For detailed information on the release process, please refer to the [release script](https://github.com/shivas1516/katib/blob/master/scripts/v1beta1/release.sh) in the Katib repository. + ## Getting Started -Please follow the [examples](../../../examples/v1beta1/sdk) to learn more about Katib SDK. - -## Documentation for API Endpoints - -| Class | Method | Description | -| --------------------- | -------------------------------------- | ----------------------------------------------------------- | -| [KatibClient][client] | [create_experiment][create] | Create the Katib Experiment | -| [KatibClient][client] | [get_experiment][get_e] | Get the Katib Experiment | -| [KatibClient][client] | [get_suggestion][get_s] | Get the Katib Suggestion | -| [KatibClient][client] | [delete_experiment][delete] | Delete the Katib Experiment | -| [KatibClient][client] | [list_experiments][list_e] | List all Katib Experiments | -| [KatibClient][client] | [get_experiment_status][get_status] | Get the Experiment current status | -| [KatibClient][client] | [is_experiment_succeeded][is_suc] | Check if Experiment has succeeded | -| [KatibClient][client] | [list_trials][list_t] | List all Experiment's Trials | -| [KatibClient][client] | [get_success_trial_details][get_suc_t] | Get the Trial details that have succeeded for an Experiment | -| [KatibClient][client] | [get_optimal_hyperparameters][opt_hp] | Get the current optimal Trial from the Experiment | - -[client]: docs/KatibClient.md -[create]: docs/KatibClient.md#create_experiment -[get_e]: docs/KatibClient.md#get_experiment -[get_s]: docs/KatibClient.md#get_suggestion -[delete]: docs/KatibClient.md#delete_experiment -[list_e]: docs/KatibClient.md#list_experiments -[get_status]: docs/KatibClient.md#get_experiment_status -[is_suc]: docs/KatibClient.md#is_experiment_succeeded -[list_t]: docs/KatibClient.md#list_trials -[get_suc_t]: docs/KatibClient.md#get_success_trial_details -[opt_hp]: docs/KatibClient.md#get_optimal_hyperparameters - -## Documentation For Models - -- [V1beta1AlgorithmSetting](docs/V1beta1AlgorithmSetting.md) -- [V1beta1AlgorithmSpec](docs/V1beta1AlgorithmSpec.md) -- [V1beta1CollectorSpec](docs/V1beta1CollectorSpec.md) -- [V1beta1ConfigMapSource](docs/V1beta1ConfigMapSource.md) -- [V1beta1EarlyStoppingRule](docs/V1beta1EarlyStoppingRule.md) -- [V1beta1EarlyStoppingSetting](docs/V1beta1EarlyStoppingSetting.md) -- [V1beta1EarlyStoppingSpec](docs/V1beta1EarlyStoppingSpec.md) -- [V1beta1Experiment](docs/V1beta1Experiment.md) -- [V1beta1ExperimentCondition](docs/V1beta1ExperimentCondition.md) -- [V1beta1ExperimentList](docs/V1beta1ExperimentList.md) -- [V1beta1ExperimentSpec](docs/V1beta1ExperimentSpec.md) -- [V1beta1ExperimentStatus](docs/V1beta1ExperimentStatus.md) -- [V1beta1FeasibleSpace](docs/V1beta1FeasibleSpace.md) -- [V1beta1FileSystemPath](docs/V1beta1FileSystemPath.md) -- [V1beta1FilterSpec](docs/V1beta1FilterSpec.md) -- [V1beta1GraphConfig](docs/V1beta1GraphConfig.md) -- [V1beta1Metric](docs/V1beta1Metric.md) -- [V1beta1MetricStrategy](docs/V1beta1MetricStrategy.md) -- [V1beta1MetricsCollectorSpec](docs/V1beta1MetricsCollectorSpec.md) -- [V1beta1NasConfig](docs/V1beta1NasConfig.md) -- [V1beta1ObjectiveSpec](docs/V1beta1ObjectiveSpec.md) -- [V1beta1Observation](docs/V1beta1Observation.md) -- [V1beta1Operation](docs/V1beta1Operation.md) -- [V1beta1OptimalTrial](docs/V1beta1OptimalTrial.md) -- [V1beta1ParameterAssignment](docs/V1beta1ParameterAssignment.md) -- [V1beta1ParameterSpec](docs/V1beta1ParameterSpec.md) -- [V1beta1SourceSpec](docs/V1beta1SourceSpec.md) -- [V1beta1Suggestion](docs/V1beta1Suggestion.md) -- [V1beta1SuggestionCondition](docs/V1beta1SuggestionCondition.md) -- [V1beta1SuggestionList](docs/V1beta1SuggestionList.md) -- [V1beta1SuggestionSpec](docs/V1beta1SuggestionSpec.md) -- [V1beta1SuggestionStatus](docs/V1beta1SuggestionStatus.md) -- [V1beta1Trial](docs/V1beta1Trial.md) -- [V1beta1TrialAssignment](docs/V1beta1TrialAssignment.md) -- [V1beta1TrialCondition](docs/V1beta1TrialCondition.md) -- [V1beta1TrialList](docs/V1beta1TrialList.md) -- [V1beta1TrialParameterSpec](docs/V1beta1TrialParameterSpec.md) -- [V1beta1TrialSource](docs/V1beta1TrialSource.md) -- [V1beta1TrialSpec](docs/V1beta1TrialSpec.md) -- [V1beta1TrialStatus](docs/V1beta1TrialStatus.md) -- [V1beta1TrialTemplate](docs/V1beta1TrialTemplate.md) - -## Documentation For Authorization - -All endpoints do not require authorization. - -## Author - -prem0912 +Please follow the [examples](https://github.com/shivas1516/katib/tree/master/sdk) to learn more about Katib SDK. + +## Authorization Details + +All endpoints do not require authorization. \ No newline at end of file diff --git a/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py b/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py index 78808d17f05..b6f163b5911 100644 --- a/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py +++ b/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py @@ -39,22 +39,25 @@ def __init__( client_configuration: Optional[client.Configuration] = None, namespace: str = utils.get_default_target_namespace(), ): - """KatibClient constructor. Configure logging in your application - as follows to see detailed information from the KatibClient APIs: - .. code-block:: python - import logging - logging.basicConfig() - log = logging.getLogger("kubeflow.katib.api.katib_client") - log.setLevel(logging.DEBUG) + """KatibClient constructor. + + Configure logging in your application as follows to see detailed + information from the KatibClient APIs: + + .. code-block:: python + + import logging + logging.basicConfig() + log = logging.getLogger("kubeflow.katib.api.katib_client") + log.setLevel(logging.DEBUG) Args: - config_file: Path to the kube-config file. Defaults to ~/.kube/config. - context: Set the active context. Defaults to current_context from the kube-config. - client_configuration: Client configuration for cluster authentication. + config_file (str, optional): Path to the kube-config file. Defaults to ~/.kube/config. + context (str, optional): Set the active context. Defaults to current_context from the kube-config. + client_configuration (client.Configuration, optional): Client configuration for cluster authentication. You have to provide valid configuration with Bearer token or - with username and password. You can find an example here: - https://github.com/kubernetes-client/python/blob/67f9c7a97081b4526470cad53576bc3b71fa6fcc/examples/remote_cluster.py#L31 - namespace: Target Kubernetes namespace. By default it takes namespace + with username and password. + namespace (str): Target Kubernetes namespace. By default it takes namespace from `/var/run/secrets/kubernetes.io/serviceaccount/namespace` location or set as `default`. Namespace can be overridden during method invocations. """ @@ -190,7 +193,8 @@ def tune( pip_index_url: str = "https://pypi.org/simple", metrics_collector_config: Dict[str, Any] = {"kind": "StdOut"}, ): - """Create HyperParameter Tuning Katib Experiment from the objective function. + """ + Create HyperParameter Tuning Katib Experiment from the objective function. Args: name: Name for the Experiment. @@ -201,9 +205,7 @@ def tune( definition. Import statements must be added inside the function. parameters: Dict of HyperParameters to tune your Experiment. You should use Katib SDK to define the search space for these parameters. - - For example: `parameters = {"lr": katib.search.double(min=0.1, max=0.2)}` - + For example: ``parameters = {"lr": katib.search.double(min=0.1, max=0.2)``. Also, you can use these parameters to define input for your objective function. base_image: Image to use when executing the objective function. @@ -211,19 +213,16 @@ def tune( env_per_trial: Environment variable(s) to be attached to each trial container. You can specify a dictionary as a mapping object representing the environment variables. Otherwise, you can specify a list, in which the element can either - be a kubernetes.client.models.V1EnvVar (documented here: - https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1EnvVar.md) - or a kubernetes.client.models.V1EnvFromSource (documented here: - https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1EnvFromSource.md) + be a ``kubernetes.client.models.V1EnvVar`` or a ``kubernetes.client.models.V1EnvFromSource``. algorithm_name: Search algorithm for the HyperParameter tuning. algorithm_settings: Settings for the search algorithm given. For available fields, check this doc: https://www.kubeflow.org/docs/components/katib/experiment/#search-algorithms-in-detail. objective_metric_name: Objective metric that Katib optimizes. additional_metric_names: List of metrics that Katib collects from the - objective function in addition to objective metric. + objective function in addition to the objective metric. objective_type: Type for the Experiment optimization for the objective metric. - Must be one of `minimize` or `maximize`. + Must be one of ``minimize`` or ``maximize``. objective_goal: Objective goal that Experiment should reach to be Succeeded. max_trial_count: Maximum number of Trials to run. For the default values check this doc: @@ -231,31 +230,28 @@ def tune( parallel_trial_count: Number of Trials that Experiment runs in parallel. max_failed_trial_count: Maximum number of Trials allowed to fail. resources_per_trial: A parameter that lets you specify how much - resources each trial container should have. You can either specify a - kubernetes.client.V1ResourceRequirements object (documented here: - https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1ResourceRequirements.md) - or a dictionary that includes one or more of the following keys: - `cpu`, `memory`, or `gpu` (other keys will be ignored). Appropriate - values for these keys are documented here: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/. - For example: - { - "cpu": "1", - "gpu": "1", - "memory": "2Gi", - } - Please note, `gpu` specifies a resource request with a key of - `nvidia.com/gpu`, i.e. an NVIDIA GPU. If you need a different type - of GPU, pass in a V1ResourceRequirement instance instead, since it's - more flexible. This parameter is optional and defaults to None. - retain_trials: Whether Trials' resources (e.g. pods) are deleted after Succeeded state. + resources each trial container should have. You can either specify a + ``kubernetes.client.V1ResourceRequirements`` object or a dictionary that + includes one or more of the following keys: ``cpu``, ``memory``, or ``gpu`` + (other keys will be ignored). For example: + + .. code-block:: yaml + + { + "cpu": "1", + "gpu": "1", + "memory": "2Gi", + } + + Please note, ``gpu`` specifies a resource request with a key of + ``nvidia.com/gpu``, i.e., an NVIDIA GPU. If you need a different type + of GPU, pass in a ``V1ResourceRequirement`` instance instead, since it's + more flexible. This parameter is optional and defaults to None. + retain_trials: Whether Trials' resources (e.g., pods) are deleted after Succeeded state. packages_to_install: List of Python packages to install in addition to the base image packages. These packages are installed before executing the objective function. - pip_index_url: The PyPI url from which to install Python packages. - metrics_collector_config: Specify the config of metrics collector, - for example, `metrics_collector_config = {"kind": "Push"}`. - Currently, we only support `StdOut` and `Push` metrics collector. + pip_index_url: The PyPI URL from which to install Python packages. Raises: ValueError: Function arguments have incorrect type or value. @@ -646,6 +642,7 @@ def is_experiment_restarting( timeout: int = constants.DEFAULT_TIMEOUT, ): """Check if Experiment is Restarting. + Args: name: Name for the Experiment. namespace: Namespace for the Experiment. @@ -654,13 +651,12 @@ def is_experiment_restarting( to execute the request. Returns: - bool: True is Experiment is Resting, else False. + bool: True if Experiment is Restarting, else False. Raises: TimeoutError: Timeout to get Katib Experiment. RuntimeError: Failed to get Katib Experiment. """ - namespace = namespace or self.namespace return utils.has_condition( @@ -676,6 +672,7 @@ def is_experiment_succeeded( timeout: int = constants.DEFAULT_TIMEOUT, ): """Check if Experiment is Succeeded. + Args: name: Name for the Experiment. namespace: Namespace for the Experiment. @@ -684,7 +681,7 @@ def is_experiment_succeeded( to execute the request. Returns: - bool: True is Experiment is Succeeded, else False. + bool: True if Experiment is Succeeded, else False. Raises: TimeoutError: Timeout to get Katib Experiment. @@ -706,6 +703,7 @@ def is_experiment_failed( timeout: int = constants.DEFAULT_TIMEOUT, ): """Check if Experiment is Failed. + Args: name: Name for the Experiment. namespace: Namespace for the Experiment. @@ -714,7 +712,7 @@ def is_experiment_failed( to execute the request. Returns: - bool: True is Experiment is Failed, else False. + bool: True if Experiment is Failed, else False. Raises: TimeoutError: Timeout to get Katib Experiment. @@ -1277,7 +1275,7 @@ def get_trial_metrics( """Get the Trial Metric Results from the Katib DB. Katib DB Manager service should be accessible while calling this API. - If you run this API in-cluster (e.g. from the Kubeflow Notebook) you can + If you run this API in-cluster (e.g. from the Kubeflow Notebook), you can use the default Katib DB Manager address: `katib-db-manager.kubeflow:6789`. If you run this API outside the cluster, you have to port-forward the @@ -1291,14 +1289,14 @@ def get_trial_metrics( Args: name: Name for the Trial. namespace: Namespace for the Trial. - db-manager-address: Address for the Katib DB Manager in this format: `ip-address:port`. + db_manager_address: Address for the Katib DB Manager in this format: `ip-address:port`. timeout: Optional, gRPC API Server timeout in seconds to get metrics. Returns: List of MetricLog objects (https://github.com/kubeflow/katib/blob/4a2db414d85f29f17bc8ec6ff3462beef29585da/pkg/apis/manager/v1beta1/gen-doc/api.md#api-v1-beta1-MetricLog). - For example, to get the first metric value run the following: - `get_trial_metrics(...)[0].metric.value + For example, to get the first metric value, run the following: + `get_trial_metrics(...)[0].metric.value`. Raises: RuntimeError: Unable to get Trial metrics.