diff --git a/doc/_static/custom.css b/doc/_static/custom.css index b4bfb4cc..473ee165 100644 --- a/doc/_static/custom.css +++ b/doc/_static/custom.css @@ -59,3 +59,103 @@ html[data-theme="dark"] .navbar-brand .title { html[data-theme="dark"] p { color: #d1d5db !important; } + +.current.active>a { + background-color: aliceblue !important; +} + +.bd-sidebar-primary li.has-children .caption, +.bd-sidebar-primary li.has-children>.reference { + margin-right: inherit; +} + +nav.bd-links li>a { + margin-right: inherit; +} + +.table tbody tr:hover { + background: none !important; +} + +.wy-table-responsive table td, +.wy-table-responsive table th { + white-space: normal; +} + +.wy-table-responsive { + margin-bottom: 24px; + max-width: 100%; + overflow: visible; +} + +.pagination { + display: inline-block; +} + +.pagination a { + color: black; + float: left; + padding: 8px 16px; + text-decoration: none; +} + +.pagination a.active { + background-color: #2a80b9; + color: white; +} + +.pagination a:hover:not(.active) { + background-color: #ddd; +} + + +dl.py.class dt.sig.sig-object.py { + display: table; + margin: 6px 0; + font-size: 90%; + line-height: normal; + background: #e7f2fa !important; + color: #2980b9 !important; + border-top: 3px solid #6ab0de !important; + padding: 6px; + position: relative; +} + +dl.py.method dt.sig.sig-object.py { + display: table; + margin: 6px 0; + font-size: 90%; + line-height: normal; + background: #e7f2fa !important; + color: #2980b9 !important; + border-left: 3px solid #6ab0de !important; + border-top: none !important; + padding: 6px; + position: relative; +} + +dl.py.attribute dt.sig.sig-object.py { + margin-bottom: 6px; + border: none; + border-left: 3px solid #ccc; + background: #f0f0f0 !important; + color: #555 !important; + border-top: none !important; +} + +.sig-prename.descclassname { + color: #000; +} + +.field-list { + display: grid !important; + grid-template-columns: 0.5fr 2fr !important; +} + +.field-list dt { + background: transparent !important; +} + +.py.class dl { + margin: 1rem 0 !important; +} \ No newline at end of file diff --git a/doc/cli/cli_index.rst b/doc/cli/cli_index.rst new file mode 100644 index 00000000..4bb59774 --- /dev/null +++ b/doc/cli/cli_index.rst @@ -0,0 +1,39 @@ +############# +CLI Reference +############# + +.. toctree:: + :hidden: + :maxdepth: 2 + + cluster + inference + training + +Complete reference for the SageMaker HyperPod CLI commands. + +.. container:: + + .. grid:: 1 1 3 3 + :gutter: 3 + + .. grid-item-card:: Cluster CLI + :link: cluster + :link-type: doc + :class-card: sd-border-secondary + + Cluster management CLI commands and parameters. + + .. grid-item-card:: Inference CLI + :link: inference + :link-type: doc + :class-card: sd-border-secondary + + Inference CLI commands and parameters. + + .. grid-item-card:: Training CLI + :link: training + :link-type: doc + :class-card: sd-border-secondary + + Training CLI commands and parameters. \ No newline at end of file diff --git a/doc/cli/cluster.rst b/doc/cli/cluster.rst new file mode 100644 index 00000000..fee7b57d --- /dev/null +++ b/doc/cli/cluster.rst @@ -0,0 +1,41 @@ +Cluster CLI +=========== + +This page documents the CLI commands for managing HyperPod clusters. + +Cluster Information Commands +---------------------------- + +List Clusters +~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.cluster:list_cluster + :prog: hyp list-cluster + :show-nested: + +Cluster Context Commands +------------------------ + +Set Cluster Context +~~~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.cluster:set_cluster_context + :prog: hyp set-cluster-context + :show-nested: + +Get Cluster Context +~~~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.cluster:get_cluster_context + :prog: hyp get-cluster-context + :show-nested: + +Monitoring Commands +------------------- + +Get Monitoring Configuration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.cluster:get_monitoring + :prog: hyp get-monitoring + :show-nested: \ No newline at end of file diff --git a/doc/cli/inference.rst b/doc/cli/inference.rst new file mode 100644 index 00000000..b61d388b --- /dev/null +++ b/doc/cli/inference.rst @@ -0,0 +1,44 @@ +Inference CLI +============= + +This page documents the CLI commands for managing inference endpoints. + +.. note:: + Create commands use dynamic parameter generation and are documented in the :doc:`../cli_reference` page. + +Invoke Commands +--------------- + +Invoke Custom Endpoint +~~~~~~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.inference:custom_invoke + :prog: hyp invoke + :show-nested: + +List Commands +------------- + +List Jumpstart Endpoints +~~~~~~~~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.inference:js_list + :prog: hyp list + :show-nested: + +List Custom Endpoints +~~~~~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.inference:custom_list + :prog: hyp list + :show-nested: + +Describe Commands +----------------- + +Describe Jumpstart Endpoint +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.inference:js_describe + :prog: hyp describe + :show-nested: \ No newline at end of file diff --git a/doc/cli/training.rst b/doc/cli/training.rst new file mode 100644 index 00000000..17ee0548 --- /dev/null +++ b/doc/cli/training.rst @@ -0,0 +1,54 @@ +Training CLI +============ + +This page documents the CLI commands for managing PyTorch training jobs. + +.. note:: + Create commands use dynamic parameter generation and are documented in the :doc:`../cli_training` page. + +List Commands +------------- + +List PyTorch Jobs +~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.training:list_jobs + :prog: hyp list + :show-nested: + +Describe Commands +----------------- + +Describe PyTorch Job +~~~~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.training:pytorch_describe + :prog: hyp describe + :show-nested: + +Delete Commands +--------------- + +Delete PyTorch Job +~~~~~~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.training:pytorch_delete + :prog: hyp delete + :show-nested: + +Pod Management Commands +----------------------- + +List Job Pods +~~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.training:pytorch_list_pods + :prog: hyp list-pods + :show-nested: + +Get Pod Logs +~~~~~~~~~~~~ + +.. click:: sagemaker.hyperpod.cli.commands.training:pytorch_get_logs + :prog: hyp get-logs + :show-nested: \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index cf944cf8..2fc73ea3 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -25,6 +25,42 @@ def setup(app): """Register our sphinx hooks.""" + # Add CLI source path for sphinx-click + cli_path = Path(__file__).parent.parent / "src" + sys.path.insert(0, str(cli_path)) + + # Mock the problematic decorators + from unittest.mock import MagicMock + + # Create a mock that acts like a decorator + def mock_generate_click_command(*args, **kwargs): + def decorator(func): + # Return the original function with minimal Click attributes + func.__click_params__ = [] + return func + return decorator + + # Mock telemetry decorator + def mock_telemetry_emitter(*args, **kwargs): + def decorator(func): + # Return the original function unchanged + return func + return decorator + + # Mock the entire inference_utils module + mock_inference_utils = MagicMock() + mock_inference_utils.generate_click_command = mock_generate_click_command + sys.modules['sagemaker.hyperpod.cli.inference_utils'] = mock_inference_utils + + # Mock the training_utils module + mock_training_utils = MagicMock() + mock_training_utils.generate_click_command = mock_generate_click_command + sys.modules['sagemaker.hyperpod.cli.training_utils'] = mock_training_utils + + # Mock the telemetry module + mock_telemetry = MagicMock() + mock_telemetry._hyperpod_telemetry_emitter = mock_telemetry_emitter + sys.modules['sagemaker.hyperpod.common.telemetry.telemetry_logging'] = mock_telemetry # Get version from setup.py @@ -71,10 +107,34 @@ def get_version(): "sphinx_copybutton", "sphinx.ext.autosummary", "sphinx.ext.autosectionlabel", + "sphinx_click", ] -autodoc_mock_imports = ["pyspark", "feature_store_pyspark", "py4j"] +autodoc_mock_imports = [ + "pyspark", + "feature_store_pyspark", + "py4j", + "hyperpod_jumpstart_inference_template", + "hyperpod_custom_inference_template", + "hyperpod_pytorch_job_template", + "hyperpod_pytorch_job_template.registry", + "sagemaker_core", + "boto3", + "botocore", + "tabulate", + "kubernetes", + "kubernetes.client", + "ratelimit", + "sagemaker.hyperpod.cli.clients.kubernetes_client", + "sagemaker.hyperpod.cli.inference_utils", + "sagemaker.hyperpod.cli.inference_utils.generate_click_command", + "sagemaker.hyperpod.inference.hp_jumpstart_endpoint", + "sagemaker.hyperpod.inference.hp_endpoint", + "sagemaker.hyperpod.common.telemetry.telemetry_logging", + "sagemaker.hyperpod.common.telemetry.constants", + "sagemaker.hyperpod.common.utils" +] source_suffix = { '.rst': 'restructuredtext', diff --git a/doc/index.md b/doc/index.md index 8551d445..19bf5469 100644 --- a/doc/index.md +++ b/doc/index.md @@ -18,6 +18,7 @@ keywords: Installation Getting Started CLI Reference + SDK reference Advanced Resources ``` diff --git a/doc/requirements.txt b/doc/requirements.txt index a9f4a087..e290e1b4 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -8,3 +8,7 @@ linkify-it-py>=2.0.0 sphinx-design>=0.5.0 sphinx-tabs>=3.4.1 sphinx-copybutton +sphinx-click +pydantic +kubernetes +docutils>=0.18.1,<=0.19 \ No newline at end of file