def test_multiline(self): host_descr = parsing.get_param_descr(client.Client, 'host') self.assertEqual( host_descr, "The host name to use to talk to Kubeflow Pipelines. If not set, the in-cluster service DNS name will be used, which only works if the current environment is a pod in the same cluster (such as a Jupyter instance spawned by Kubeflow's JupyterHub). Set the host based on https://www.kubeflow.org/docs/components/pipelines/sdk/connect-api/" )
def test_function_without_type_info(self): def fn(a: str, b: str): """My fn. Args: a: String a. b: String b. Returns: str: Concat str. """ return a + b a_descr = parsing.get_param_descr(fn, 'a') self.assertEqual(a_descr, 'String a.') b_descr = parsing.get_param_descr(fn, 'b') self.assertEqual(b_descr, 'String b.')
def test_class(self): class_doc_a = parsing.get_param_descr(MyClass, 'a') self.assertEqual(class_doc_a, 'String a.') class_doc_b = parsing.get_param_descr(MyClass, 'b') self.assertEqual(class_doc_b, 'String b.') init_a = parsing.get_param_descr(MyClass.__init__, 'a') self.assertEqual(init_a, 'String a.') init_b = parsing.get_param_descr(MyClass.__init__, 'b') self.assertEqual(init_b, 'String b.') method_a = parsing.get_param_descr(MyClass.method, 'a') self.assertEqual(method_a, 'String a.') method_b = parsing.get_param_descr(MyClass.method, 'b') self.assertEqual(method_b, 'String b.')
def test_instance(self): instance = MyClass('a', 'b') inst_doc_a = parsing.get_param_descr(instance, 'a') self.assertEqual(inst_doc_a, 'String a.') inst_doc_b = parsing.get_param_descr(instance, 'b') self.assertEqual(inst_doc_b, 'String b.') init_a = parsing.get_param_descr(instance.__init__, 'a') self.assertEqual(init_a, 'String a.') init_b = parsing.get_param_descr(instance.__init__, 'b') self.assertEqual(init_b, 'String b.') method_a = parsing.get_param_descr(instance.method, 'a') self.assertEqual(method_a, 'String a.') method_b = parsing.get_param_descr(instance.method, 'b') self.assertEqual(method_b, 'String b.')
return pipeline_funcs def __exit__(self, *args): pipeline_context.pipeline_decorator_handler = self.old_handler @click.command() @click.option('--py', type=click.Path(exists=True, dir_okay=False), required=True, help='Local absolute path to a py file.') @click.option('--output', type=click.Path(exists=False, dir_okay=False), required=True, help=parsing.get_param_descr(_compile_pipeline_function, 'package_path')) @click.option('--function', 'function_name', type=str, default=None, help=parsing.get_param_descr(_compile_pipeline_function, 'function_name')) @click.option('--pipeline-parameters', type=str, default=None, help='The pipeline parameters in JSON dict format.') @click.option('--disable-type-check', is_flag=True, default=False, help=parsing.get_param_descr(_compile_pipeline_function, 'disable_type_check'))
from kfp.cli.utils import parsing @click.group( cls=deprecated_alias_group.deprecated_alias_group_factory( {'submit': 'create'})) def run(): """Manage run resources.""" pass @run.command() @click.option( '-e', '--experiment-id', help=parsing.get_param_descr(client.Client.list_runs, 'experiment_id')) @click.option( '--page-token', default='', help=parsing.get_param_descr(client.Client.list_runs, 'page_token')) @click.option( '-m', '--max-size', default=100, help=parsing.get_param_descr(client.Client.list_runs, 'page_size')) @click.option( '--sort-by', default='created_at desc', help=parsing.get_param_descr(client.Client.list_runs, 'sort_by')) @click.option( '--filter', help=parsing.get_param_descr(client.Client.list_runs, 'filter'))
@click.group() def recurring_run(): """Manage recurring run resources.""" pass either_option_required = 'Either --experiment-id or --experiment-name is required.' @recurring_run.command() @click.option( '--catchup/--no-catchup', type=bool, help=parsing.get_param_descr(client.Client.create_recurring_run, 'no_catchup'), ) @click.option('--cron-expression', help=parsing.get_param_descr(client.Client.create_recurring_run, 'cron_expression')) @click.option('--description', help=parsing.get_param_descr(client.Client.create_recurring_run, 'description')) @click.option( '--enable-caching/--disable-caching', type=bool, default=None, help=parsing.get_param_descr(client.Client.create_recurring_run, 'enable_caching'), ) @click.option('--enabled/--disabled',
@click.group(cls=deprecated_alias_group.deprecated_alias_group_factory({ 'upload': 'create', 'upload-version': 'create-version' })) def pipeline(): """Manage pipeline resources.""" pass @pipeline.command() @click.option('-p', '--pipeline-name', help=parsing.get_param_descr(client.Client.upload_pipeline, 'pipeline_name')) @click.option('-d', '--description', help=parsing.get_param_descr(client.Client.upload_pipeline, 'description')) @click.argument('package-file') @click.pass_context def create(ctx: click.Context, pipeline_name: str, package_file: str, description: str = None): """Upload a pipeline.""" client = ctx.obj['client'] output_format = ctx.obj['output'] pipeline = client.upload_pipeline(package_file, pipeline_name, description)
from kfp.cli.output import print_output from kfp.cli.utils import parsing from kfp_server_api.models.api_experiment import ApiExperiment @click.group() def experiment(): """Manage experiment resources.""" pass @experiment.command() @click.option( '-d', '--description', help=parsing.get_param_descr(client.Client.create_experiment, 'description')) @click.argument('name') @click.pass_context def create(ctx: click.Context, description: str, name: str): """Create an experiment.""" client = ctx.obj['client'] output_format = ctx.obj['output'] experiment = client.create_experiment(name, description=description) _display_experiment(experiment, output_format) click.echo(f'Created experiment {experiment.id}.') @experiment.command() @click.option( '--page-token',