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 download_and_join( url1: str='gs://ml-pipeline/sample-data/shakespeare/shakespeare1.txt', url2: str='gs://ml-pipeline/sample-data/shakespeare/shakespeare2.txt' ): """A three-step pipeline with first two running in parallel.""" download1_task = gcs_download_op(url=url1) download2_task = gcs_down...
A three-step pipeline with first two running in parallel.
download_and_join
python
kubeflow/pipelines
samples/core/parallel_join/parallel_join.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/parallel_join/parallel_join.py
Apache-2.0
def generate_resource_request() -> NamedTuple('output', memory=str, cpu=str): '''Returns the memory and cpu request''' resource_output = NamedTuple('output', memory=str, cpu=str) return resource_output('500Mi', '200m')
Returns the memory and cpu request
generate_resource_request
python
kubeflow/pipelines
samples/core/resource_spec/runtime_resource_request.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/resource_spec/runtime_resource_request.py
Apache-2.0
def generate_resource_constraints_request() -> NamedTuple('output', nbr_gpus=str, accelerator=str): """Returns the gpu resource and constraints settings""" output = NamedTuple('output', nbr_gpus=str, accelerator=str) return output('1', 'NVIDIA_TESLA_K80')
Returns the gpu resource and constraints settings
generate_resource_constraints_request
python
kubeflow/pipelines
samples/core/resource_spec/runtime_resource_request_gpu.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/resource_spec/runtime_resource_request_gpu.py
Apache-2.0
def secret_op_pipeline( url:str='gs://ml-pipeline/sample-data/shakespeare/shakespeare1.txt'): """A pipeline that uses secret to access cloud hosted resouces.""" gcs_list_items_task = gcs_list_items_op(url=url) gcs_list_buckets_task = gcs_list_buckets()
A pipeline that uses secret to access cloud hosted resouces.
secret_op_pipeline
python
kubeflow/pipelines
samples/core/secret/secret.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/secret/secret.py
Apache-2.0
def _fill_in_missing(x): """Replace missing values in a SparseTensor. Fills in missing values of `x` with '' or 0, and converts to a dense tensor. Args: x: A `SparseTensor` of rank 2. Its dense shape should have size at most 1 in the second dimension. Returns: A rank 1 tensor where missing val...
Replace missing values in a SparseTensor. Fills in missing values of `x` with '' or 0, and converts to a dense tensor. Args: x: A `SparseTensor` of rank 2. Its dense shape should have size at most 1 in the second dimension. Returns: A rank 1 tensor where missing values of `x` have been filled in...
_fill_in_missing
python
kubeflow/pipelines
samples/core/tfx-oss/utils/taxi_utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/tfx-oss/utils/taxi_utils.py
Apache-2.0
def preprocessing_fn(inputs): """tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations. """ outputs = {} for key in _DENSE_FLOAT_FEATURE_KEYS: # ...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations.
preprocessing_fn
python
kubeflow/pipelines
samples/core/tfx-oss/utils/taxi_utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/tfx-oss/utils/taxi_utils.py
Apache-2.0
def _build_estimator(config, hidden_units=None, warm_start_from=None): """Build an estimator for predicting the tipping behavior of taxi riders. Args: config: tf.estimator.RunConfig defining the runtime environment for the estimator (including model_dir). hidden_units: [int], the layer sizes of the D...
Build an estimator for predicting the tipping behavior of taxi riders. Args: config: tf.estimator.RunConfig defining the runtime environment for the estimator (including model_dir). hidden_units: [int], the layer sizes of the DNN (input layer first) warm_start_from: Optional directory to warm start...
_build_estimator
python
kubeflow/pipelines
samples/core/tfx-oss/utils/taxi_utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/tfx-oss/utils/taxi_utils.py
Apache-2.0
def _example_serving_receiver_fn(tf_transform_output, schema): """Build the serving in inputs. Args: tf_transform_output: A TFTransformOutput. schema: the schema of the input data. Returns: Tensorflow graph which parses examples, applying tf-transform to them. """ raw_feature_spec = _get_raw_fea...
Build the serving in inputs. Args: tf_transform_output: A TFTransformOutput. schema: the schema of the input data. Returns: Tensorflow graph which parses examples, applying tf-transform to them.
_example_serving_receiver_fn
python
kubeflow/pipelines
samples/core/tfx-oss/utils/taxi_utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/tfx-oss/utils/taxi_utils.py
Apache-2.0
def _eval_input_receiver_fn(tf_transform_output, schema): """Build everything needed for the tf-model-analysis to run the model. Args: tf_transform_output: A TFTransformOutput. schema: the schema of the input data. Returns: EvalInputReceiver function, which contains: - Tensorflow graph which p...
Build everything needed for the tf-model-analysis to run the model. Args: tf_transform_output: A TFTransformOutput. schema: the schema of the input data. Returns: EvalInputReceiver function, which contains: - Tensorflow graph which parses raw untransformed features, applies the tf-transf...
_eval_input_receiver_fn
python
kubeflow/pipelines
samples/core/tfx-oss/utils/taxi_utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/tfx-oss/utils/taxi_utils.py
Apache-2.0
def _input_fn(filenames, tf_transform_output, batch_size=200): """Generates features and labels for training or evaluation. Args: filenames: [str] list of CSV files to read data from. tf_transform_output: A TFTransformOutput. batch_size: int First dimension size of the Tensors returned by input_fn R...
Generates features and labels for training or evaluation. Args: filenames: [str] list of CSV files to read data from. tf_transform_output: A TFTransformOutput. batch_size: int First dimension size of the Tensors returned by input_fn Returns: A (features, indices) tuple where features is a dictiona...
_input_fn
python
kubeflow/pipelines
samples/core/tfx-oss/utils/taxi_utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/tfx-oss/utils/taxi_utils.py
Apache-2.0
def trainer_fn(hparams, schema): """Build the estimator using the high level API. Args: hparams: Holds hyperparameters used to train the model as name/value pairs. schema: Holds the schema of the training examples. Returns: A dict of the following: - estimator: The estimator that will be used ...
Build the estimator using the high level API. Args: hparams: Holds hyperparameters used to train the model as name/value pairs. schema: Holds the schema of the training examples. Returns: A dict of the following: - estimator: The estimator that will be used for training and eval. - train_s...
trainer_fn
python
kubeflow/pipelines
samples/core/tfx-oss/utils/taxi_utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/core/tfx-oss/utils/taxi_utils.py
Apache-2.0
def run_pipeline_func(test_cases: list[TestCase]): """Run a pipeline function and wait for its result. :param pipeline_func: pipeline function to run :type pipeline_func: function """ if not test_cases: raise ValueError('No test cases!') def test_wrapper( run_pipeline: Callabl...
Run a pipeline function and wait for its result. :param pipeline_func: pipeline function to run :type pipeline_func: function
run_pipeline_func
python
kubeflow/pipelines
samples/test/utils/kfp/samples/test/utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/test/utils/kfp/samples/test/utils.py
Apache-2.0
def debug_verify(run_id: str, verify_func: Verifier): """Debug a verify function quickly using MLMD data from an existing KFP run ID.""" t = unittest.TestCase() t.maxDiff = None # we always want to see full diff client = KfpMlmdClient() tasks = client.get_tasks(run_id=run_id) pprint(tasks) ...
Debug a verify function quickly using MLMD data from an existing KFP run ID.
debug_verify
python
kubeflow/pipelines
samples/test/utils/kfp/samples/test/utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/test/utils/kfp/samples/test/utils.py
Apache-2.0
def main( pipeline_root: Optional[str] = None, # example experiment: str = 'v2_sample_test_samples', metadata_service_host: Optional[str] = None, metadata_service_port: int = 8080, ): """Test file CLI entrypoint used by Fire. To configure KFP endpoint, configure env ...
Test file CLI entrypoint used by Fire. To configure KFP endpoint, configure env vars following: https://www.kubeflow.org/docs/components/pipelines/user-guides/core-functions/connect-api/#configure-sdk-client-by-environment-variables. KFP UI endpoint can be configured by KF_PIPELINES_UI_ENDPOINT ...
main
python
kubeflow/pipelines
samples/test/utils/kfp/samples/test/utils.py
https://github.com/kubeflow/pipelines/blob/master/samples/test/utils/kfp/samples/test/utils.py
Apache-2.0
def get_random_int_op(minimum: int, maximum: int) -> int: """Generate a random number between minimum and maximum (inclusive).""" import random result = random.randint(minimum, maximum) print(result) return result
Generate a random number between minimum and maximum (inclusive).
get_random_int_op
python
kubeflow/pipelines
samples/tutorials/DSL - Control structures/DSL - Control structures.py
https://github.com/kubeflow/pipelines/blob/master/samples/tutorials/DSL - Control structures/DSL - Control structures.py
Apache-2.0
def pipeline_hello_world(text: str = 'hi there'): """Pipeline that passes small pipeline parameter string to consumer op.""" consume_task = hello_world( text=text) # Passing pipeline parameter as argument to consumer op
Pipeline that passes small pipeline parameter string to consumer op.
pipeline_hello_world
python
kubeflow/pipelines
samples/v2/hello_world.py
https://github.com/kubeflow/pipelines/blob/master/samples/v2/hello_world.py
Apache-2.0
def tearDownClass(cls): """Runs once after all tests in this class.""" print('Cleaning up resources....') for p in PREREQS: delete_k8s_yaml(_KFP_NAMESPACE, p) print('Done clean up.')
Runs once after all tests in this class.
tearDownClass
python
kubeflow/pipelines
samples/v2/sample_test.py
https://github.com/kubeflow/pipelines/blob/master/samples/v2/sample_test.py
Apache-2.0
def compile_( py: str, output: str, function_name: Optional[str] = None, pipeline_parameters: Optional[str] = None, disable_type_check: bool = False, disable_execution_caching_by_default: bool = False, ) -> None: """Compiles a pipeline or component written in a .py file.""" Pipeline._ex...
Compiles a pipeline or component written in a .py file.
compile_
python
kubeflow/pipelines
sdk/python/kfp/cli/compile_.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/compile_.py
Apache-2.0
def __init__( self, context_directory: pathlib.Path, kfp_package_path: Optional[pathlib.Path] = None, component_filepattern: str = '**/*.py', ): """ComponentBuilder builds containerized components. Args: context_directory: Directory containing one or more...
ComponentBuilder builds containerized components. Args: context_directory: Directory containing one or more Python files with one or more KFP v2 components. kfp_package_path: Path to a pip-installable location for KFP. This can either be pointing to KFP SDK r...
__init__
python
kubeflow/pipelines
sdk/python/kfp/cli/component.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/component.py
Apache-2.0
def build(components_directory: str, component_filepattern: str, engine: str, kfp_package_path: Optional[str], overwrite_dockerfile: bool, build_image: bool, platform: str, push_image: bool): """Builds containers for KFP v2 Python-based components.""" if build_image and engine != 'docker': ...
Builds containers for KFP v2 Python-based components.
build
python
kubeflow/pipelines
sdk/python/kfp/cli/component.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/component.py
Apache-2.0
def print_output(resources: list, model_type: ModelType, output_format: str) -> None: """Prints output in tabular or JSON format, using click.echo. Args: resources (list): List of same-type resources to print. output_format (str): One of 'table' or 'json'. Raises: ...
Prints output in tabular or JSON format, using click.echo. Args: resources (list): List of same-type resources to print. output_format (str): One of 'table' or 'json'. Raises: NotImplementedError: If the output format is not one of 'table' or 'json'.
print_output
python
kubeflow/pipelines
sdk/python/kfp/cli/output.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/output.py
Apache-2.0
def print_deleted_text(resource_type: str, resource_id: str, output_format: str) -> None: """Prints a standardized output for deletion actions, using click.echo. Args: resource_type (str): The type of resource (e.g. 'experiment') deleted. resource_id (str): The ID of the ...
Prints a standardized output for deletion actions, using click.echo. Args: resource_type (str): The type of resource (e.g. 'experiment') deleted. resource_id (str): The ID of the resource deleted. output_format (str): The format for the output (one of 'table' or 'json'). Raises: ...
print_deleted_text
python
kubeflow/pipelines
sdk/python/kfp/cli/output.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/output.py
Apache-2.0
def get_version(ctx: click.Context, pipeline_id: str, version_id: str): """Get information about a version of a pipeline.""" client_obj: client.Client = ctx.obj['client'] output_format = ctx.obj['output'] version = client_obj.get_pipeline_version( pipeline_id=pipeline_id, pipeline_version_id=ve...
Get information about a version of a pipeline.
get_version
python
kubeflow/pipelines
sdk/python/kfp/cli/pipeline.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/pipeline.py
Apache-2.0
def get_dev_env_configuration( configuration: Commands, human_readable: bool = False) -> utility.ExecutorResponse: """Captures the specified environment configuration. Captures the developement environment configuration including PIP version and Phython version as specifeid by configuration...
Captures the specified environment configuration. Captures the developement environment configuration including PIP version and Phython version as specifeid by configuration Args: configuration: Commands for specific information to be retrieved - PIP3LIST: captures pip3 freeze results ...
get_dev_env_configuration
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/dev_env.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/dev_env.py
Apache-2.0
def execute_gcloud_command( gcloud_command_list: List[Text], project_id: Optional[Text] = None, human_readable: Optional[bool] = False) -> utility.ExecutorResponse: """Function for invoking gcloud command. Args: gcloud_command_list: a command string list to be past to gcloud examp...
Function for invoking gcloud command. Args: gcloud_command_list: a command string list to be past to gcloud example format is ['config', 'list', '--all'] project_id: specificies the project to run the commands against if not provided provided will use gcloud default project if one is co...
execute_gcloud_command
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/gcp.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/gcp.py
Apache-2.0
def execute_gsutil_command( gsutil_command_list: List[Text], project_id: Optional[Text] = None) -> utility.ExecutorResponse: """Function for invoking gsutil command. This function takes in a gsutil parameter list and returns the results as a list of dictionaries. Args: gsutil_comm...
Function for invoking gsutil command. This function takes in a gsutil parameter list and returns the results as a list of dictionaries. Args: gsutil_command_list: a command string list to be past to gsutil example format is ['config', 'list', '--all'] project_id: specific project to che...
execute_gsutil_command
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/gcp.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/gcp.py
Apache-2.0
def get_gcp_configuration( configuration: Commands, project_id: Optional[Text] = None, human_readable: Optional[bool] = False) -> utility.ExecutorResponse: """Captures the specified environment configuration. Captures the environment configuration for the specified setting such as N...
Captures the specified environment configuration. Captures the environment configuration for the specified setting such as NETWORKSing configuration, project QUOTASs, etc. Args: configuration: Commands for specific information to be retrieved - APIS: Captures a complete list of enabled APIS...
get_gcp_configuration
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/gcp.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/gcp.py
Apache-2.0
def execute_kubectl_command( kubectl_command_list: List[Text], human_readable: bool = False) -> utility.ExecutorResponse: """Invokes the kubectl command. Args: kubectl_command_list: a command string list to be past to kubectl example format is ['config', 'view'] human_reada...
Invokes the kubectl command. Args: kubectl_command_list: a command string list to be past to kubectl example format is ['config', 'view'] human_readable: If false sets parameter -o json for all calls, otherwie output will be in human readable format. Returns: utility.Executo...
execute_kubectl_command
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/kubernetes_cluster.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/kubernetes_cluster.py
Apache-2.0
def get_kubectl_configuration( configuration: Commands, kubernetes_context: Text = None, namespace: Text = None, human_readable: bool = False) -> utility.ExecutorResponse: """Captures the specified environment configuration. Captures the environment state for the specified setti...
Captures the specified environment configuration. Captures the environment state for the specified setting such as current context, active pods, etc and returns it in as a dictionary format. if no context is specified the system will use the current_context or error out of none is specified. Args:...
get_kubectl_configuration
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/kubernetes_cluster.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/kubernetes_cluster.py
Apache-2.0
def execute_command(self, command_list: List[Text]): """Executes the command in command_list. sets values for _stdout, _stderr, and _returncode accordingly. TODO(): This method is kept in ExecutorResponse for simplicity, however this deviates from MVP design pattern. It should be facto...
Executes the command in command_list. sets values for _stdout, _stderr, and _returncode accordingly. TODO(): This method is kept in ExecutorResponse for simplicity, however this deviates from MVP design pattern. It should be factored out in future. Args: command_list: A List...
execute_command
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/utility.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/utility.py
Apache-2.0
def _parse_raw_input(self): """Parses the raw input and popluates _json and _parsed properies.""" try: self._parsed_output = json.loads(self._stdout) self._json = self._stdout except json.JSONDecodeError: self._json = json.dumps(self._stdout) self....
Parses the raw input and popluates _json and _parsed properies.
_parse_raw_input
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/utility.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/utility.py
Apache-2.0
def test_execute_command_oserror(self): """Testing stdout and stderr is correctly captured upon OSError.""" response = utility.ExecutorResponse() err_msg = 'Testing handling of OSError' with patch('subprocess.run') as mock_run: mock_run.side_effect = MagicMock(side_effect=OS...
Testing stdout and stderr is correctly captured upon OSError.
test_execute_command_oserror
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/utility_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/utility_test.py
Apache-2.0
def test_execute_command_stdout(self): """Testing stdout output is correctly captured.""" test_string = 'test string' response = utility.ExecutorResponse() response.execute_command(['echo', test_string]) self.assertEqual(response._stdout, test_string + '\n') self.assertE...
Testing stdout output is correctly captured.
test_execute_command_stdout
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/utility_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/utility_test.py
Apache-2.0
def test_execute_command_stderr(self): """Testing stderr output is correctly captured.""" response = utility.ExecutorResponse() response.execute_command(['ls', 'not_a_real_dir']) self.assertEqual(response._stdout, '') self.assertIn('No such file', response._stderr)
Testing stderr output is correctly captured.
test_execute_command_stderr
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/utility_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/utility_test.py
Apache-2.0
def test_parse_raw_input_json(self): """Testing json stdout is correctly parsed.""" response = utility.ExecutorResponse() response._stdout = '{"key":"value"}' response._parse_raw_input() self.assertEqual(response._json, '{"key":"value"}') self.assertEqual(response._parse...
Testing json stdout is correctly parsed.
test_parse_raw_input_json
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/utility_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/utility_test.py
Apache-2.0
def test_parse_raw_input_text(self): """Testing non-json stdout is correctly parsed.""" response = utility.ExecutorResponse() response._stdout = 'non-json string' response._parse_raw_input() self.assertEqual(response._json, '"non-json string"') self.assertEqual(response....
Testing non-json stdout is correctly parsed.
test_parse_raw_input_text
python
kubeflow/pipelines
sdk/python/kfp/cli/diagnose_me/utility_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/diagnose_me/utility_test.py
Apache-2.0
def deprecated_alias_group_factory( deprecated_map: Dict[str, str]) -> 'DeprecatedAliasGroup': # type: ignore """Closure that returns a class that implements the deprecated alias group. Args: deprecated_map (Dict[str, str]): Dictionary mapping old deprecated names ...
Closure that returns a class that implements the deprecated alias group. Args: deprecated_map (Dict[str, str]): Dictionary mapping old deprecated names to new names. Returns: DeprecatedAliasGroup: A class that implements the deprecated alias group.
deprecated_alias_group_factory
python
kubeflow/pipelines
sdk/python/kfp/cli/utils/deprecated_alias_group.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/utils/deprecated_alias_group.py
Apache-2.0
def get_param_descr(fn: Callable, param_name: str) -> str: """Extracts the description of a parameter from the docstring of a function or method. Docstring must conform to Google Style (https://sphinxcontrib- napoleon.readthedocs.io/en/latest/example_google.html). Args: fn (Callable): The funct...
Extracts the description of a parameter from the docstring of a function or method. Docstring must conform to Google Style (https://sphinxcontrib- napoleon.readthedocs.io/en/latest/example_google.html). Args: fn (Callable): The function of method with a __doc__ docstring implemented. param_...
get_param_descr
python
kubeflow/pipelines
sdk/python/kfp/cli/utils/parsing.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/utils/parsing.py
Apache-2.0
def __init__(self, a: str, b: str): """Class init. Args: a (str): String a. b (str): String b. """ self.a = a self.b = b
Class init. Args: a (str): String a. b (str): String b.
__init__
python
kubeflow/pipelines
sdk/python/kfp/cli/utils/parsing_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/cli/utils/parsing_test.py
Apache-2.0
def get_gcp_access_token() -> Optional[str]: """Gets GCP access token for the current Application Default Credentials. Returns: GCP access token or None, if it is not set. For more information, see https://cloud.google.com/sdk/gcloud/reference/auth/application-default/print-access-token. """ ...
Gets GCP access token for the current Application Default Credentials. Returns: GCP access token or None, if it is not set. For more information, see https://cloud.google.com/sdk/gcloud/reference/auth/application-default/print-access-token.
get_gcp_access_token
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_auth_token(client_id: str, other_client_id: str, other_client_secret: str) -> Tuple[Optional[str], bool]: """Gets auth token from default service account or user account. Returns: Tuple of (ID token or None, if not found, and a boolean indicating whether a refresh tok...
Gets auth token from default service account or user account. Returns: Tuple of (ID token or None, if not found, and a boolean indicating whether a refresh token has been saved locally)
get_auth_token
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_auth_token_from_sa(client_id: str) -> Optional[str]: """Gets auth token from default service account. Returns: Authorization token or None, if not found. """ service_account_credentials = get_service_account_credentials(client_id) if service_account_credentials: return get_g...
Gets auth token from default service account. Returns: Authorization token or None, if not found.
get_auth_token_from_sa
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_service_account_credentials( client_id: str) -> Optional[google.oauth2.service_account.Credentials]: """Figure out what environment we're running in and get some preliminary information about the service account. Args: client_id: OAuth client ID. Returns: OAuth2 credent...
Figure out what environment we're running in and get some preliminary information about the service account. Args: client_id: OAuth client ID. Returns: OAuth2 credentials or None.
get_service_account_credentials
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_google_open_id_connect_token( service_account_credentials: google.oauth2.service_account.Credentials ) -> str: """Gets an OpenID Connect token issued by Google for the service account. This function: 1. Generates a JWT signed with the service account's private key containing a specia...
Gets an OpenID Connect token issued by Google for the service account. This function: 1. Generates a JWT signed with the service account's private key containing a special "target_audience" claim. 2. Sends it to the OAUTH_TOKEN_URI endpoint. Because the JWT in #1 has a target_audience...
get_google_open_id_connect_token
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_refresh_token_from_client_id(client_id: str, client_secret: str) -> Tuple[str, bool]: """Obtains the ID token for provided Client ID with user accounts. Flow: get authorization code -> exchange for refresh token -> obtain and return ID token. Args: c...
Obtains the ID token for provided Client ID with user accounts. Flow: get authorization code -> exchange for refresh token -> obtain and return ID token. Args: client_id: OAuth client ID. client_secret: OAuth client secret. See https://console.cloud.google.com/apis/credentials. ...
get_refresh_token_from_client_id
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_auth_code(client_id: str) -> Tuple[str, str]: """Retrieves authorization token using Loopback flow. Args: client_id: OAuth client ID. To retrieve it, visit https://console.cloud.google.com/apis/credentials. Returns: A tuple of (authorization token, redirect_uri parameter)...
Retrieves authorization token using Loopback flow. Args: client_id: OAuth client ID. To retrieve it, visit https://console.cloud.google.com/apis/credentials. Returns: A tuple of (authorization token, redirect_uri parameter). Raises: ValueError: If the provided authorizat...
get_auth_code
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_auth_response_ssh(host: str, port: int, auth_url: str) -> str: """Fetches OAuth authorization response URL for remote SSH connection. Args: host: Hostname in redirect_uri. port: Port in redirect_uri. auth_url: OAuth request URL. Returns: A URL containing authorizati...
Fetches OAuth authorization response URL for remote SSH connection. Args: host: Hostname in redirect_uri. port: Port in redirect_uri. auth_url: OAuth request URL. Returns: A URL containing authorization code.
get_auth_response_ssh
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_auth_response_local(host: str, port: int, auth_url: str) -> Optional[str]: """Fetches OAuth authorization response URL using a local web-server. Args: host: Hostname of the server. port: Port of the server. auth_url: OAuth request URL. Returns: ...
Fetches OAuth authorization response URL using a local web-server. Args: host: Hostname of the server. port: Port of the server. auth_url: OAuth request URL. Returns: A URL containing authorization code.
get_auth_response_local
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_refresh_token_from_code(auth_code: str, client_id: str, client_secret: str, redirect_uri: str) -> Tuple[str, bool]: """Returns refresh or access token from authorization code. Args: auth_code: OAuth authorization code. clie...
Returns refresh or access token from authorization code. Args: auth_code: OAuth authorization code. client_id: OAuth client ID. client_secret: OAuth client secret. redirect_uri: Redirect uri used to obtain auth_code. Returns: Tuple of (OAuth short-lived access token or ...
get_refresh_token_from_code
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def id_token_from_refresh_token(client_id: str, client_secret: str, refresh_token: str, audience: str) -> str: """Returns ID token from refresh token. Args: client_id: OAuth client ID. client_secret: OAuth client secret. refresh_token: OAuth refresh token...
Returns ID token from refresh token. Args: client_id: OAuth client ID. client_secret: OAuth client secret. refresh_token: OAuth refresh token. audience: OAuth audience. Returns: OAuth ID token. Raises: ValueError: If HTTP request returns a reque...
id_token_from_refresh_token
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def __init__(self, success_message: str) -> None: """ Args: success_message: The message to display in the web browser the authorization flow is complete. """ self.last_request_uri = None self._success_message = success_message
Args: success_message: The message to display in the web browser the authorization flow is complete.
__init__
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def __call__( self, environ: Dict[str, Any], start_response: Callable[[str, list], Callable[..., None]] ) -> Iterable[bytes]: """WSGI Callable. Updates environment...
WSGI Callable. Updates environment dictionary with parameters required for WSGI and returns it. Args: environ: The WSGI environment. start_response: The WSGI start_response callable. Returns: The response body.
__call__
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def get_local_server_app( host: str, port: int ) -> Generator[Tuple[wsgiref.simple_server.WSGIServer, RedirectWSGIApp], None, None]: """Creates a local web-server for given host and port. Args: host: Hostname of the server. port: Port of the server. Returns: Tupl...
Creates a local web-server for given host and port. Args: host: Hostname of the server. port: Port of the server. Returns: Tuple of (a local server instance, WSGI app that handles the authorization redirect).
get_local_server_app
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def fetch_auth_token_from_response(url: str) -> str: """Fetches authorization code for OAuth2.0 Loopback flow. Args: url: A string containing the response URL. Returns: An access code. Raises: KeyError: If no authorization code is found in the provided url. """ parsed_...
Fetches authorization code for OAuth2.0 Loopback flow. Args: url: A string containing the response URL. Returns: An access code. Raises: KeyError: If no authorization code is found in the provided url.
fetch_auth_token_from_response
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def is_ipython() -> bool: """Returns whether we are running in notebook.""" try: import IPython ipy = IPython.get_ipython() if ipy is None: return False except ImportError: return False return True
Returns whether we are running in notebook.
is_ipython
python
kubeflow/pipelines
sdk/python/kfp/client/auth.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/auth.py
Apache-2.0
def __init__( self, host: Optional[str] = None, client_id: Optional[str] = None, namespace: str = 'kubeflow', other_client_id: Optional[str] = None, other_client_secret: Optional[str] = None, existing_token: Optional[str] = None, cookies: Optional[str] = N...
Create a new instance of kfp client.
__init__
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def _refresh_api_client_token(self) -> None: """Refreshes the existing token associated with the kfp_api_client.""" if getattr(self, '_is_refresh_token', None): return new_token = auth.get_gcp_access_token() self._existing_config.api_key['authorization'] = new_token
Refreshes the existing token associated with the kfp_api_client.
_refresh_api_client_token
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def _get_config_with_default_credentials( self, config: kfp_server_api.Configuration ) -> kfp_server_api.Configuration: """Apply default credentials to the configuration object. This method accepts a Configuration object and extends it with some default credentials interface. ...
Apply default credentials to the configuration object. This method accepts a Configuration object and extends it with some default credentials interface.
_get_config_with_default_credentials
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def set_user_namespace(self, namespace: str) -> None: """Sets the namespace in the Kuberenetes cluster to use. This function should only be used when Kubeflow Pipelines is in the multi-user mode. Args: namespace: Namespace to use within the Kubernetes cluster (namespace con...
Sets the namespace in the Kuberenetes cluster to use. This function should only be used when Kubeflow Pipelines is in the multi-user mode. Args: namespace: Namespace to use within the Kubernetes cluster (namespace containing the Kubeflow Pipelines deployment).
set_user_namespace
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def get_kfp_healthz( self, sleep_duration: int = 5, ) -> kfp_server_api.V2beta1GetHealthzResponse: """Gets healthz info for KFP deployment. Args: sleep_duration: Time in seconds between retries. Returns: JSON response from the healthz endpoint. ...
Gets healthz info for KFP deployment. Args: sleep_duration: Time in seconds between retries. Returns: JSON response from the healthz endpoint.
get_kfp_healthz
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def create_experiment( self, name: str, description: str = None, namespace: str = None, ) -> kfp_server_api.V2beta1Experiment: """Creates a new experiment. Args: name: Name of the experiment. description: Description of the experiment. ...
Creates a new experiment. Args: name: Name of the experiment. description: Description of the experiment. namespace: Kubernetes namespace to use. Used for multi-user deployments. For single-user deployments, this should be left as ``None``. Returns: ``V2...
create_experiment
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def get_pipeline_id(self, name: str) -> Optional[str]: """Gets the ID of a pipeline by its name. Args: name: Pipeline name. Returns: The pipeline ID if a pipeline with the name exists. """ pipeline_filter = json.dumps({ 'predicates': [{ ...
Gets the ID of a pipeline by its name. Args: name: Pipeline name. Returns: The pipeline ID if a pipeline with the name exists.
get_pipeline_id
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def list_experiments( self, page_token: str = '', page_size: int = 10, sort_by: str = '', namespace: Optional[str] = None, filter: Optional[str] = None, ) -> kfp_server_api.V2beta1ListExperimentsResponse: """Lists experiments. Args: page_t...
Lists experiments. Args: page_token: Page token for obtaining page from paginated response. page_size: Size of the page. sort_by: Sort string of format ``'[field_name]', '[field_name] desc'``. For example, ``'display_name desc'``. namespace: Kubernetes namespace ...
list_experiments
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def get_experiment( self, experiment_id: Optional[str] = None, experiment_name: Optional[str] = None, namespace: Optional[str] = None, ) -> kfp_server_api.V2beta1Experiment: """Gets details of an experiment. Either ``experiment_id`` or ``experiment_name`` is required...
Gets details of an experiment. Either ``experiment_id`` or ``experiment_name`` is required. Args: experiment_id: ID of the experiment. experiment_name: Name of the experiment. namespace: Kubernetes namespace to use. Used for multi-user deployments. F...
get_experiment
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def list_pipelines( self, page_token: str = '', page_size: int = 10, sort_by: str = '', filter: Optional[str] = None, namespace: Optional[str] = None, ) -> kfp_server_api.V2beta1ListPipelinesResponse: """Lists pipelines. Args: page_token: ...
Lists pipelines. Args: page_token: Page token for obtaining page from paginated response. page_size: Size of the page. sort_by: Sort string of format ``'[field_name]', '[field_name] desc'``. For example, ``'display_name desc'``. filter: A url-encoded, JSON-serial...
list_pipelines
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def run_pipeline( self, experiment_id: str, job_name: str, pipeline_package_path: Optional[str] = None, params: Optional[Dict[str, Any]] = None, pipeline_id: Optional[str] = None, version_id: Optional[str] = None, pipeline_root: Optional[str] = None, ...
Runs a specified pipeline. Args: experiment_id: ID of an experiment. job_name: Name of the job. pipeline_package_path: Local path of the pipeline package (the filename should end with one of the following .tar.gz, .tgz, .zip, .json). ...
run_pipeline
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def create_recurring_run( self, experiment_id: str, job_name: str, description: Optional[str] = None, start_time: Optional[str] = None, end_time: Optional[str] = None, interval_second: Optional[int] = None, cron_expression: Optional[str] = None, ma...
Creates a recurring run. Args: experiment_id: ID of the experiment. job_name: Name of the job. description: Description of the job. start_time: RFC3339 time string of the time when to start the job. end_time: RFC3339 time string of the...
create_recurring_run
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def _create_job_config( self, params: Optional[Dict[str, Any]], pipeline_package_path: Optional[str], pipeline_id: Optional[str], version_id: Optional[str], enable_caching: Optional[bool], cache_key: Optional[str], pipeline_root: Optional[str], ) -> _J...
Creates a JobConfig with spec and resource_references. Args: pipeline_package_path: Local path of the pipeline package (the filename should end with one of the following .tar.gz, .tgz, .zip, .yaml, .yml). params: A dictionary with key as param name and va...
_create_job_config
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def delete_job(self, job_id: str) -> dict: """Deletes a job (recurring run). Args: job_id: ID of the job. Returns: Empty dictionary. """ warnings.warn( '`delete_job` is deprecated. Please use `delete_recurring_run` instead.' f'\nR...
Deletes a job (recurring run). Args: job_id: ID of the job. Returns: Empty dictionary.
delete_job
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def disable_job(self, job_id: str) -> dict: """Disables a job (recurring run). Args: job_id: ID of the job. Returns: Empty dictionary. """ warnings.warn( '`disable_job` is deprecated. Please use `disable_recurring_run` instead.' f...
Disables a job (recurring run). Args: job_id: ID of the job. Returns: Empty dictionary.
disable_job
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def enable_job(self, job_id: str) -> dict: """Enables a job (recurring run). Args: job_id: ID of the job. Returns: Empty dictionary. """ warnings.warn( '`enable_job` is deprecated. Please use `enable_recurring_run` instead.' f'\nR...
Enables a job (recurring run). Args: job_id: ID of the job. Returns: Empty dictionary.
enable_job
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def list_runs( self, page_token: str = '', page_size: int = 10, sort_by: str = '', experiment_id: Optional[str] = None, namespace: Optional[str] = None, filter: Optional[str] = None, ) -> kfp_server_api.V2beta1ListRunsResponse: """List runs. A...
List runs. Args: page_token: Page token for obtaining page from paginated response. page_size: Size of the page. sort_by: Sort string of format ``'[field_name]', '[field_name] desc'``. For example, ``'display_name desc'``. experiment_id: Experiment ID to filter u...
list_runs
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def list_recurring_runs( self, page_token: str = '', page_size: int = 10, sort_by: str = '', experiment_id: Optional[str] = None, namespace: Optional[str] = None, filter: Optional[str] = None, ) -> kfp_server_api.V2beta1ListRecurringRunsResponse: """Li...
Lists recurring runs. Args: page_token: Page token for obtaining page from paginated response. page_size: Size of the page. sort_by: Sort string of format ``'[field_name]', '[field_name] desc'``. For example, ``'display_name desc'``. experiment_id: Experiment ID ...
list_recurring_runs
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def get_recurring_run( self, recurring_run_id: str, job_id: Optional[str] = None, ) -> kfp_server_api.V2beta1RecurringRun: """Gets recurring run details. Args: recurring_run_id: ID of the recurring run. job_id: Deprecated. Use `recurring_run_id` inste...
Gets recurring run details. Args: recurring_run_id: ID of the recurring run. job_id: Deprecated. Use `recurring_run_id` instead. Returns: ``V2beta1RecurringRun`` object.
get_recurring_run
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def wait_for_run_completion( self, run_id: str, timeout: int, sleep_duration: int = 5, ) -> kfp_server_api.V2beta1Run: """Waits for a run to complete. Args: run_id: ID of the run. timeout: Timeout after which the client should stop waiting for...
Waits for a run to complete. Args: run_id: ID of the run. timeout: Timeout after which the client should stop waiting for run completion (seconds). sleep_duration: Time in seconds between retries. Returns: ``V2beta1Run`` object.
wait_for_run_completion
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def upload_pipeline( self, pipeline_package_path: str, pipeline_name: Optional[str] = None, description: Optional[str] = None, namespace: Optional[str] = None, ) -> kfp_server_api.V2beta1Pipeline: """Uploads a pipeline. Args: pipeline_package_path...
Uploads a pipeline. Args: pipeline_package_path: Local path to the pipeline package. pipeline_name: Name of the pipeline to be shown in the UI. description: Description of the pipeline to be shown in the UI. namespace: Optional. Kubernetes namespace where the pip...
upload_pipeline
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def upload_pipeline_from_pipeline_func( self, pipeline_func: base_component.BaseComponent, pipeline_name: Optional[str] = None, description: Optional[str] = None, namespace: Optional[str] = None, ) -> kfp_server_api.V2beta1Pipeline: """Uploads a pipeline from a pipeli...
Uploads a pipeline from a pipeline_func. Args: pipeline_func: Pipeline function constructed with ``@kfp.dsl.pipeline`` decorator. pipeline_name: Name of the pipeline to be shown in the UI. description: Description of the pipeline to be shown in the UI. namespace:...
upload_pipeline_from_pipeline_func
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def upload_pipeline_version( self, pipeline_package_path: str, pipeline_version_name: str, pipeline_id: Optional[str] = None, pipeline_name: Optional[str] = None, description: Optional[str] = None, ) -> kfp_server_api.V2beta1PipelineVersion: """Uploads a new v...
Uploads a new version of the pipeline. Args: pipeline_package_path: Local path to the pipeline package. pipeline_version_name: Name of the pipeline version to be shown in the UI. pipeline_id: ID of the pipeline. pipeline_name: Name of the pipelin...
upload_pipeline_version
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def upload_pipeline_version_from_pipeline_func( self, pipeline_func: base_component.BaseComponent, pipeline_version_name: str, pipeline_id: Optional[str] = None, pipeline_name: Optional[str] = None, description: Optional[str] = None, ) -> kfp_server_api.V2beta1Pipelin...
Uploads a new version of the pipeline. Args: pipeline_func: Pipeline function constructed with ``@kfp.dsl.pipeline`` decorator. pipeline_version_name: Name of the pipeline version to be shown in the UI. pipeline_id: ID of the pipeline. pipeline_n...
upload_pipeline_version_from_pipeline_func
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def list_pipeline_versions( self, pipeline_id: str, page_token: str = '', page_size: int = 10, sort_by: str = '', filter: Optional[str] = None, ) -> kfp_server_api.V2beta1ListPipelineVersionsResponse: """Lists pipeline versions. Args: pipe...
Lists pipeline versions. Args: pipeline_id: ID of the pipeline for which to list versions. page_token: Page token for obtaining page from paginated response. page_size: Size of the page. sort_by: Sort string of format ``'[field_name]', '[field_name] desc'``. For ...
list_pipeline_versions
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def get_pipeline_version( self, pipeline_id: str, pipeline_version_id: str, ) -> kfp_server_api.V2beta1PipelineVersion: """Gets a pipeline version. Args: pipeline_id: ID of the pipeline. pipeline_version_id: ID of the pipeline version. Return...
Gets a pipeline version. Args: pipeline_id: ID of the pipeline. pipeline_version_id: ID of the pipeline version. Returns: ``V2beta1PipelineVersion`` object.
get_pipeline_version
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def delete_pipeline_version( self, pipeline_id: str, pipeline_version_id: str, ) -> dict: """Deletes a pipeline version.p. Args: pipeline_id: ID of the pipeline. pipeline_version_id: ID of the pipeline version. Returns: Empty dict...
Deletes a pipeline version.p. Args: pipeline_id: ID of the pipeline. pipeline_version_id: ID of the pipeline version. Returns: Empty dictionary.
delete_pipeline_version
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def _add_generated_apis( target_struct: Any, api_module: ModuleType, api_client: kfp_server_api.ApiClient, ) -> None: """Initializes a hierarchical API object based on the generated API module. PipelineServiceApi.create_pipeline becomes target_struct.pipelines.create_pipeline """ Struct...
Initializes a hierarchical API object based on the generated API module. PipelineServiceApi.create_pipeline becomes target_struct.pipelines.create_pipeline
_add_generated_apis
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def _override_caching_options( pipeline_spec: pipeline_spec_pb2.PipelineSpec, enable_caching: bool, cache_key: Optional[str] = None, ) -> None: """Overrides caching options. Args: pipeline_spec: The PipelineSpec object to update in-place. enable_caching: Overrides options, one of Tr...
Overrides caching options. Args: pipeline_spec: The PipelineSpec object to update in-place. enable_caching: Overrides options, one of True, False. cache_key: Overrides cache_key, default None, no-op.
_override_caching_options
python
kubeflow/pipelines
sdk/python/kfp/client/client.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/client.py
Apache-2.0
def __init__(self, path: Optional[str] = None) -> None: """Constructs ServiceAccountTokenVolumeCredentials. Args: path (Optional[str], optional): Path of file containing auth token. Defaults to None. """ self._token_path = ( path or os.getenv(client.KF_PIPELINES_...
Constructs ServiceAccountTokenVolumeCredentials. Args: path (Optional[str], optional): Path of file containing auth token. Defaults to None.
__init__
python
kubeflow/pipelines
sdk/python/kfp/client/set_volume_credentials.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/set_volume_credentials.py
Apache-2.0
def _get_token(self) -> str: """Reads the token found in file provided as `path` argument to ServiceAccountTokenVolumeCredentials constructor. Returns: str: The token. """ token = None try: token = token_credentials_base.read_token_from_file( ...
Reads the token found in file provided as `path` argument to ServiceAccountTokenVolumeCredentials constructor. Returns: str: The token.
_get_token
python
kubeflow/pipelines
sdk/python/kfp/client/set_volume_credentials.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/set_volume_credentials.py
Apache-2.0
def read_token_from_file(path: Optional[str] = None) -> str: """Reads a token found in some file. Args: path (Optional[str], optional): Path of file containing auth token. Defaults to None. Returns: str: The token. """ token = None with open(path) as f: token = f.read()...
Reads a token found in some file. Args: path (Optional[str], optional): Path of file containing auth token. Defaults to None. Returns: str: The token.
read_token_from_file
python
kubeflow/pipelines
sdk/python/kfp/client/token_credentials_base.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/client/token_credentials_base.py
Apache-2.0
def compile( self, pipeline_func: base_component.BaseComponent, package_path: str, pipeline_name: Optional[str] = None, pipeline_parameters: Optional[Dict[str, Any]] = None, type_check: bool = True, ) -> None: """Compiles the pipeline or component function int...
Compiles the pipeline or component function into IR YAML. Args: pipeline_func: Pipeline function constructed with the ``@dsl.pipeline`` or component constructed with the ``@dsl.component`` decorator. package_path: Output YAML file path. For example, ``'~/my_pipeline.yaml'`` or ``'~/my_c...
compile
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler.py
Apache-2.0
def test_compile_pipeline_with_caching_enabled(self): """Test pipeline compilation with caching enabled.""" @dsl.component def my_component(): pass @dsl.pipeline(name='tiny-pipeline') def my_pipeline(): my_task = my_component() my_task.set_ca...
Test pipeline compilation with caching enabled.
test_compile_pipeline_with_caching_enabled
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def test_compile_pipeline_with_cache_key(self): """Test pipeline compilation with cache key.""" @dsl.component def my_component(): pass @dsl.pipeline(name='tiny-pipeline') def my_pipeline(): my_task = my_component() my_task.set_caching_option...
Test pipeline compilation with cache key.
test_compile_pipeline_with_cache_key
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def test_compile_pipeline_with_caching_disabled(self): """Test pipeline compilation with caching disabled.""" @dsl.component def my_component(): pass @dsl.pipeline(name='tiny-pipeline') def my_pipeline(): my_task = my_component() my_task.set_...
Test pipeline compilation with caching disabled.
test_compile_pipeline_with_caching_disabled
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def pipeline_with_description(sample_input1: bool = True, sample_input2: str = 'string') -> str: """This is a description of this pipeline.""" op1 = my_comp(string=sample_input2, model=sample_input1) result = op1.output return result
This is a description of this pipeline.
pipeline_with_description
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def my_pipeline(sample_input1: bool = True, sample_input2: str = 'string') -> str: """This is a definition of this pipeline.""" op1 = my_comp(string=sample_input2, model=sample_input1) result = op1.output return result
This is a definition of this pipeline.
my_pipeline
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def output_model(metrics: Output[Model]): """Dummy component that outputs metrics with a random accuracy.""" import random result = random.randint(0, 100) metrics.log_metric('accuracy', result)
Dummy component that outputs metrics with a random accuracy.
output_model
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def pipeline_with_multiline_definition( sample_input1: bool = True, sample_input2: str = 'string') -> str: """docstring short description. docstring long description. docstring long description. """ op1 = my_comp(string=sample_input2, model...
docstring short description. docstring long description. docstring long description.
pipeline_with_multiline_definition
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def pipeline_with_multiline_definition( sample_input1: bool = True, sample_input2: str = 'string') -> str: """ docstring long description. docstring long description. docstring long description. """ op1 = my_comp(str...
docstring long description. docstring long description. docstring long description.
pipeline_with_multiline_definition
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def my_pipeline(sample_input1: bool = True, sample_input2: str = 'string') -> str: """docstring short description. docstring long description. docstring long description. """ op1 = my_comp(string=sample_input2, model=sample_input1) ...
docstring short description. docstring long description. docstring long description.
my_pipeline
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def test_pipeline_with_workspace_config(self): """Test that pipeline config correctly sets the workspace field.""" config = PipelineConfig( workspace=WorkspaceConfig( size='10Gi', kubernetes=KubernetesWorkspaceConfig( pvcSpecPatch={'accessM...
Test that pipeline config correctly sets the workspace field.
test_pipeline_with_workspace_config
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def comp( string: str, in_artifact: Input[Artifact], out_artifact: Output[Artifact], ) -> str: """Component description. Args: string: Component input string. in_artifact: Component input artifact. Returns:...
Component description. Args: string: Component input string. in_artifact: Component input artifact. Returns: Output: Component output string. out_artifact: Component output artifact.
comp
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0
def my_pipeline( string: str, in_artifact: Input[Artifact], ) -> Outputs: """Pipeline description. Args: string: Pipeline input string. in_artifact: Pipeline input artifact. Returns: out_str: Pipeline o...
Pipeline description. Args: string: Pipeline input string. in_artifact: Pipeline input artifact. Returns: out_str: Pipeline output string. out_artifact: Pipeline output artifact.
my_pipeline
python
kubeflow/pipelines
sdk/python/kfp/compiler/compiler_test.py
https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/compiler/compiler_test.py
Apache-2.0