code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def make_instance(self, include_optional):
"""Test V2beta1GetHealthzResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_get_healthz_res... | Test V2beta1GetHealthzResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_get_healthz_response.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_get_healthz_response.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1ListExperimentsResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_list_exper... | Test V2beta1ListExperimentsResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_list_experiments_response.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_list_experiments_response.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1ListPipelinesResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_list_pipelin... | Test V2beta1ListPipelinesResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_list_pipelines_response.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_list_pipelines_response.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1ListPipelineVersionsResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_list_... | Test V2beta1ListPipelineVersionsResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_list_pipeline_versions_response.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_list_pipeline_versions_response.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1ListRecurringRunsResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_list_rec... | Test V2beta1ListRecurringRunsResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_list_recurring_runs_response.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_list_recurring_runs_response.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1ListRunsResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_list_runs_respons... | Test V2beta1ListRunsResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_list_runs_response.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_list_runs_response.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1PeriodicSchedule
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_periodic_schedule... | Test V2beta1PeriodicSchedule
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_periodic_schedule.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_periodic_schedule.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1Pipeline
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_pipeline.V2beta1Pipeline(... | Test V2beta1Pipeline
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1PipelineTaskDetail
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_pipeline_task_d... | Test V2beta1PipelineTaskDetail
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline_task_detail.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline_task_detail.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1PipelineTaskExecutorDetail
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_pipelin... | Test V2beta1PipelineTaskExecutorDetail
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline_task_executor_detail.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline_task_executor_detail.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1PipelineVersion
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_pipeline_version.V... | Test V2beta1PipelineVersion
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline_version.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline_version.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1PipelineVersionReference
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_pipeline_... | Test V2beta1PipelineVersionReference
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline_version_reference.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_pipeline_version_reference.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1Predicate
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_predicate.V2beta1Predica... | Test V2beta1Predicate
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_predicate.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_predicate.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1PredicateOperation
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_predicate_opera... | Test V2beta1PredicateOperation
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_predicate_operation.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_predicate_operation.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1ReadArtifactResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_read_artifact... | Test V2beta1ReadArtifactResponse
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_read_artifact_response.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_read_artifact_response.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1RecurringRun
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_recurring_run.V2beta1... | Test V2beta1RecurringRun
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_recurring_run.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_recurring_run.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1RecurringRunStatus
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_recurring_run_s... | Test V2beta1RecurringRunStatus
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_recurring_run_status.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_recurring_run_status.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1Run
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_run.V2beta1Run() # noqa: E501... | Test V2beta1Run
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_run.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_run.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1RuntimeConfig
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_runtime_config.V2bet... | Test V2beta1RuntimeConfig
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_runtime_config.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_runtime_config.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1RuntimeState
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_runtime_state.V2beta1... | Test V2beta1RuntimeState
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_runtime_state.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_runtime_state.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1RuntimeStatus
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_runtime_status.V2bet... | Test V2beta1RuntimeStatus
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_runtime_status.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_runtime_status.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1RunDetails
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_run_details.V2beta1RunD... | Test V2beta1RunDetails
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_run_details.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_run_details.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1RunStorageState
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_run_storage_state.... | Test V2beta1RunStorageState
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_run_storage_state.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_run_storage_state.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1Trigger
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_trigger.V2beta1Trigger() ... | Test V2beta1Trigger
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_trigger.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_trigger.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1Url
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_url.V2beta1Url() # noqa: E501... | Test V2beta1Url
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_url.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_url.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1Visualization
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_visualization.V2beta... | Test V2beta1Visualization
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_visualization.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_visualization.py | Apache-2.0 |
def make_instance(self, include_optional):
"""Test V2beta1VisualizationType
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = kfp_server_api.models.v2beta1_visualization_ty... | Test V2beta1VisualizationType
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | make_instance | python | kubeflow/pipelines | backend/api/v2beta1/python_http_client/test/test_v2beta1_visualization_type.py | https://github.com/kubeflow/pipelines/blob/master/backend/api/v2beta1/python_http_client/test/test_v2beta1_visualization_type.py | Apache-2.0 |
def create_cell_from_file(filepath: Text) -> NotebookNode:
"""Creates a NotebookNode object with provided file as code in node.
Args:
filepath: Path to file that should be used.
Returns:
NotebookNode with specified file as code within node.
"""
with open(filepath, 'r') as f:
... | Creates a NotebookNode object with provided file as code in node.
Args:
filepath: Path to file that should be used.
Returns:
NotebookNode with specified file as code within node.
| create_cell_from_file | python | kubeflow/pipelines | backend/src/apiserver/visualization/exporter.py | https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/visualization/exporter.py | Apache-2.0 |
def create_cell_from_custom_code(code: list) -> NotebookNode:
"""Creates a NotebookNode object with provided list as code in node.
Args:
code: list representing lines of code to be run.
Returns:
NotebookNode with specified file as code within node.
"""
cell = new_code_cell("\n".jo... | Creates a NotebookNode object with provided list as code in node.
Args:
code: list representing lines of code to be run.
Returns:
NotebookNode with specified file as code within node.
| create_cell_from_custom_code | python | kubeflow/pipelines | backend/src/apiserver/visualization/exporter.py | https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/visualization/exporter.py | Apache-2.0 |
def __init__(
self,
timeout: int = 100,
template_type: TemplateType = TemplateType.FULL
):
"""
Initializes Exporter with default timeout (100 seconds) and template
(FULL) and handles instantiation of km and ep variables for usage when
generating NotebookNodes ... |
Initializes Exporter with default timeout (100 seconds) and template
(FULL) and handles instantiation of km and ep variables for usage when
generating NotebookNodes and their outputs.
Args:
timeout (int): Amount of time in seconds that a visualization can
run fo... | __init__ | python | kubeflow/pipelines | backend/src/apiserver/visualization/exporter.py | https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/visualization/exporter.py | Apache-2.0 |
def generate_html_from_notebook(self, nb: NotebookNode) -> Text:
"""Converts a provided NotebookNode to HTML.
Args:
nb: NotebookNode that should be converted to HTML.
Returns:
HTML from converted NotebookNode as a string.
"""
# HTML generator and export... | Converts a provided NotebookNode to HTML.
Args:
nb: NotebookNode that should be converted to HTML.
Returns:
HTML from converted NotebookNode as a string.
| generate_html_from_notebook | python | kubeflow/pipelines | backend/src/apiserver/visualization/exporter.py | https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/visualization/exporter.py | Apache-2.0 |
def validate_and_get_arguments_from_body(self) -> dict:
"""Validates and converts arguments from post request to dict.
Returns:
Arguments provided from post request as a dict.
"""
try:
arguments = {
"arguments": "{}",
"type": self.... | Validates and converts arguments from post request to dict.
Returns:
Arguments provided from post request as a dict.
| validate_and_get_arguments_from_body | python | kubeflow/pipelines | backend/src/apiserver/visualization/server.py | https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/visualization/server.py | Apache-2.0 |
def generate_notebook_from_arguments(
self,
arguments: dict,
source: Text,
visualization_type: Text
) -> NotebookNode:
"""Generates a NotebookNode from provided arguments.
Args:
arguments: JSON object containing provided arguments.
source: Pat... | Generates a NotebookNode from provided arguments.
Args:
arguments: JSON object containing provided arguments.
source: Path or path pattern to be used as data reference for
visualization.
visualization_type: Name of visualization to be generated.
Returns:... | generate_notebook_from_arguments | python | kubeflow/pipelines | backend/src/apiserver/visualization/server.py | https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/visualization/server.py | Apache-2.0 |
def post(self):
"""Generates visualization based on provided arguments.
"""
# Validate arguments from request and return them as a dictionary.
try:
request_arguments = self.validate_and_get_arguments_from_body()
except Exception as e:
return self.send_erro... | Generates visualization based on provided arguments.
| post | python | kubeflow/pipelines | backend/src/apiserver/visualization/server.py | https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/visualization/server.py | Apache-2.0 |
def get_statistics_html(
lhs_statistics: statistics_pb2.DatasetFeatureStatisticsList
) -> Text:
"""Build the HTML for visualizing the input statistics using Facets.
Args:
lhs_statistics: A DatasetFeatureStatisticsList protocol buffer.
Returns:
HTML to be embedded for visualization.
Raises:
TypeE... | Build the HTML for visualizing the input statistics using Facets.
Args:
lhs_statistics: A DatasetFeatureStatisticsList protocol buffer.
Returns:
HTML to be embedded for visualization.
Raises:
TypeError: If the input argument is not of the expected type.
ValueError: If the input statistics protos d... | get_statistics_html | python | kubeflow/pipelines | backend/src/apiserver/visualization/types/tfdv.py | https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/visualization/types/tfdv.py | Apache-2.0 |
def wait_for_cluster(client, jobflow_id):
"""Waiting for a new cluster to be ready."""
while True:
response = client.describe_cluster(ClusterId=jobflow_id)
cluster_status = response['Cluster']['Status']
state = cluster_status['State']
if 'Message' in cluster_status['StateChangeReason']:
state... | Waiting for a new cluster to be ready. | wait_for_cluster | python | kubeflow/pipelines | components/aws/emr/common/_utils.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/emr/common/_utils.py | Apache-2.0 |
def wait_for_job(client, jobflow_id, step_id):
"""Waiting for a cluster step by polling it."""
while True:
result = client.describe_step(ClusterId=jobflow_id, StepId=step_id)
step_status = result['Step']['Status']
state = step_status['State']
if state in ('CANCELLED', 'FAILED', 'INTERRUPTED'):
... | Waiting for a cluster step by polling it. | wait_for_job | python | kubeflow/pipelines | components/aws/emr/common/_utils.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/emr/common/_utils.py | Apache-2.0 |
def _get_boto3_session(
region: str, role_arn: str = None, assume_duration: int = 3600
) -> Session:
"""Creates a boto3 session, optionally assuming a role.
Args:
region: The AWS region for the session.
role_arn: The ARN to assume for the session.
assume_... | Creates a boto3 session, optionally assuming a role.
Args:
region: The AWS region for the session.
role_arn: The ARN to assume for the session.
assume_duration: The duration (in seconds) to assume the role.
Returns:
object: A boto3 Session.
| _get_boto3_session | python | kubeflow/pipelines | components/aws/sagemaker/common/boto3_manager.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/boto3_manager.py | Apache-2.0 |
def get_sagemaker_client(
component_version: str,
region: str,
endpoint_url: str = None,
assume_role_arn: str = None,
):
"""Builds a client to the AWS SageMaker API.
Args:
component_version: The version of the component to include in
the u... | Builds a client to the AWS SageMaker API.
Args:
component_version: The version of the component to include in
the user agent.
region: The AWS region for the SageMaker client.
endpoint_url: A private link endpoint for SageMaker.
assume_role_arn: Th... | get_sagemaker_client | python | kubeflow/pipelines | components/aws/sagemaker/common/boto3_manager.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/boto3_manager.py | Apache-2.0 |
def get_sagemaker_session(
component_version: str,
region: str,
endpoint_url: str = None,
assume_role_arn: str = None,
):
"""Builds a SageMaker Session which can be used by any Estimator.
Args:
component_version: The version of the component to include in... | Builds a SageMaker Session which can be used by any Estimator.
Args:
component_version: The version of the component to include in
the user agent.
region: The AWS region for the SageMaker client and SageMaker Session.
endpoint_url: A private link endpoint for... | get_sagemaker_session | python | kubeflow/pipelines | components/aws/sagemaker/common/boto3_manager.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/boto3_manager.py | Apache-2.0 |
def get_robomaker_client(
component_version: str,
region: str,
endpoint_url: str = None,
assume_role_arn: str = None,
):
"""Builds a client to the AWS RoboMaker API.
Args:
component_version: The version of the component to include in
the u... | Builds a client to the AWS RoboMaker API.
Args:
component_version: The version of the component to include in
the user agent.
region: The AWS region for the RoboMaker client.
endpoint_url: A private link endpoint for RoboMaker.
assume_role_arn: Th... | get_robomaker_client | python | kubeflow/pipelines | components/aws/sagemaker/common/boto3_manager.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/boto3_manager.py | Apache-2.0 |
def get_cloudwatch_client(region: str, assume_role_arn: str = None):
"""Builds a client to the AWS CloudWatch API.
Args:
region: The AWS region for the CloudWatch client.
Returns:
object: A CloudWatch boto3 client.
"""
session = Boto3Manager._get_boto3_s... | Builds a client to the AWS CloudWatch API.
Args:
region: The AWS region for the CloudWatch client.
Returns:
object: A CloudWatch boto3 client.
| get_cloudwatch_client | python | kubeflow/pipelines | components/aws/sagemaker/common/boto3_manager.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/boto3_manager.py | Apache-2.0 |
def to_argparse_mapping(self):
"""Maps each property to an argparse argument.
See: https://docs.python.org/3/library/argparse.html#adding-arguments
"""
return {
"type": self.input_type,
"help": self.description,
"required": self.required,
... | Maps each property to an argparse argument.
See: https://docs.python.org/3/library/argparse.html#adding-arguments
| to_argparse_mapping | python | kubeflow/pipelines | components/aws/sagemaker/common/common_inputs.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/common_inputs.py | Apache-2.0 |
def _create_and_write_component(
component_def: Type[SageMakerComponent],
component_file_path: str,
output_path: str,
component_image_uri: str,
component_image_tag: str,
):
"""Creates a component YAML specification and writes it to file.
Args:
com... | Creates a component YAML specification and writes it to file.
Args:
component_def: The type of the SageMaker component.
component_file_path: The path to the component definition file.
output_path: The output path for the `component.yaml` file.
component_image_uri... | _create_and_write_component | python | kubeflow/pipelines | components/aws/sagemaker/common/component_compiler.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/component_compiler.py | Apache-2.0 |
def _create_and_compare_component(
component_def: Type[SageMakerComponent],
component_file_path: str,
compare_path: str,
component_image_uri: str,
component_image_tag: str,
):
"""Creates a component YAML specification and compares it to an
existing file.
... | Creates a component YAML specification and compares it to an
existing file.
Args:
component_def: The type of the SageMaker component.
component_file_path: The path to the component definition file.
compare_path: The file path for the existing `component.yaml` file to... | _create_and_compare_component | python | kubeflow/pipelines | components/aws/sagemaker/common/component_compiler.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/component_compiler.py | Apache-2.0 |
def _create_io_from_component_spec(spec: Type[SageMakerComponentSpec]) -> IOArgs:
"""Parses the set of inputs and outputs from a component spec into the
YAML spec form.
Args:
spec: A component specification definition.
Returns:
IOArgs: The IO arguments object fi... | Parses the set of inputs and outputs from a component spec into the
YAML spec form.
Args:
spec: A component specification definition.
Returns:
IOArgs: The IO arguments object filled with the fields from the
component spec definition.
| _create_io_from_component_spec | python | kubeflow/pipelines | components/aws/sagemaker/common/component_compiler.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/component_compiler.py | Apache-2.0 |
def _create_component_spec(
component_def: Type[SageMakerComponent],
component_file_path: str,
component_image_uri: str,
component_image_tag: str,
) -> ComponentSpec:
"""Create a component YAML specification object based on a component.
Args:
component_de... | Create a component YAML specification object based on a component.
Args:
component_def: The type of the SageMaker component.
component_file_path: The path to the component definition file.
component_image_uri: Compiled image URI.
component_image_tag: Compiled ima... | _create_component_spec | python | kubeflow/pipelines | components/aws/sagemaker/common/component_compiler.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/component_compiler.py | Apache-2.0 |
def _compare_component(component_spec: ComponentSpec, compare_path: str):
"""Compare an existing specification file to a new specification.
Args:
component_spec: A `component.yaml` specification object.
compare_path: The path of the existing specification file.
"""
... | Compare an existing specification file to a new specification.
Args:
component_spec: A `component.yaml` specification object.
compare_path: The path of the existing specification file.
| _compare_component | python | kubeflow/pipelines | components/aws/sagemaker/common/component_compiler.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/component_compiler.py | Apache-2.0 |
def compile(
component_def: Type[SageMakerComponent],
component_file_path: str,
output_path: str,
component_image_uri: str,
component_image_tag: str,
):
"""Compiles a defined component into its component YAML specification.
Args:
component_def: Th... | Compiles a defined component into its component YAML specification.
Args:
component_def: The type of the SageMaker component.
component_file_path: The path to the component definition file.
output_path: The output path for the `component.yaml` file.
component_ima... | compile | python | kubeflow/pipelines | components/aws/sagemaker/common/component_compiler.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/component_compiler.py | Apache-2.0 |
def check(
component_def: Type[SageMakerComponent],
component_file_path: str,
compare_path: str,
component_image_uri: str,
component_image_tag: str,
):
"""Compiles a defined component into its component YAML specification
and compares it against an existing YA... | Compiles a defined component into its component YAML specification
and compares it against an existing YAML file.
Args:
component_def: The type of the SageMaker component.
component_file_path: The path to the component definition file.
compare_path: The file path for... | check | python | kubeflow/pipelines | components/aws/sagemaker/common/component_compiler.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/component_compiler.py | Apache-2.0 |
def compile_spec_file(component_file, spec_dir, args):
"""Attempts to compile a component specification file into a YAML spec.
Writes a `component.yaml` file into a file one directory above where the
specification file exists. For example if the spec is in `/my/spec/src`,
it will create a file `/my/spe... | Attempts to compile a component specification file into a YAML spec.
Writes a `component.yaml` file into a file one directory above where the
specification file exists. For example if the spec is in `/my/spec/src`,
it will create a file `/my/spec/component.yaml`.
Args:
component_file: A path t... | compile_spec_file | python | kubeflow/pipelines | components/aws/sagemaker/common/generate_components.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/generate_components.py | Apache-2.0 |
def ComponentMetadata(name: str, description: str, spec: object):
"""Decorator for SageMaker components.
Used to define necessary metadata attributes about the component which will
be used for logging output and for the component specification file.
Usage:
```python
@ComponentMetadata(
... | Decorator for SageMaker components.
Used to define necessary metadata attributes about the component which will
be used for logging output and for the component specification file.
Usage:
```python
@ComponentMetadata(
name="SageMaker - Component Name",
description="A cool new compo... | ComponentMetadata | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def Do(
self,
inputs: SageMakerComponentCommonInputs,
outputs: SageMakerComponentBaseOutputs,
output_paths: SageMakerComponentBaseOutputs,
):
"""The main execution entrypoint for a component at runtime.
Args:
inputs: A populated list of user inputs.
... | The main execution entrypoint for a component at runtime.
Args:
inputs: A populated list of user inputs.
outputs: An unpopulated list of component output variables.
output_paths: Paths to the respective output locations.
| Do | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _configure_aws_clients(self, inputs: SageMakerComponentCommonInputs):
"""Configures the internal AWS clients for the component.
Args:
inputs: A populated list of user inputs.
"""
self._sm_client = Boto3Manager.get_sagemaker_client(
self._get_component_version... | Configures the internal AWS clients for the component.
Args:
inputs: A populated list of user inputs.
| _configure_aws_clients | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _create_job_request(
self,
inputs: SageMakerComponentCommonInputs,
outputs: SageMakerComponentBaseOutputs,
) -> Dict:
"""Creates the boto3 request object to execute the component.
Args:
inputs: A populated list of user inputs.
outputs: An unpopula... | Creates the boto3 request object to execute the component.
Args:
inputs: A populated list of user inputs.
outputs: An unpopulated list of component output variables.
Returns:
dict: A dictionary object representing the request.
| _create_job_request | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _after_job_complete(
self,
job: object,
request: Dict,
inputs: SageMakerComponentCommonInputs,
outputs: SageMakerComponentBaseOutputs,
):
"""Handles any events after the job has been completed.
Args:
job: The job object that was created.
... | Handles any events after the job has been completed.
Args:
job: The job object that was created.
request: The request object used to execute the component.
inputs: A populated list of user inputs.
outputs: An unpopulated list of component output variables.
... | _after_job_complete | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _generate_unique_timestamped_id(
prefix: str = "",
size: int = 4,
chars: str = string.ascii_uppercase + string.digits,
max_length: int = 63,
) -> str:
"""Generate a pseudo-random string of characters appended to a
timestamp.
Format of the ID is as follows... | Generate a pseudo-random string of characters appended to a
timestamp.
Format of the ID is as follows: `prefix-YYYYMMDDHHMMSS-unique`. If the
length of the total ID exceeds `max_length`, it will be truncated from
the beginning (prefix will be trimmed).
Args:
prefix:... | _generate_unique_timestamped_id | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _enable_spot_instance_support(
request: Dict, inputs: SpotInstanceInputs,
) -> Dict:
"""Modifies a request object to add support for spot instance fields.
Args:
request: A request object to modify.
inputs: A populated list of user inputs.
Returns:
... | Modifies a request object to add support for spot instance fields.
Args:
request: A request object to modify.
inputs: A populated list of user inputs.
Returns:
dict: The modified dictionary
| _enable_spot_instance_support | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _validate_hyperparameters(hyperparam_args: Dict) -> Dict:
"""Validates hyperparameters and returns the dictionary used for a
request.
Args:
hyperparam_args: HyperParameters as passed in by the user.
Returns:
dict: A validated set of HyperParameters.
... | Validates hyperparameters and returns the dictionary used for a
request.
Args:
hyperparam_args: HyperParameters as passed in by the user.
Returns:
dict: A validated set of HyperParameters.
| _validate_hyperparameters | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _enable_tag_support(
request: Dict, inputs: SageMakerComponentCommonInputs
) -> Dict:
"""Modifies a request object to add support for tag fields.
Args:
request: A request object to modify.
inputs: A populated list of user inputs.
Returns:
dic... | Modifies a request object to add support for tag fields.
Args:
request: A request object to modify.
inputs: A populated list of user inputs.
Returns:
dict: The modified dictionary
| _enable_tag_support | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _write_all_outputs(
self,
output_paths: SageMakerComponentBaseOutputs,
outputs: SageMakerComponentBaseOutputs,
):
"""Writes all of the outputs specified by the component to their
respective file paths.
Args:
output_paths: A populated list of output pa... | Writes all of the outputs specified by the component to their
respective file paths.
Args:
output_paths: A populated list of output paths.
outputs: A populated list of output values.
| _write_all_outputs | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _write_output(
self, output_path: str, output_value: Any, json_encode: bool = False
):
"""Write an output value to the associated path, dumping as a JSON
object if specified.
Args:
output_path: The file path of the output.
output_value: The output value t... | Write an output value to the associated path, dumping as a JSON
object if specified.
Args:
output_path: The file path of the output.
output_value: The output value to write to the file.
json_encode: True if the value should be encoded as a JSON object.
| _write_output | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _get_request_template(template_name: str) -> Dict[str, Any]:
"""Loads and returns a template file as a Python construct.
Args:
template_name: The name corresponding to the template file to load.
Returns:
dict: A Python construct created by loading the template file.... | Loads and returns a template file as a Python construct.
Args:
template_name: The name corresponding to the template file to load.
Returns:
dict: A Python construct created by loading the template file.
| _get_request_template | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _print_cloudwatch_logs(self, log_grp: str, job_name: str):
"""Gets the CloudWatch logs for SageMaker jobs.
Args:
log_grp: The name of a CloudWatch log group.
job_name: The name of the job as defined in CloudWatch.
"""
CW_ERROR_MESSAGE = "Error in fetching Cl... | Gets the CloudWatch logs for SageMaker jobs.
Args:
log_grp: The name of a CloudWatch log group.
job_name: The name of the job as defined in CloudWatch.
| _print_cloudwatch_logs | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _get_model_artifacts_from_job(self, job_name: str):
"""Loads training job model artifact results from a completed job.
Args:
job_name: The name of the completed training job.
Returns:
str: The S3 model artifacts of the job.
"""
info = self._sm_client... | Loads training job model artifact results from a completed job.
Args:
job_name: The name of the completed training job.
Returns:
str: The S3 model artifacts of the job.
| _get_model_artifacts_from_job | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def _get_image_from_job(self, job_name: str):
"""Gets the training image URL from a training job.
Args:
job_name: The name of a training job.
Returns:
str: A training image URL.
"""
info = self._sm_client.describe_training_job(TrainingJobName=job_name)
... | Gets the training image URL from a training job.
Args:
job_name: The name of a training job.
Returns:
str: A training image URL.
| _get_image_from_job | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component.py | Apache-2.0 |
def __init__(
self,
arguments: List[str],
input_constructor: Callable[..., IT],
output_constructor: Callable[..., OT],
):
"""Instantiates the spec with given user inputs.
Args:
arguments: A list of command line arguments.
input_constructor: A ... | Instantiates the spec with given user inputs.
Args:
arguments: A list of command line arguments.
input_constructor: A constructor to create an input object.
output_constructor: A constructor to create an output object.
| __init__ | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component_spec.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component_spec.py | Apache-2.0 |
def _validate_spec(cls):
"""Ensures that all of the types given as inputs and outputs are
validators."""
if cls.INPUTS:
for key, val in cls.INPUTS.__dict__.items():
if not isinstance(val, SageMakerComponentInputValidator):
raise ValueError(
... | Ensures that all of the types given as inputs and outputs are
validators. | _validate_spec | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component_spec.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component_spec.py | Apache-2.0 |
def _parser(self):
"""Builds an argument parser to handle the set of defined inputs and
outputs.
Returns:
An argument parser that fits the set of static inputs and outputs.
"""
parser = argparse.ArgumentParser()
# Add each input and output to the parser
... | Builds an argument parser to handle the set of defined inputs and
outputs.
Returns:
An argument parser that fits the set of static inputs and outputs.
| _parser | python | kubeflow/pipelines | components/aws/sagemaker/common/sagemaker_component_spec.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/sagemaker_component_spec.py | Apache-2.0 |
def nullable_string_argument(value):
"""Strips strings and returns None if they are empty."""
value = value.strip()
if not value:
return None
return value | Strips strings and returns None if they are empty. | nullable_string_argument | python | kubeflow/pipelines | components/aws/sagemaker/common/spec_input_parsers.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/spec_input_parsers.py | Apache-2.0 |
def yaml_or_json_list(value):
"""Parses a YAML or JSON list to a Python list."""
parsed = SpecInputParsers._yaml_or_json_str(value)
if parsed is not None and not isinstance(parsed, List):
raise ArgumentTypeError(f"{value} (type {type(value)}) is not a list")
return parsed | Parses a YAML or JSON list to a Python list. | yaml_or_json_list | python | kubeflow/pipelines | components/aws/sagemaker/common/spec_input_parsers.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/spec_input_parsers.py | Apache-2.0 |
def yaml_or_json_dict(value):
"""Parses a YAML or JSON dictionary to a Python dictionary."""
parsed = SpecInputParsers._yaml_or_json_str(value)
if parsed is not None and not isinstance(parsed, Dict):
raise ArgumentTypeError(f"{value} (type {type(value)}) is not a dictionary")
... | Parses a YAML or JSON dictionary to a Python dictionary. | yaml_or_json_dict | python | kubeflow/pipelines | components/aws/sagemaker/common/spec_input_parsers.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/spec_input_parsers.py | Apache-2.0 |
def str_to_bool(value):
"""Converts a string interpretation of a boolean to a Python bool."""
# This distutils function returns an integer representation of the boolean
# rather than a True/False value. This simply hard casts it.
return bool(strtobool(value)) | Converts a string interpretation of a boolean to a Python bool. | str_to_bool | python | kubeflow/pipelines | components/aws/sagemaker/common/spec_input_parsers.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/spec_input_parsers.py | Apache-2.0 |
def _init_configure_k8s(self):
"""Initializes the kubernetes client and configures the namespace."""
_test_client = self._get_k8s_api_client()
_test_api = client.CoreV1Api(_test_client)
_test_api.list_namespaced_pod(namespace=self.namespace) | Initializes the kubernetes client and configures the namespace. | _init_configure_k8s | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _get_k8s_api_client(self) -> ApiClient:
"""Create new client everytime to avoid token refresh issues."""
# when run in k8s cluster
config.load_incluster_config()
return ApiClient() | Create new client everytime to avoid token refresh issues. | _get_k8s_api_client | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _verify_resource_consumption(self) -> bool:
"""Verify that the resource has been successfully consumed by the controller.
In the case of an update verify that the job arn exists.
Returns:
bool: Whether the resource consumed by the controller.
"""
submission_a... | Verify that the resource has been successfully consumed by the controller.
In the case of an update verify that the job arn exists.
Returns:
bool: Whether the resource consumed by the controller.
| _verify_resource_consumption | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def check_resource_initiation(self, submission_ack_printed: bool):
""" Check if resource has been initiated in Sagemaker.
A resource is considered to be initiated if the resource ARN is present in the ack resource metadata.
If the resource ARN is present in the ack resource metadata, th... | Check if resource has been initiated in Sagemaker.
A resource is considered to be initiated if the resource ARN is present in the ack resource metadata.
If the resource ARN is present in the ack resource metadata, the resource has been successfully
created in Sagemaker.
Ar... | check_resource_initiation | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def is_update_consumed_by_controller(self):
"""Check if update has been consumed by the controller, in this case it is done by
checking whether
"""
current_resource = self._get_resource()
current_status = current_resource.get("status", None)
## Python == is deep equal bet... | Check if update has been consumed by the controller, in this case it is done by
checking whether
| is_update_consumed_by_controller | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _get_resource(self):
"""Get the custom resource detail similar to: kubectl describe
trainingjob JOB_NAME -n NAMESPACE.
Returns:
None or object: None if the resource doesnt exist in server, otherwise the
custom object.
"""
_api_client = self._get_... | Get the custom resource detail similar to: kubectl describe
trainingjob JOB_NAME -n NAMESPACE.
Returns:
None or object: None if the resource doesnt exist in server, otherwise the
custom object.
| _get_resource | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _create_job_request(
self,
inputs: SageMakerComponentCommonInputs,
outputs: SageMakerComponentBaseOutputs,
) -> Dict:
"""Creates the ACK custom object.
Args:
inputs: A populated list of user inputs.
outputs: An unpopulated list of component output... | Creates the ACK custom object.
Args:
inputs: A populated list of user inputs.
outputs: An unpopulated list of component output variables.
Returns:
dict: A dictionary object representing the custom object.
| _create_job_request | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _create_job_yaml(
self,
inputs: SageMakerComponentCommonInputs,
outputs: SageMakerComponentBaseOutputs,
) -> Dict:
"""Creates the ACK request object to execute the component.
Args:
inputs: A populated list of user inputs.
outputs: An unpopulated l... | Creates the ACK request object to execute the component.
Args:
inputs: A populated list of user inputs.
outputs: An unpopulated list of component output variables.
Returns:
dict: A dictionary object representing the request.
| _create_job_yaml | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _patch_custom_resource(self, custom_resource: dict):
"""Patch a custom resource in ACK
Args:
custom_resource: A dictionary object representing the custom object.
Returns:
dict: The job object that was patched
"""
_api_client = self._get_k8s_api_clie... | Patch a custom resource in ACK
Args:
custom_resource: A dictionary object representing the custom object.
Returns:
dict: The job object that was patched
| _patch_custom_resource | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _wait_resource_consumed_by_controller(
self,
wait_periods,
period_length,
):
"""Wait for the custom resource to be consumed by the controller.
Args:
wait_periods: The number of times to wait for the resource to be consumed.
period_length: The leng... | Wait for the custom resource to be consumed by the controller.
Args:
wait_periods: The number of times to wait for the resource to be consumed.
period_length: The length of time to wait between polling.
| _wait_resource_consumed_by_controller | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _get_resource_exists(self) -> bool:
"""Check if the custom resource exists.
Returns:
bool: True if the resource exists, False otherwise.
"""
try:
return self._get_resource() is not None
except ApiException:
return False | Check if the custom resource exists.
Returns:
bool: True if the resource exists, False otherwise.
| _get_resource_exists | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _create_resource(
self,
cr_spec: object,
wait_periods=6,
period_length=10,
):
"""Create a resource from the spec and wait to be consumed by
controller.
Args:
cr_spec: A dictionary object representing the custom object.
wait_periods... | Create a resource from the spec and wait to be consumed by
controller.
Args:
cr_spec: A dictionary object representing the custom object.
wait_periods: The number of times to wait for the resource to be created.
period_length: The length of time to wait between polli... | _create_resource | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _check_resource_conditions(self):
"""Check the status of the custom resource.
* loop through all conditions
* if recoverable and condition set to true, print out message and return true
(let outside polling loop goes on forever and let user decide if should stop)
... | Check the status of the custom resource.
* loop through all conditions
* if recoverable and condition set to true, print out message and return true
(let outside polling loop goes on forever and let user decide if should stop)
* if terminal and condition set up true, print ou... | _check_resource_conditions | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _delete_custom_resource(self):
"""Delete custom resource from cluster and wait for it to be removed by
the server.
for wait_periods * period_length seconds.
Returns:
response, bool:
response is APIserver response for the operation.
bool is true if... | Delete custom resource from cluster and wait for it to be removed by
the server.
for wait_periods * period_length seconds.
Returns:
response, bool:
response is APIserver response for the operation.
bool is true if resource was removed from the server and fals... | _delete_custom_resource | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def _is_upgrade(self):
"""If the resource already exists the component assumes that the user wants to upgrade
Returns:
Bool: If the resource is being upgraded or not.
Raises:
Exception
"""
try:
resource = self._get_resource()
if res... | If the resource already exists the component assumes that the user wants to upgrade
Returns:
Bool: If the resource is being upgraded or not.
Raises:
Exception
| _is_upgrade | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/sagemaker_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/sagemaker_component.py | Apache-2.0 |
def snake_to_camel(name):
"""Convert snake case to camel case."""
overrides = {
"role_arn": "roleARN",
"execution_role_arn" : "executionRoleARN"
}
if name in overrides:
return overrides[name]
temp = name.split("_")
return temp[0] + "".join(ele.title() for ele in temp[1:]) | Convert snake case to camel case. | snake_to_camel | python | kubeflow/pipelines | components/aws/sagemaker/commonv2/__init__.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/commonv2/__init__.py | Apache-2.0 |
def _create_job_request(
self,
inputs: RoboMakerCreateSimulationAppInputs,
outputs: RoboMakerCreateSimulationAppOutputs,
) -> Dict:
"""
Documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/robomaker.html#RoboMaker.Client.create_simulation_... |
Documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/robomaker.html#RoboMaker.Client.create_simulation_application
| _create_job_request | python | kubeflow/pipelines | components/aws/sagemaker/create_simulation_app/src/robomaker_create_simulation_app_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/create_simulation_app/src/robomaker_create_simulation_app_component.py | Apache-2.0 |
def _create_job_request(
self,
inputs: RoboMakerDeleteSimulationAppInputs,
outputs: RoboMakerDeleteSimulationAppOutputs,
) -> Dict:
"""
Documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/robomaker.html#RoboMaker.Client.delete_simulation_... |
Documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/robomaker.html#RoboMaker.Client.delete_simulation_application
| _create_job_request | python | kubeflow/pipelines | components/aws/sagemaker/delete_simulation_app/src/robomaker_delete_simulation_app_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/delete_simulation_app/src/robomaker_delete_simulation_app_component.py | Apache-2.0 |
def _create_update_endpoint_request(self):
"""Creates an UpdateEndpoint request object.
Returns:
An UpdateEndpoint request object.
"""
### Documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sagemaker.html#SageMaker.Client.update_endpoin... | Creates an UpdateEndpoint request object.
Returns:
An UpdateEndpoint request object.
| _create_update_endpoint_request | python | kubeflow/pipelines | components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | Apache-2.0 |
def _endpoint_name_exists(self, endpoint_name: str):
"""Determine whether an endpoint already exists by a given name.
Args:
endpoint_name: The name of the endpoint to check.
Returns:
True if the endpoint already exists, False otherwise.
"""
try:
... | Determine whether an endpoint already exists by a given name.
Args:
endpoint_name: The name of the endpoint to check.
Returns:
True if the endpoint already exists, False otherwise.
| _endpoint_name_exists | python | kubeflow/pipelines | components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | Apache-2.0 |
def _endpoint_config_name_exists(self, endpoint_config_name: str):
"""Determine whether an endpoint config already exists by a given name.
Args:
endpoint_config_name: The name of the endpoint config to check.
Returns:
True if the endpoint config already exists, False ot... | Determine whether an endpoint config already exists by a given name.
Args:
endpoint_config_name: The name of the endpoint config to check.
Returns:
True if the endpoint config already exists, False otherwise.
| _endpoint_config_name_exists | python | kubeflow/pipelines | components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | Apache-2.0 |
def _get_endpoint_config(self, endpoint_name: str):
"""Gets the name of the current config for a given endpoint.
Args:
endpoint_name: The name of the endpoint whose config to reference.
Returns:
The name of an endpoint configuration currently assigned to the given endpo... | Gets the name of the current config for a given endpoint.
Args:
endpoint_name: The name of the endpoint whose config to reference.
Returns:
The name of an endpoint configuration currently assigned to the given endpoint.
| _get_endpoint_config | python | kubeflow/pipelines | components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | Apache-2.0 |
def _delete_endpoint_config(self, endpoint_config_name: str):
"""Deletes an endpoint config.
Args:
endpoint_config_name: The name of the endpoint config to delete.
Returns:
True if the endpoint was deleted, False otherwise.
"""
try:
self._sm_... | Deletes an endpoint config.
Args:
endpoint_config_name: The name of the endpoint config to delete.
Returns:
True if the endpoint was deleted, False otherwise.
| _delete_endpoint_config | python | kubeflow/pipelines | components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/deploy/src/sagemaker_deploy_component.py | Apache-2.0 |
def _get_labeling_job_outputs(self, auto_labeling):
"""Get labeling job output values.
Args:
auto_labeling: Determines whether to return a active learning model ARN.
Returns:
tuple: (Output manifest S3 URI, active learning model ARN)
"""
### Get and retu... | Get labeling job output values.
Args:
auto_labeling: Determines whether to return a active learning model ARN.
Returns:
tuple: (Output manifest S3 URI, active learning model ARN)
| _get_labeling_job_outputs | python | kubeflow/pipelines | components/aws/sagemaker/ground_truth/src/sagemaker_ground_truth_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/ground_truth/src/sagemaker_ground_truth_component.py | Apache-2.0 |
def _get_best_training_job_and_hyperparameters(self):
"""Gets the best rated training job and accompanying hyperparameters.
Returns:
tuple: (Name of the best training job, training job hyperparameters).
"""
### Get and return best training job and its hyperparameters, withou... | Gets the best rated training job and accompanying hyperparameters.
Returns:
tuple: (Name of the best training job, training job hyperparameters).
| _get_best_training_job_and_hyperparameters | python | kubeflow/pipelines | components/aws/sagemaker/hyperparameter_tuning/src/sagemaker_tuning_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/hyperparameter_tuning/src/sagemaker_tuning_component.py | Apache-2.0 |
def _get_job_outputs(self):
"""Map the S3 outputs of a processing job to a dictionary object.
Returns:
dict: A dictionary of output S3 URIs.
"""
response = self._sm_client.describe_processing_job(
ProcessingJobName=self._processing_job_name
)
outp... | Map the S3 outputs of a processing job to a dictionary object.
Returns:
dict: A dictionary of output S3 URIs.
| _get_job_outputs | python | kubeflow/pipelines | components/aws/sagemaker/process/src/sagemaker_process_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/process/src/sagemaker_process_component.py | Apache-2.0 |
def _get_debug_rule_status(self) -> SageMakerJobStatus:
"""Get the job status of the training debugging rules.
Returns:
SageMakerJobStatus: A status object.
"""
response = self._sm_client.describe_training_job(
TrainingJobName=self._rlestimator_job_name
)... | Get the job status of the training debugging rules.
Returns:
SageMakerJobStatus: A status object.
| _get_debug_rule_status | python | kubeflow/pipelines | components/aws/sagemaker/rlestimator/src/sagemaker_rlestimator_component.py | https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/rlestimator/src/sagemaker_rlestimator_component.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.